diff --git a/Makefile b/Makefile index 638b5cf..f2533ff 100644 --- a/Makefile +++ b/Makefile @@ -139,4 +139,11 @@ ssh-submodule-urls: echo -n 'New URL: '; \ git remote get-url origin" +install-rust: + curl https://sh.rustup.rs -sSf | sh -s -- -y + +rust-ext: + [ "$$READTHEDOCS" != "True" ] || $(MAKE) install-rust + cd ./rust && PATH="$$HOME/.cargo/bin/:$$PATH" cargo build --release + .PHONY: docs diff --git a/scripts/travis-install.sh b/scripts/travis-install.sh index a9be183..8b7a3bc 100644 --- a/scripts/travis-install.sh +++ b/scripts/travis-install.sh @@ -9,5 +9,5 @@ if [ "$TRAVIS_OS_NAME" = "osx" ]; then . $HOME/osx-py3/bin/activate fi -curl https://sh.rustup.rs -sSf | sh -s -- -y +make install-rust export PATH="$HOME/.cargo/bin/:$PATH" diff --git a/setup.py b/setup.py index f8d641c..46fc83b 100644 --- a/setup.py +++ b/setup.py @@ -40,16 +40,16 @@ requirements = [ def build_native(spec): build = spec.add_external_build( - cmd=['cargo', 'build', '--release'], - path='./rust' + cmd=['make', 'rust-ext'], + path='.' ) spec.add_cffi_module( module_path='vdirsyncer._native', dylib=lambda: build.find_dylib( - 'vdirsyncer_rustext', in_path='target/release'), + 'vdirsyncer_rustext', in_path='rust/target/release'), header_filename=lambda: build.find_header( - 'vdirsyncer_rustext.h', in_path='target'), + 'vdirsyncer_rustext.h', in_path='rust/target'), # Rust bug: If thread-local storage is used, this flag is necessary # (mitsuhiko) rtld_flags=['NODELETE']