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.
pull/10821/head
Jason Ish 1 year ago committed by Victor Julien
parent 172775ed84
commit b9127e8b96

@ -9,7 +9,6 @@ members = [".", "./derive"]
[lib]
crate-type = ["staticlib", "rlib"]
path = "@e_rustdir@/src/lib.rs"
name = "suricata"
[profile.release]

@ -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)"

@ -5,7 +5,6 @@ edition = "2021"
[lib]
proc-macro = true
path = "@e_rustdir@/derive/src/lib.rs"
[dependencies]
proc-macro-crate = "= 1.1.0"

Loading…
Cancel
Save