From: Jason Ish Date: Tue, 20 Jun 2017 16:17:54 +0000 (-0600) Subject: rust: save cargo and CARGO_HOME to variables X-Git-Tag: suricata-4.0.0-rc1~27 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=14951e3f0079df212444d82bdc5ebb27cb88f01d;p=thirdparty%2Fsuricata.git rust: save cargo and CARGO_HOME to variables During configure, substitute the path of cargo, as well as the value of CARGO_HOME as variables. This fixes the case where a user might do: make sudo make install Which will cause the cargo bits to be rebuilt, including re-downloading external crates. By saving these to variables we can be sure that the same values are used during make install as were used during make which prevents the Rust artifacts from being rebuild during "sudo make install". --- diff --git a/configure.ac b/configure.ac index 2720c58e22..5f587a7277 100644 --- a/configure.ac +++ b/configure.ac @@ -2007,9 +2007,15 @@ CFLAGS="${CFLAGS} -I../rust/gen/c-headers" AC_SUBST(RUST_SURICATA_LIB) AC_SUBST(RUST_LDADD) + AC_SUBST([CARGO], [$HAVE_CARGO]) + if test "x$CARGO_HOME" = "x"; then + AC_SUBST([CARGO_HOME], [~/.cargo]) + else + AC_SUBST([CARGO_HOME], [$CARGO_HOME]) + fi AC_CHECK_FILES([$srcdir/rust/vendor], [have_rust_vendor="yes"]) if test "x$have_rust_vendor" = "xyes"; then - rust_vendor_comment="" + rust_vendor_comment="" fi fi fi diff --git a/rust/Makefile.am b/rust/Makefile.am index 8b67c7bed3..9cf6eec83e 100644 --- a/rust/Makefile.am +++ b/rust/Makefile.am @@ -29,15 +29,17 @@ all-local: if HAVE_PYTHON cd $(top_srcdir)/rust && CARGO_TARGET_DIR=$(abs_builddir)/target \ $(HAVE_PYTHON) ./gen-c-headers.py && \ - cargo build $(RELEASE) $(FROZEN) --features "$(FEATURES)" + CARGO_HOME=$(CARGO_HOME) $(CARGO) build $(RELEASE) $(FROZEN) \ + --features "$(FEATURES)" else cd $(top_srcdir)/rust && CARGO_TARGET_DIR=$(abs_builddir)/target \ - cargo build $(RELEASE) $(FROZEN) --features "$(FEATURES)" + CARGO_HOME=$(CARGO_HOME) $(CARGO) build $(RELEASE) $(FROZEN) \ + --features "$(FEATURES)" endif clean-local: cd $(top_srcdir)/rust && CARGO_TARGET_DIR=$(abs_builddir)/target \ - cargo clean + CARGO_HOME=$(CARGO_HOME) $(CARGO) clean distclean-local: rm -rf vendor @@ -45,14 +47,14 @@ distclean-local: check: cd $(top_srcdir)/rust && CARGO_TARGET_DIR=$(abs_builddir)/target \ - cargo test + CARGO_HOME=$(CARGO_HOME) $(CARGO) test Cargo.lock: Cargo.toml - cargo update + CARGO_HOME=$(CARGO_HOME) $(CARGO) update if HAVE_CARGO_VENDOR vendor: - cargo vendor > /dev/null + CARGO_HOME=$(CARGO_HOME) $(CARGO) vendor > /dev/null else vendor: endif