]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Change our build process to run Cargo from inside the build tree
authorNick Mathewson <nickm@torproject.org>
Tue, 5 Dec 2017 13:30:26 +0000 (08:30 -0500)
committerNick Mathewson <nickm@torproject.org>
Tue, 5 Dec 2017 19:23:55 +0000 (14:23 -0500)
Instead of using the cwd to specify the location of Cargo.toml, we
use the --manifest-path option to specify its location explicitly.

This works around the bug that isis diagnosed on our jenkins builds.

changes/cargo-build-problem [new file with mode: 0644]
src/rust/tor_rust/include.am
src/test/test_rust.sh

diff --git a/changes/cargo-build-problem b/changes/cargo-build-problem
new file mode 100644 (file)
index 0000000..6691b0e
--- /dev/null
@@ -0,0 +1,3 @@
+  o Minor bugfixes (compilation, rust):
+    - Build correctly when building from outside Tor's source tree with the
+      TOR_RUST_DEPENDENCIES option set. Fixes bug 22768; bugfix on 0.3.1.7.
index 79361c33cc6f79b5bc545f8cbbe32f2ae7ad8ba2..c02324cb7730755d51f625a229148904d50385d2 100644 (file)
@@ -5,16 +5,20 @@ EXTRA_DIST +=\
 EXTRA_CARGO_OPTIONS=
 
 src/rust/target/release/@TOR_RUST_STATIC_NAME@: FORCE
-       ( cd "$(abs_top_srcdir)/src/rust/tor_rust" ; \
+       ( cd "$(abs_top_builddir)/src/rust" ; \
                CARGO_TARGET_DIR="$(abs_top_builddir)/src/rust/target" \
                CARGO_HOME="$(abs_top_builddir)/src/rust" \
-               $(CARGO) build --release $(EXTRA_CARGO_OPTIONS) $(CARGO_ONLINE) )
+               $(CARGO) build --release $(EXTRA_CARGO_OPTIONS) \
+               $(CARGO_ONLINE) \
+                --manifest-path "$(abs_top_srcdir)/src/rust/tor_rust/Cargo.toml" )
 
 distclean-rust:
-       ( cd "$(abs_top_srcdir)/src/rust/tor_rust" ; \
+       ( cd "$(abs_top_builddir)/src/rust" ; \
                CARGO_TARGET_DIR="$(abs_top_builddir)/src/rust/target" \
                CARGO_HOME="$(abs_top_builddir)/src/rust" \
-               $(CARGO) clean $(EXTRA_CARGO_OPTIONS) $(CARGO_ONLINE) )
+               $(CARGO) clean $(EXTRA_CARGO_OPTIONS) \
+               $(CARGO_ONLINE) \
+                --manifest-path "$(abs_top_srcdir)/src/rust/tor_rust/Cargo.toml" )
        rm -rf "$(abs_top_builddir)/src/rust/registry"
 
 if USE_RUST
index 8d7900e1df3f79d659bdfdd0bfd09511a1802476..133f2bb940f8e19d211ee23531e65df216695aa8 100755 (executable)
@@ -8,8 +8,12 @@ exitcode=0
 set -e
 
 for crate in $crates; do
-    cd "${abs_top_srcdir:-.}/src/rust/${crate}"
-    CARGO_TARGET_DIR="${abs_top_builddir:-../../..}/src/rust/target" CARGO_HOME="${abs_top_builddir:-../../..}/src/rust" "${CARGO:-cargo}" test ${CARGO_ONLINE-"--frozen"} || exitcode=1
+    cd "${abs_top_builddir:-../../..}/src/rust"
+    CARGO_TARGET_DIR="${abs_top_builddir:-../../..}/src/rust/target" \
+      CARGO_HOME="${abs_top_builddir:-../../..}/src/rust" \
+      "${CARGO:-cargo}" test ${CARGO_ONLINE-"--frozen"} \
+      --manifest-path "${abs_top_srcdir:-.}/src/rust/${crate}/Cargo.toml" \
+       || exitcode=1
     cd -
 done