From: Jason Ish Date: Fri, 12 Apr 2024 03:29:50 +0000 (-0600) Subject: automake/rust: remove path.lib X-Git-Tag: suricata-8.0.0-beta1~1497 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b9127e8b9651636c283a01a24ccfc92173f98c61;p=thirdparty%2Fsuricata.git automake/rust: remove path.lib Remove the path.lib parameter that is substituted into the output Cargo.toml by autoconf. Instead, as part of the build, "cd" into the source directory. We already set the Rust target directory to the external build directory. This makes the Cargo.toml more generic, and in a format suitable for publishing to crates.io. It also makes it easier to pull in external crates without needing to patch up their Cargo.toml, for example, it might make pulling libhtp-rs easier. --- diff --git a/rust/Cargo.toml.in b/rust/Cargo.toml.in index 0d0fabb39d..8b2864761b 100644 --- a/rust/Cargo.toml.in +++ b/rust/Cargo.toml.in @@ -9,7 +9,6 @@ members = [".", "./derive"] [lib] crate-type = ["staticlib", "rlib"] -path = "@e_rustdir@/src/lib.rs" name = "suricata" [profile.release] diff --git a/rust/Makefile.am b/rust/Makefile.am index 2857288fef..8bf685e5c7 100644 --- a/rust/Makefile.am +++ b/rust/Makefile.am @@ -2,7 +2,9 @@ EXTRA_DIST = src derive \ .cargo/config.in \ cbindgen.toml \ dist/rust-bindings.h \ - vendor + vendor \ + Cargo.toml Cargo.lock \ + derive/Cargo.toml if !DEBUG RELEASE = --release @@ -30,14 +32,14 @@ endif all-local: Cargo.toml if HAVE_CYGPATH - @rustup_home@ \ - CARGO_HOME="$(CARGO_HOME)" \ + cd $(abs_top_srcdir)/rust && \ + @rustup_home@ CARGO_HOME="$(CARGO_HOME)" \ CARGO_TARGET_DIR="$(e_rustdir)/target" \ $(CARGO) build $(RELEASE) \ --features "$(RUST_FEATURES)" $(RUST_TARGET) else - @rustup_home@ \ - CARGO_HOME="$(CARGO_HOME)" \ + cd $(abs_top_srcdir)/rust && \ + @rustup_home@ CARGO_HOME="$(CARGO_HOME)" \ CARGO_TARGET_DIR="$(abs_top_builddir)/rust/target" \ $(CARGO) build $(RELEASE) $(NIGHTLY_ARGS) \ --features "$(RUST_FEATURES)" $(RUST_TARGET) @@ -72,7 +74,8 @@ maintainer-clean-local: rm -rf vendor gen check: - CARGO_HOME="$(CARGO_HOME)" @rustup_home@ \ + cd $(abs_top_srcdir)/rust && \ + CARGO_HOME="$(CARGO_HOME)" @rustup_home@ \ CARGO_TARGET_DIR="$(abs_top_builddir)/rust/target" \ $(CARGO) test --all $(RELEASE) --features "$(RUST_FEATURES)" diff --git a/rust/derive/Cargo.toml.in b/rust/derive/Cargo.toml.in index 830ddd38ab..dcf25f0692 100644 --- a/rust/derive/Cargo.toml.in +++ b/rust/derive/Cargo.toml.in @@ -5,7 +5,6 @@ edition = "2021" [lib] proc-macro = true -path = "@e_rustdir@/derive/src/lib.rs" [dependencies] proc-macro-crate = "= 1.1.0"