Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate gir without link attribute #1508

Merged
merged 8 commits into from
Sep 19, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion gdk-pixbuf/src/auto/versions.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Generated by gir (https://github.com/gtk-rs/gir @ ae08ff966747)
Generated by gir (https://github.com/gtk-rs/gir @ ea1ee40bf933)
from gir-files (https://github.com/gtk-rs/gir-files @ 4d1189172a70)
1 change: 0 additions & 1 deletion gdk-pixbuf/sys/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,6 @@ impl ::std::fmt::Debug for GdkPixbufSimpleAnimIter {
}
}

#[link(name = "gdk_pixbuf-2.0")]
extern "C" {

//=========================================================================
Expand Down
2 changes: 1 addition & 1 deletion gdk-pixbuf/sys/versions.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Generated by gir (https://github.com/gtk-rs/gir @ ae08ff966747)
Generated by gir (https://github.com/gtk-rs/gir @ ea1ee40bf933)
from gir-files (https://github.com/gtk-rs/gir-files @ 4d1189172a70)
2 changes: 1 addition & 1 deletion gio/src/auto/versions.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Generated by gir (https://github.com/gtk-rs/gir @ ae08ff966747)
Generated by gir (https://github.com/gtk-rs/gir @ ea1ee40bf933)
from gir-files (https://github.com/gtk-rs/gir-files @ 4d1189172a70)
1 change: 0 additions & 1 deletion gio/sys/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9363,7 +9363,6 @@ impl ::std::fmt::Debug for GVolume {
}
}

#[link(name = "gio-2.0")]
extern "C" {

//=========================================================================
Expand Down
1 change: 0 additions & 1 deletion gio/sys/src/manual.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ mod windows_streams {
gboolean, GInputStream, GInputStreamClass, GOutputStream, GOutputStreamClass, GType,
};

#[link(name = "gio-2.0")]
extern "C" {
//=========================================================================
// GWin32InputStream
Expand Down
2 changes: 1 addition & 1 deletion gio/sys/versions.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Generated by gir (https://github.com/gtk-rs/gir @ ae08ff966747)
Generated by gir (https://github.com/gtk-rs/gir @ ea1ee40bf933)
from gir-files (https://github.com/gtk-rs/gir-files @ 4d1189172a70)
2 changes: 1 addition & 1 deletion gir
4 changes: 4 additions & 0 deletions glib/gobject-sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,7 @@ version = "2.81"
rustc-args = ["--cfg", "docsrs"]
rustdoc-args = ["--cfg", "docsrs", "--generate-link-to-definition"]
all-features = true

[lints.rust.unexpected_cfgs]
level = "warn"
check-cfg = ["cfg(msvc_dll)"]
eerii marked this conversation as resolved.
Show resolved Hide resolved
1 change: 0 additions & 1 deletion glib/gobject-sys/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1415,7 +1415,6 @@ impl ::std::fmt::Debug for GTypePlugin {
}
}

#[link(name = "gobject-2.0")]
extern "C" {

//=========================================================================
Expand Down
2 changes: 1 addition & 1 deletion glib/gobject-sys/versions.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Generated by gir (https://github.com/gtk-rs/gir @ ae08ff966747)
Generated by gir (https://github.com/gtk-rs/gir @ ea1ee40bf933)
from gir-files (https://github.com/gtk-rs/gir-files @ 4d1189172a70)
2 changes: 1 addition & 1 deletion glib/src/auto/versions.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Generated by gir (https://github.com/gtk-rs/gir @ ae08ff966747)
Generated by gir (https://github.com/gtk-rs/gir @ ea1ee40bf933)
from gir-files (https://github.com/gtk-rs/gir-files @ 4d1189172a70)
95 changes: 60 additions & 35 deletions glib/src/param_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -296,20 +296,13 @@ pub unsafe trait ParamSpecType:
{
}

#[link(name = "gobject-2.0")]
extern "C" {
pub static g_param_spec_types: *const ffi::GType;
}

macro_rules! define_param_spec {
($rust_type:ident, $ffi_type:path, $rust_type_offset:expr) => {
// Can't use get_type here as this is not a boxed type but another fundamental type
($rust_type:ident, $ffi_type:path, $type_name:literal) => {
impl StaticType for $rust_type {
#[inline]
fn static_type() -> Type {
unsafe {
from_glib(*g_param_spec_types.add($rust_type_offset))
}
const NAME: &CStr = unsafe { std::ffi::CStr::from_bytes_with_nul_unchecked(concat!($type_name, "\0").as_bytes()) };
unsafe { from_glib(gobject_ffi::g_type_from_name(NAME.as_ptr())) }
eerii marked this conversation as resolved.
Show resolved Hide resolved
eerii marked this conversation as resolved.
Show resolved Hide resolved
}
}

Expand Down Expand Up @@ -557,8 +550,8 @@ macro_rules! define_param_spec_min_max {
}

macro_rules! define_param_spec_numeric {
($rust_type:ident, $ffi_type:path, $value_type:ty, $rust_type_offset:expr, $ffi_fun:ident) => {
define_param_spec!($rust_type, $ffi_type, $rust_type_offset);
($rust_type:ident, $ffi_type:path, $value_type:ty, $type_name:literal, $ffi_fun:ident) => {
define_param_spec!($rust_type, $ffi_type, $type_name);
define_param_spec_default!($rust_type, $ffi_type, $value_type, |x| x);
define_param_spec_min_max!($rust_type, $ffi_type, $value_type);

Expand Down Expand Up @@ -788,7 +781,7 @@ define_param_spec_numeric!(
ParamSpecChar,
gobject_ffi::GParamSpecChar,
i8,
0,
"GParamChar",
g_param_spec_char
);

Expand All @@ -808,7 +801,7 @@ define_param_spec_numeric!(
ParamSpecUChar,
gobject_ffi::GParamSpecUChar,
u8,
1,
"GParamUChar",
g_param_spec_uchar
);

Expand All @@ -829,7 +822,11 @@ wrapper! {
unref => |ptr| gobject_ffi::g_param_spec_unref(ptr as *mut gobject_ffi::GParamSpec),
}
}
define_param_spec!(ParamSpecBoolean, gobject_ffi::GParamSpecBoolean, 2);
define_param_spec!(
ParamSpecBoolean,
gobject_ffi::GParamSpecBoolean,
"GParamBoolean"
);

define_param_spec_default!(
ParamSpecBoolean,
Expand Down Expand Up @@ -880,7 +877,7 @@ define_param_spec_numeric!(
ParamSpecInt,
gobject_ffi::GParamSpecInt,
i32,
3,
"GParamInt",
g_param_spec_int
);

Expand All @@ -900,7 +897,7 @@ define_param_spec_numeric!(
ParamSpecUInt,
gobject_ffi::GParamSpecUInt,
u32,
4,
"GParamUInt",
g_param_spec_uint
);

Expand All @@ -925,7 +922,7 @@ define_param_spec_numeric!(
ParamSpecLong,
gobject_ffi::GParamSpecLong,
libc::c_long,
5,
"GParamLong",
g_param_spec_long
);

Expand All @@ -950,7 +947,7 @@ define_param_spec_numeric!(
ParamSpecULong,
gobject_ffi::GParamSpecULong,
libc::c_ulong,
6,
"GParamULong",
g_param_spec_ulong
);

Expand All @@ -975,7 +972,7 @@ define_param_spec_numeric!(
ParamSpecInt64,
gobject_ffi::GParamSpecInt64,
i64,
7,
"GParamInt64",
g_param_spec_int64
);

Expand All @@ -1000,7 +997,7 @@ define_param_spec_numeric!(
ParamSpecUInt64,
gobject_ffi::GParamSpecUInt64,
u64,
8,
"GParamUInt64",
g_param_spec_uint64
);

Expand All @@ -1021,7 +1018,11 @@ wrapper! {
unref => |ptr| gobject_ffi::g_param_spec_unref(ptr as *mut gobject_ffi::GParamSpec),
}
}
define_param_spec!(ParamSpecUnichar, gobject_ffi::GParamSpecUnichar, 9);
define_param_spec!(
ParamSpecUnichar,
gobject_ffi::GParamSpecUnichar,
"GParamUnichar"
);
define_param_spec_default!(ParamSpecUnichar, gobject_ffi::GParamSpecUnichar, Result<char, CharTryFromError>, TryFrom::try_from);

impl ParamSpecUnichar {
Expand Down Expand Up @@ -1063,7 +1064,7 @@ wrapper! {
unref => |ptr| gobject_ffi::g_param_spec_unref(ptr as *mut gobject_ffi::GParamSpec),
}
}
define_param_spec!(ParamSpecEnum, gobject_ffi::GParamSpecEnum, 10);
define_param_spec!(ParamSpecEnum, gobject_ffi::GParamSpecEnum, "GParamEnum");

impl ParamSpecEnum {
unsafe fn new_unchecked<'a>(
Expand Down Expand Up @@ -1207,7 +1208,7 @@ wrapper! {
unref => |ptr| gobject_ffi::g_param_spec_unref(ptr as *mut gobject_ffi::GParamSpec),
}
}
define_param_spec!(ParamSpecFlags, gobject_ffi::GParamSpecFlags, 11);
define_param_spec!(ParamSpecFlags, gobject_ffi::GParamSpecFlags, "GParamFlags");

impl ParamSpecFlags {
unsafe fn new_unchecked<'a>(
Expand Down Expand Up @@ -1350,7 +1351,7 @@ define_param_spec_numeric!(
ParamSpecFloat,
gobject_ffi::GParamSpecFloat,
f32,
12,
"GParamFloat",
g_param_spec_float
);

Expand All @@ -1375,7 +1376,7 @@ define_param_spec_numeric!(
ParamSpecDouble,
gobject_ffi::GParamSpecDouble,
f64,
13,
"GParamDouble",
g_param_spec_double
);

Expand All @@ -1396,7 +1397,11 @@ wrapper! {
unref => |ptr| gobject_ffi::g_param_spec_unref(ptr as *mut gobject_ffi::GParamSpec),
}
}
define_param_spec!(ParamSpecString, gobject_ffi::GParamSpecString, 14);
define_param_spec!(
ParamSpecString,
gobject_ffi::GParamSpecString,
"GParamString"
);

define_param_spec_default!(
ParamSpecString,
Expand Down Expand Up @@ -1505,7 +1510,7 @@ wrapper! {
unref => |ptr| gobject_ffi::g_param_spec_unref(ptr as *mut gobject_ffi::GParamSpec),
}
}
define_param_spec!(ParamSpecParam, gobject_ffi::GParamSpecParam, 15);
define_param_spec!(ParamSpecParam, gobject_ffi::GParamSpecParam, "GParamParam");

impl ParamSpecParam {
unsafe fn new_unchecked<'a>(
Expand Down Expand Up @@ -1547,7 +1552,7 @@ wrapper! {
unref => |ptr| gobject_ffi::g_param_spec_unref(ptr as *mut gobject_ffi::GParamSpec),
}
}
define_param_spec!(ParamSpecBoxed, gobject_ffi::GParamSpecBoxed, 16);
define_param_spec!(ParamSpecBoxed, gobject_ffi::GParamSpecBoxed, "GParamBoxed");

impl ParamSpecBoxed {
unsafe fn new_unchecked<'a>(
Expand Down Expand Up @@ -1635,7 +1640,11 @@ wrapper! {
unref => |ptr| gobject_ffi::g_param_spec_unref(ptr as *mut gobject_ffi::GParamSpec),
}
}
define_param_spec!(ParamSpecPointer, gobject_ffi::GParamSpecPointer, 17);
define_param_spec!(
ParamSpecPointer,
gobject_ffi::GParamSpecPointer,
"GParamPointer"
);

impl ParamSpecPointer {
unsafe fn new_unchecked<'a>(
Expand Down Expand Up @@ -1671,7 +1680,11 @@ wrapper! {
unref => |ptr| gobject_ffi::g_param_spec_unref(ptr as *mut gobject_ffi::GParamSpec),
}
}
define_param_spec!(ParamSpecValueArray, gobject_ffi::GParamSpecValueArray, 18);
define_param_spec!(
ParamSpecValueArray,
gobject_ffi::GParamSpecValueArray,
"GParamValueArray"
);

impl ParamSpecValueArray {
unsafe fn new_unchecked<'a>(
Expand Down Expand Up @@ -1791,7 +1804,11 @@ wrapper! {
unref => |ptr| gobject_ffi::g_param_spec_unref(ptr as *mut gobject_ffi::GParamSpec),
}
}
define_param_spec!(ParamSpecObject, gobject_ffi::GParamSpecObject, 19);
define_param_spec!(
ParamSpecObject,
gobject_ffi::GParamSpecObject,
"GParamObject"
);

impl ParamSpecObject {
unsafe fn new_unchecked<'a>(
Expand Down Expand Up @@ -1879,7 +1896,11 @@ wrapper! {
unref => |ptr| gobject_ffi::g_param_spec_unref(ptr as *mut gobject_ffi::GParamSpec),
}
}
define_param_spec!(ParamSpecOverride, gobject_ffi::GParamSpecOverride, 20);
define_param_spec!(
ParamSpecOverride,
gobject_ffi::GParamSpecOverride,
"GParamOverride"
);

impl ParamSpecOverride {
unsafe fn new_unchecked(name: &str, overridden: impl AsRef<ParamSpec>) -> ParamSpec {
Expand Down Expand Up @@ -1987,7 +2008,7 @@ wrapper! {
unref => |ptr| gobject_ffi::g_param_spec_unref(ptr as *mut gobject_ffi::GParamSpec),
}
}
define_param_spec!(ParamSpecGType, gobject_ffi::GParamSpecGType, 21);
define_param_spec!(ParamSpecGType, gobject_ffi::GParamSpecGType, "GParamGType");

impl ParamSpecGType {
unsafe fn new_unchecked<'a>(
Expand Down Expand Up @@ -2027,7 +2048,11 @@ wrapper! {
unref => |ptr| gobject_ffi::g_param_spec_unref(ptr as *mut gobject_ffi::GParamSpec),
}
}
define_param_spec!(ParamSpecVariant, gobject_ffi::GParamSpecVariant, 22);
define_param_spec!(
ParamSpecVariant,
gobject_ffi::GParamSpecVariant,
"GParamVariant"
);

define_param_spec_default!(
ParamSpecVariant,
Expand Down
10 changes: 0 additions & 10 deletions glib/sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -99,16 +99,6 @@ version = "2.80"
[package.metadata.system-deps.glib_2_0.v2_82]
version = "2.81"

[package.metadata.system-deps.gobject_2_0]
name = "gobject-2.0"
version = "2.56"

[package.metadata.system-deps.gobject_2_0.v2_58]
version = "2.58"

[package.metadata.system-deps.gobject_2_0.v2_62]
eerii marked this conversation as resolved.
Show resolved Hide resolved
version = "2.62"

[package.metadata.docs.rs]
rustc-args = ["--cfg", "docsrs"]
rustdoc-args = ["--cfg", "docsrs", "--generate-link-to-definition"]
Expand Down
2 changes: 0 additions & 2 deletions glib/sys/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2668,8 +2668,6 @@ impl ::std::fmt::Debug for GVariantType {
}
}

#[link(name = "gobject-2.0")]
#[link(name = "glib-2.0")]
extern "C" {

//=========================================================================
Expand Down
1 change: 0 additions & 1 deletion glib/sys/src/manual.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ mod win32 {
pub const G_WIN32_OS_WORKSTATION: GWin32OSType = 1;
pub const G_WIN32_OS_SERVER: GWin32OSType = 2;

#[link(name = "glib-2.0")]
extern "C" {
pub fn g_win32_check_windows_version(
major: c_int,
Expand Down
2 changes: 1 addition & 1 deletion glib/sys/versions.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Generated by gir (https://github.com/gtk-rs/gir @ ae08ff966747)
Generated by gir (https://github.com/gtk-rs/gir @ ea1ee40bf933)
from gir-files (https://github.com/gtk-rs/gir-files @ 4d1189172a70)
2 changes: 1 addition & 1 deletion graphene/src/auto/versions.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Generated by gir (https://github.com/gtk-rs/gir @ ae08ff966747)
Generated by gir (https://github.com/gtk-rs/gir @ ea1ee40bf933)
from gir-files (https://github.com/gtk-rs/gir-files @ 4d1189172a70)
1 change: 0 additions & 1 deletion graphene/sys/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,6 @@ impl ::std::fmt::Debug for graphene_vec4_t {
}
}

#[link(name = "graphene-1.0")]
extern "C" {

//=========================================================================
Expand Down
2 changes: 1 addition & 1 deletion graphene/sys/versions.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Generated by gir (https://github.com/gtk-rs/gir @ ae08ff966747)
Generated by gir (https://github.com/gtk-rs/gir @ ea1ee40bf933)
from gir-files (https://github.com/gtk-rs/gir-files @ 4d1189172a70)
2 changes: 1 addition & 1 deletion pango/src/auto/versions.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Generated by gir (https://github.com/gtk-rs/gir @ ae08ff966747)
Generated by gir (https://github.com/gtk-rs/gir @ ea1ee40bf933)
from gir-files (https://github.com/gtk-rs/gir-files @ 4d1189172a70)
Loading
Loading