-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support for the GNUstep Objective-C runtime (SSheldon/rust-objc#27).
Support for the GNUstep Objective-C runtime Restore accidentally lost attribute Cross-platform support for message sends with the GNUstep runtime. Add feature gates for the platform specific objc_msgSend implementation used by the GNUstep runtime (mips not currently supported because I'm unaware of the calling conventions). In all other cases, fall back to the cross-platform two-stage message sending. This now works and passes some of the tests (I had a buggy old gcc version yesterday, it seems). Every test that assumes NSObject to be present fails, though because that is not part of the GNUstep runtime. We'll either have to link gnustep-base for the tests to run properly, or provide stub implementation. Fix calling objc_slot_lookup_super(), which had the argument type wrong. Trick the linker into linking gnustep-base to pull in NSObject, eventhough we never reference the symbol for it. Also a bit of documentation. Fix libobjc2 repository location. Satisfy test dependencies using a stub NSObject implementation. Requires a patched gcc crate at the moment. Word Update to track proposed gcc-rs API Changes to the gcc crate were merged (cf. rust-lang/cc-rs#54) Experiment with travis builds Slim down a bit Shell script syntax is hard More shell script tweaks Tweak libobjc2 install location Stage libobjc2 into a local directory Conditionalize features, fix missing ‘;’ again. GNUstep base is no longer required for running tests. Fix gcc-rs revision Depend on a specific gcc-rs revision from github until a release includes the changes needed. Update dependencies to the released gcc-rs version. Exclude .travis.yml from publishing Restore original arch (aarch64 was incorrectly replaced with arm) Move NSObject dependency for tests with the GNUstep runtime into a sub-crate Rename ‘gnustep_runtime’ to ‘gnustep’ for brevity.
- Loading branch information
Showing
12 changed files
with
213 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,31 @@ | ||
language: rust | ||
rust: | ||
- stable | ||
- beta | ||
- nightly | ||
sudo: false | ||
install: | ||
- if [ "$TRAVIS_OS_NAME" = "linux" ]; then export FEATURE="gnustep"; export CC="clang"; export CXX="clang++"; else export FEATURE=""; fi | ||
- if [[ "$FEATURE" == *"gnustep"* ]]; then git clone https://github.com/gnustep/libobjc2.git; fi | ||
- if [[ "$FEATURE" == *"gnustep"* ]]; then mkdir libobjc2/build; pushd libobjc2/build; fi | ||
- if [[ "$FEATURE" == *"gnustep"* ]]; then cmake -DCMAKE_INSTALL_PREFIX:PATH=$HOME/libobjc2_staging ../; fi | ||
- if [[ "$FEATURE" == *"gnustep"* ]]; then make install; fi | ||
- if [[ "$FEATURE" == *"gnustep"* ]]; then export CPATH=$HOME/libobjc2_staging/include:$CPATH; export LIBRARY_PATH=$HOME/libobjc2_staging/lib:$LIBRARY_PATH; LD_LIBRARY_PATH=$HOME/libobjc2_staging/lib:$LD_LIBRARY_PATH; fi | ||
- if [[ "$FEATURE" == *"gnustep"* ]]; then popd; fi | ||
- if [ -n "$FEATURE" ]; then export FEATURES="--features $FEATURE"; else export FEATURES=""; fi; | ||
script: | ||
- cargo build $FEATURES | ||
- cargo test $FEATURES | ||
- cargo doc $FEATURES | ||
env: | ||
notifications: | ||
email: | ||
on_success: never | ||
os: | ||
- linux | ||
- osx | ||
addons: | ||
apt: | ||
packages: | ||
- clang-3.7 | ||
- cmake |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
[package] | ||
name = "test_ns_object" | ||
version = "0.0.1" | ||
authors = ["Niels Grewe"] | ||
|
||
description = "Mock implementation of NSObject for tests" | ||
repository = "http://github.com/SSheldon/rust-objc" | ||
license = "MIT" | ||
|
||
build = "build.rs" | ||
|
||
[features] | ||
gnustep = [ "gcc" ] | ||
|
||
[lib] | ||
name = "test_ns_object" | ||
path = "lib.rs" | ||
|
||
[build-dependencies.gcc] | ||
gcc = "0.3" | ||
optional = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#include <objc/runtime.h> | ||
#include <stdint.h> | ||
/** | ||
* This is a mock implementation of NSObject, which will be linked against | ||
* the tests in order to provide a superclass for them. | ||
*/ | ||
__attribute__((objc_root_class)) | ||
@interface NSObject | ||
{ | ||
Class isa; | ||
} | ||
@end | ||
|
||
@implementation NSObject | ||
|
||
+ (id)alloc | ||
{ | ||
return class_createInstance(self, 0); | ||
} | ||
|
||
- (id)init | ||
{ | ||
return self; | ||
} | ||
|
||
- (id)self | ||
{ | ||
return self; | ||
} | ||
|
||
- (uintptr_t)hash | ||
{ | ||
return (uintptr_t)(void*)self; | ||
} | ||
|
||
- (void)dealloc | ||
{ | ||
object_dispose(self); | ||
} | ||
|
||
- (NSObject*)description | ||
{ | ||
return nil; | ||
} | ||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#[cfg(feature="gnustep")] | ||
extern crate gcc; | ||
#[cfg(feature="gnustep")] | ||
use std::path::PathBuf; | ||
|
||
|
||
#[cfg(not(feature="gnustep"))] | ||
fn compile() { | ||
} | ||
|
||
#[cfg(feature="gnustep")] | ||
fn compile() { | ||
gcc::Config::new().flag("-lobjc") | ||
.flag("-fobjc-runtime=gnustep-1.8") | ||
.flag("-fno-objc-legacy-dispatch") | ||
.file("NSObject.m") | ||
.compile("libNSObject.a"); | ||
let path = ::std::env::var_os("OUT_DIR").map(PathBuf::from).unwrap(); | ||
println!("cargo:rustc-link-search=native={}", path.display()); | ||
} | ||
fn main() { | ||
compile(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#![crate_name = "test_ns_object"] | ||
#![crate_type = "lib"] | ||
|