Auto merge of #4430 - str4d:build-fixes, r=str4d
Rust build fixes Fixes cross-compilation, along with some minor adjustments to the Makefile integration.
This commit is contained in:
commit
6fcfe529d9
|
@ -127,19 +127,19 @@ def util_test():
|
||||||
) == 0
|
) == 0
|
||||||
|
|
||||||
def rust_test():
|
def rust_test():
|
||||||
target_dir = os.path.join(REPOROOT, 'target', 'x86_64-unknown-linux-gnu')
|
depends_dir = os.path.join(REPOROOT, 'depends', 'x86_64-unknown-linux-gnu')
|
||||||
if not os.path.isdir(target_dir):
|
if not os.path.isdir(depends_dir):
|
||||||
target_dir = os.path.join(REPOROOT, 'target', 'x86_64-apple-darwin')
|
depends_dir = os.path.join(REPOROOT, 'depends', 'x86_64-apple-darwin')
|
||||||
|
|
||||||
if os.path.isdir(target_dir):
|
if os.path.isdir(depends_dir):
|
||||||
# cargo build --tests will produce a binary named something
|
rust_env = os.environ.copy()
|
||||||
# like rustzcash-b38184f84aaf9146 (see also https://github.com/rust-lang/cargo/issues/1924)
|
rust_env['RUSTC'] = os.path.join(depends_dir, 'native', 'bin', 'rustc')
|
||||||
# so let's find it and run it.
|
return subprocess.call([
|
||||||
test_files = glob(os.path.join(target_dir, 'release', 'rustzcash*'))
|
os.path.join(depends_dir, 'native', 'bin', 'cargo'),
|
||||||
for candidate in test_files:
|
'test',
|
||||||
if candidate[-2::] != ".d":
|
'--manifest-path',
|
||||||
# Only one test target to run
|
os.path.join(REPOROOT, 'Cargo.toml'),
|
||||||
return subprocess.call([candidate]) == 0
|
], env=rust_env) == 0
|
||||||
|
|
||||||
# Didn't manage to run anything
|
# Didn't manage to run anything
|
||||||
return False
|
return False
|
||||||
|
|
|
@ -57,7 +57,11 @@ LIBBITCOIN_WALLET=libbitcoin_wallet.a
|
||||||
endif
|
endif
|
||||||
|
|
||||||
RUST_ENV_VARS = RUSTC="$(RUSTC)" TERM=dumb
|
RUST_ENV_VARS = RUSTC="$(RUSTC)" TERM=dumb
|
||||||
RUST_BUILD_OPTS = --release --target $(RUST_TARGET)
|
RUST_BUILD_OPTS = --lib --release --target $(RUST_TARGET)
|
||||||
|
|
||||||
|
rust_verbose = $(rust_verbose_@AM_V@)
|
||||||
|
rust_verbose_ = $(rust_verbose_@AM_DEFAULT_V@)
|
||||||
|
rust_verbose_1 = --verbose
|
||||||
|
|
||||||
if ENABLE_ONLINE_RUST
|
if ENABLE_ONLINE_RUST
|
||||||
# Ensure that .cargo/config does not exist
|
# Ensure that .cargo/config does not exist
|
||||||
|
@ -79,7 +83,7 @@ $(CARGO_CONFIGURED): $(top_srcdir)/.cargo/config.offline
|
||||||
endif
|
endif
|
||||||
|
|
||||||
cargo-build: $(CARGO_CONFIGURED)
|
cargo-build: $(CARGO_CONFIGURED)
|
||||||
$(RUST_ENV_VARS) $(CARGO) build --lib --tests $(RUST_BUILD_OPTS) --manifest-path $(top_srcdir)/Cargo.toml
|
$(RUST_ENV_VARS) $(CARGO) build $(RUST_BUILD_OPTS) $(rust_verbose) --manifest-path $(top_srcdir)/Cargo.toml
|
||||||
|
|
||||||
if TARGET_WINDOWS
|
if TARGET_WINDOWS
|
||||||
LIBRUSTZCASH_WIN=$(top_builddir)/target/$(RUST_TARGET)/release/rustzcash.lib
|
LIBRUSTZCASH_WIN=$(top_builddir)/target/$(RUST_TARGET)/release/rustzcash.lib
|
||||||
|
@ -613,7 +617,7 @@ DISTCLEANFILES = obj/build.h
|
||||||
EXTRA_DIST = leveldb
|
EXTRA_DIST = leveldb
|
||||||
|
|
||||||
clean-local:
|
clean-local:
|
||||||
rm -f .cargo/config .cargo/.configured-for-online .cargo/.configured-for-offline
|
rm -f $(top_srcdir)/.cargo/config $(top_srcdir)/.cargo/.configured-for-*
|
||||||
-$(MAKE) -C leveldb clean
|
-$(MAKE) -C leveldb clean
|
||||||
-$(MAKE) -C secp256k1 clean
|
-$(MAKE) -C secp256k1 clean
|
||||||
-$(MAKE) -C univalue clean
|
-$(MAKE) -C univalue clean
|
||||||
|
|
Loading…
Reference in New Issue