]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
automake/rust: remove path.lib
authorJason Ish <jason.ish@oisf.net>
Fri, 12 Apr 2024 03:29:50 +0000 (21:29 -0600)
committerVictor Julien <victor@inliniac.net>
Fri, 12 Apr 2024 09:45:45 +0000 (11:45 +0200)
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.

rust/Cargo.toml.in
rust/Makefile.am
rust/derive/Cargo.toml.in

index 0d0fabb39d41f15e74d5f5d4228d19023f579712..8b2864761b8b82825440b6f0e6d9aee1c93e7701 100644 (file)
@@ -9,7 +9,6 @@ members = [".", "./derive"]
 
 [lib]
 crate-type = ["staticlib", "rlib"]
-path = "@e_rustdir@/src/lib.rs"
 name = "suricata"
 
 [profile.release]
index 2857288fefa311fdaa895f418fee2eff5fe09565..8bf685e5c74a9969140c3b2cc0d9d5c494f1dcbc 100644 (file)
@@ -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)"
 
index 830ddd38ab417b1f7760902bae84121e0002bfd6..dcf25f069200749139d6c694b64b8f02a59f452f 100644 (file)
@@ -5,7 +5,6 @@ edition = "2021"
 
 [lib]
 proc-macro = true
-path = "@e_rustdir@/derive/src/lib.rs"
 
 [dependencies]
 proc-macro-crate = "= 1.1.0"