mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-12-06 19:41:15 +01:00
Allow Rust build using locally supplied crates or crates.io
This adds a couple of configure commands to control whether we're requiring all dependencies to be available locally (default) or not (--enable-cargo-online-mode). When building from a tarball, we require the RUST_DEPENDENCIES variable to point to the local repository of crates. This also adds src/ext/rust as a git submodule that contains such a local repository for easy setup.
This commit is contained in:
committed by
Nick Mathewson
parent
aeba64efad
commit
70c067102b
Submodule
+1
Submodule src/ext/rust added at 2402968008
@@ -0,0 +1,8 @@
|
||||
[source]
|
||||
|
||||
@RUST_DL@ [source.crates-io]
|
||||
@RUST_DL@ registry = 'https://github.com/rust-lang/crates.io-index'
|
||||
@RUST_DL@ replace-with = 'vendored-sources'
|
||||
|
||||
@RUST_DL@ [source.vendored-sources]
|
||||
@RUST_DL@ directory = '@RUST_DEPENDENCIES@'
|
||||
@@ -5,10 +5,3 @@ members = ["tor_util"]
|
||||
debug = true
|
||||
panic = "abort"
|
||||
|
||||
[source.crates-io]
|
||||
registry = 'https://github.com/rust-lang/crates.io-index'
|
||||
replace-with = 'vendored-sources'
|
||||
|
||||
[source.vendored-sources]
|
||||
directory = 'vendor'
|
||||
|
||||
|
||||
+2
-1
@@ -2,4 +2,5 @@ include src/rust/tor_util/include.am
|
||||
|
||||
EXTRA_DIST +=\
|
||||
src/rust/Cargo.toml \
|
||||
src/rust/Cargo.lock
|
||||
src/rust/Cargo.lock \
|
||||
src/rust/.cargo/config.in
|
||||
|
||||
@@ -7,6 +7,7 @@ EXTRA_DIST +=\
|
||||
src/rust/target/release/libtor_util.a: FORCE
|
||||
( cd "$(abs_top_srcdir)/src/rust/tor_util" ; \
|
||||
CARGO_TARGET_DIR="$(abs_top_builddir)/src/rust/target" \
|
||||
HOME="$(abs_top_builddir)/src/rust" \
|
||||
$(CARGO) build --release --quiet $(CARGO_ONLINE) )
|
||||
|
||||
FORCE:
|
||||
|
||||
@@ -5,6 +5,7 @@ TESTS_ENVIRONMENT = \
|
||||
export PYTHON="$(PYTHON)"; \
|
||||
export SHELL="$(SHELL)"; \
|
||||
export abs_top_srcdir="$(abs_top_srcdir)"; \
|
||||
export abs_top_builddir="$(abs_top_builddir)"; \
|
||||
export builddir="$(builddir)"; \
|
||||
export TESTING_TOR_BINARY="$(TESTING_TOR_BINARY)"; \
|
||||
export CARGO="$(CARGO)"; \
|
||||
|
||||
@@ -7,7 +7,7 @@ exitcode=0
|
||||
|
||||
for crate in $crates; do
|
||||
cd "${abs_top_srcdir:-.}/src/rust/${crate}"
|
||||
"${CARGO:-cargo}" test ${CARGO_ONLINE-"--frozen"} || exitcode=1
|
||||
CARGO_TARGET_DIR="${abs_top_builddir}/src/rust/target" HOME="${abs_top_builddir}/src/rust" "${CARGO:-cargo}" test ${CARGO_ONLINE-"--frozen"} || exitcode=1
|
||||
done
|
||||
|
||||
exit $exitcode
|
||||
|
||||
Reference in New Issue
Block a user