File tree Expand file tree Collapse file tree 4 files changed +27
-23
lines changed Expand file tree Collapse file tree 4 files changed +27
-23
lines changed Original file line number Diff line number Diff line change 7777 command : check
7878 args : --verbose --no-default-features
7979
80- - name : Install GNUStep libobjc2
81- if : contains(matrix.platform.os, 'ubuntu')
82- run : |
83- wget https://github.com/gnustep/libobjc2/archive/refs/tags/v1.9.tar.gz
84- tar -xzf v1.9.tar.gz
85- mkdir libobjc2-1.9/build
86- cd libobjc2-1.9/build
87- export CC="clang"
88- export CXX="clang++"
89- cmake ../
90- sudo make install
91-
9280 - name : Install GNUStep make
9381 if : contains(matrix.platform.os, 'ubuntu')
9482 run : |
@@ -122,7 +110,7 @@ jobs:
122110 with :
123111 command : test
124112 # Temporary fix
125- args : --verbose --no-fail-fast --no-default-features --package objc2_sys --package objc2 --package objc2_encode --package objc2_foundation
113+ args : --verbose --no-fail-fast --no-default-features --features objc2_sys/vendor_gnustep -- package objc2_sys --package objc2 --package objc2_encode --package objc2_foundation
126114
127115 - name : Test
128116 if : ${{ !contains(matrix.platform.os, 'ubuntu') }}
Original file line number Diff line number Diff line change 22
33Source of GNUStep's libobjc2 and logic to build it for Rust.
44
5- Using ` clang ` with at least version ` 8.0.0 ` is recommended. You can specify your desired compiler using the ` CC ` and ` CXX ` environment variables.
5+ You probably want to use ` objc2_sys ` , but this is kept separate from that so
6+ that users don't download the entire GNUStep source when they don't need to.
7+
8+ Using ` clang ` with at least version ` 8.0.0 ` is recommended. You can specify
9+ your desired compiler using the ` CC ` and ` CXX ` environment variables.
Original file line number Diff line number Diff line change @@ -27,3 +27,10 @@ readme = "README.md"
2727# See https://doc.rust-lang.org/cargo/reference/build-scripts.html#overriding-build-scripts
2828links = " objc"
2929build = " build.rs"
30+
31+ [features ]
32+ # If enabled, GNUStep's libobjc2 will be compiled and linked from source
33+ vendor_gnustep = [" libobjc2_src" ]
34+
35+ [build-dependencies ]
36+ libobjc2_src = { path = " ../libobjc2_src" , optional = true }
Original file line number Diff line number Diff line change 1- use std:: env;
1+ #[ cfg( feature = "vendor_gnustep" ) ]
2+ fn main ( ) {
3+ let artifacts = libobjc2_src:: build ( ) ;
4+ artifacts. print_cargo_metadata ( ) ;
5+ println ! ( "cargo:rustc-cfg=gnustep" ) ;
6+ }
27
8+ #[ cfg( not( feature = "vendor_gnustep" ) ) ]
39fn main ( ) {
410 // Only rerun if this file changes; the script doesn't depend on our code
511 println ! ( "cargo:rerun-if-changed=build.rs" ) ;
6- // Link to libobjc
7- println ! ( "cargo:rustc-link-lib=dylib=objc" ) ;
812
9- let target_vendor = env:: var ( "CARGO_CFG_TARGET_VENDOR" ) . unwrap ( ) ;
13+ let target_vendor = std :: env:: var ( "CARGO_CFG_TARGET_VENDOR" ) . unwrap ( ) ;
1014
11- // Adds useful #[cfg(apple)] and #[cfg(gnustep)] directives
1215 if target_vendor == "apple" {
16+ // Add #[cfg(apple)] directive
1317 println ! ( "cargo:rustc-cfg=apple" ) ;
1418 } else {
1519 // TODO: Are there other possibilities than GNUStep? Airyx? Is it
1620 // possible to use Apple's open source objc4 on other platforms?
21+
22+ // Add #[cfg(gnustep)] directive
1723 println ! ( "cargo:rustc-cfg=gnustep" ) ;
18- // TODO: Should we vendor GNUStep's libobjc2?
19- // Using Cargo.toml:
20- // [target.'cfg(not(target_vendor = "apple"))'.build-dependencies]
21- // cc = "1.0"
2224 }
25+
26+ // Link to libobjc
27+ println ! ( "cargo:rustc-link-lib=dylib=objc" ) ;
2328}
You can’t perform that action at this time.
0 commit comments