diff --git a/objc_sys/Cargo.toml b/objc_sys/Cargo.toml index b383ec817..f79473ae4 100644 --- a/objc_sys/Cargo.toml +++ b/objc_sys/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "objc_sys" -version = "0.0.0" +version = "0.0.0" # Remember to update html_root_url in lib.rs authors = ["Mads Marquart "] edition = "2018" @@ -13,3 +13,14 @@ categories = [ repository = "https://github.com/madsmtm/objc" documentation = "https://docs.rs/objc_sys/" license = "MIT" + +exclude = [ + # Used to help developers track changes by running bindgen against + # different revisions of Apple's open source `objc4`. + "helper-scripts/*", +] + +# Downstream users can customize the linking to libobjc! +# See https://doc.rust-lang.org/cargo/reference/build-scripts.html#overriding-build-scripts +links = "objc" +build = "build.rs" diff --git a/objc_sys/build.rs b/objc_sys/build.rs new file mode 100644 index 000000000..007d6e7e6 --- /dev/null +++ b/objc_sys/build.rs @@ -0,0 +1,10 @@ +fn main() { + println!("cargo:rerun-if-changed=build.rs"); + println!("cargo:rustc-link-lib=dylib=objc"); + + // TODO: Should we vendor GNUStep's libobjc2 on non-apple targets? + // Check std::env::env::var("CARGO_CFG_TARGET_VENDOR").unwrap() + // Cargo.toml: + // [target.'cfg(not(target_vendor = "apple"))'.build-dependencies] + // cc = "1.0" +} diff --git a/objc_sys/src/lib.rs b/objc_sys/src/lib.rs index e1b55232f..078a56019 100644 --- a/objc_sys/src/lib.rs +++ b/objc_sys/src/lib.rs @@ -5,15 +5,18 @@ //! Protocol / objc_protocol is no longer a type alias of objc_object, for //! better type safety. Their internal representation is the same, so the //! functionality is just a cast away. +//! +//! Deprecated functions are not included since they could be removed at any +//! macOS release, and then our code would break. // TODO: Replace `extern "C"` with `extern "C-unwind"`. #![no_std] #![allow(non_camel_case_types)] #![allow(non_upper_case_globals)] -// Update in Cargo.toml as well. -#![doc(html_root_url = "https://docs.rs/objc_sys/1.1.0")] +#![doc(html_root_url = "https://docs.rs/objc_sys/0.0.0")] +// TODO: Remove this and add "no-std" category to Cargo.toml extern crate std; use core::cell::UnsafeCell; @@ -52,6 +55,3 @@ pub use various::*; /// /// TODO: Replace this with `extern type` to also mark it as unsized. type OpaqueData = PhantomData<(UnsafeCell<*const ()>, PhantomPinned)>; - -#[link(name = "objc", kind = "dylib")] -extern "C" {}