|
|
|
SUBDIRS = sys
|
|
|
|
|
|
|
|
EXTRA_DIST = src derive \
|
|
|
|
.cargo/config.toml.in \
|
|
|
|
cbindgen.toml \
|
|
|
|
dist/rust-bindings.h \
|
|
|
|
vendor \
|
|
|
|
Cargo.toml Cargo.lock \
|
|
|
|
derive/Cargo.toml \
|
|
|
|
sys \
|
|
|
|
sys/Cargo.toml
|
|
|
|
|
|
|
|
if !DEBUG
|
|
|
|
RELEASE = --release
|
|
|
|
endif
|
|
|
|
|
|
|
|
if RUST_BUILD_STD
|
|
|
|
NIGHTLY_ARGS = -Z build-std
|
|
|
|
endif
|
|
|
|
|
|
|
|
if HAVE_JA3
|
|
|
|
RUST_FEATURES += ja3
|
|
|
|
endif
|
|
|
|
|
|
|
|
if HAVE_JA4
|
|
|
|
RUST_FEATURES += ja4
|
|
|
|
endif
|
|
|
|
|
|
|
|
if DEBUG
|
|
|
|
RUST_FEATURES += debug
|
|
|
|
endif
|
|
|
|
|
|
|
|
if DEBUG_VALIDATION
|
|
|
|
RUST_FEATURES += debug-validate
|
|
|
|
endif
|
|
|
|
|
|
|
|
if RUST_CROSS_COMPILE
|
|
|
|
RUST_TARGET = --target $(host_triplet)
|
|
|
|
endif
|
|
|
|
|
|
|
|
if HAVE_CYGPATH
|
rust: put all rust/cargo env vars in CARGO_ENV
To ensure that all calls to cargo use the same environment variables,
put the environment variables in CARGO_ENV so every call to cargo can
easily use the same vars.
The Cargo build system is smarter than make, it can detect a change in
an environment variable that affects the build, and the setting of
SURICATA_LUA_SYS_HEADER_DST changing could cause a rebuild.
Also update suricata-lua-sys, which is smarter about copying headers. It
will only copy if the destination does not exist, or the source header
is newer than the target, which can also prevent unnecessary rebuilds.
This is mainly to fix an issue where subsequent builds may fail,
especially when running an editor with a LSP enabled:
Update lua crate to 0.1.0-alpha.5. This update will force a rewrite of
the headers if the env var SURICATA_LUA_SYS_HEADER_DST changes. This
fixes the issue where the headers may not be written.
The cause is that Rust dependencies are cached, and if your editor is
using rust-analyzer, it might cache the build without this var being
set, so these headers are not available to Suricata. This crate update
forces the re-run of the Lua build.rs if this env var changes, fixing
this issue.
3 months ago
|
|
|
CARGO_ENV = @rustup_home@ \
|
|
|
|
CARGO_HOME="$(CARGO_HOME)" \
|
|
|
|
CARGO_TARGET_DIR="$(e_rustdir)/target" \
|
rust: put all rust/cargo env vars in CARGO_ENV
To ensure that all calls to cargo use the same environment variables,
put the environment variables in CARGO_ENV so every call to cargo can
easily use the same vars.
The Cargo build system is smarter than make, it can detect a change in
an environment variable that affects the build, and the setting of
SURICATA_LUA_SYS_HEADER_DST changing could cause a rebuild.
Also update suricata-lua-sys, which is smarter about copying headers. It
will only copy if the destination does not exist, or the source header
is newer than the target, which can also prevent unnecessary rebuilds.
This is mainly to fix an issue where subsequent builds may fail,
especially when running an editor with a LSP enabled:
Update lua crate to 0.1.0-alpha.5. This update will force a rewrite of
the headers if the env var SURICATA_LUA_SYS_HEADER_DST changes. This
fixes the issue where the headers may not be written.
The cause is that Rust dependencies are cached, and if your editor is
using rust-analyzer, it might cache the build without this var being
set, so these headers are not available to Suricata. This crate update
forces the re-run of the Lua build.rs if this env var changes, fixing
this issue.
3 months ago
|
|
|
SURICATA_LUA_SYS_HEADER_DST="$(e_rustdir)/gen"
|
|
|
|
else
|
rust: put all rust/cargo env vars in CARGO_ENV
To ensure that all calls to cargo use the same environment variables,
put the environment variables in CARGO_ENV so every call to cargo can
easily use the same vars.
The Cargo build system is smarter than make, it can detect a change in
an environment variable that affects the build, and the setting of
SURICATA_LUA_SYS_HEADER_DST changing could cause a rebuild.
Also update suricata-lua-sys, which is smarter about copying headers. It
will only copy if the destination does not exist, or the source header
is newer than the target, which can also prevent unnecessary rebuilds.
This is mainly to fix an issue where subsequent builds may fail,
especially when running an editor with a LSP enabled:
Update lua crate to 0.1.0-alpha.5. This update will force a rewrite of
the headers if the env var SURICATA_LUA_SYS_HEADER_DST changes. This
fixes the issue where the headers may not be written.
The cause is that Rust dependencies are cached, and if your editor is
using rust-analyzer, it might cache the build without this var being
set, so these headers are not available to Suricata. This crate update
forces the re-run of the Lua build.rs if this env var changes, fixing
this issue.
3 months ago
|
|
|
CARGO_ENV = @rustup_home@ \
|
|
|
|
CARGO_HOME="$(CARGO_HOME)" \
|
|
|
|
CARGO_TARGET_DIR="$(abs_top_builddir)/rust/target" \
|
rust: put all rust/cargo env vars in CARGO_ENV
To ensure that all calls to cargo use the same environment variables,
put the environment variables in CARGO_ENV so every call to cargo can
easily use the same vars.
The Cargo build system is smarter than make, it can detect a change in
an environment variable that affects the build, and the setting of
SURICATA_LUA_SYS_HEADER_DST changing could cause a rebuild.
Also update suricata-lua-sys, which is smarter about copying headers. It
will only copy if the destination does not exist, or the source header
is newer than the target, which can also prevent unnecessary rebuilds.
This is mainly to fix an issue where subsequent builds may fail,
especially when running an editor with a LSP enabled:
Update lua crate to 0.1.0-alpha.5. This update will force a rewrite of
the headers if the env var SURICATA_LUA_SYS_HEADER_DST changes. This
fixes the issue where the headers may not be written.
The cause is that Rust dependencies are cached, and if your editor is
using rust-analyzer, it might cache the build without this var being
set, so these headers are not available to Suricata. This crate update
forces the re-run of the Lua build.rs if this env var changes, fixing
this issue.
3 months ago
|
|
|
SURICATA_LUA_SYS_HEADER_DST="$(abs_top_builddir)/rust/gen"
|
|
|
|
endif
|
|
|
|
|
|
|
|
all-local: Cargo.toml
|
|
|
|
mkdir -p $(abs_top_builddir)/rust/gen
|
|
|
|
cd $(abs_top_srcdir)/rust && \
|
|
|
|
$(CARGO_ENV) \
|
|
|
|
$(CARGO) build $(RELEASE) $(NIGHTLY_ARGS) \
|
|
|
|
--features "$(RUST_FEATURES)" $(RUST_TARGET)
|
|
|
|
if test -e $(RUST_SURICATA_LIBDIR)/suricata.lib; then \
|
|
|
|
cp -a $(RUST_SURICATA_LIBDIR)/suricata.lib \
|
|
|
|
$(RUST_SURICATA_LIBDIR)/${RUST_SURICATA_LIBNAME}; \
|
|
|
|
fi
|
|
|
|
if test -e $(RUST_SURICATA_LIBDIR)/libsuricata.a; then \
|
|
|
|
cp -a $(RUST_SURICATA_LIBDIR)/libsuricata.a \
|
|
|
|
$(RUST_SURICATA_LIBDIR)/${RUST_SURICATA_LIBNAME}; \
|
|
|
|
fi
|
|
|
|
$(MAKE) gen/rust-bindings.h
|
|
|
|
|
|
|
|
install-library:
|
|
|
|
$(MKDIR_P) "$(DESTDIR)$(libdir)"
|
|
|
|
$(INSTALL_DATA) $(RUST_SURICATA_LIB) "$(DESTDIR)$(libdir)"
|
|
|
|
|
|
|
|
uninstall-local:
|
|
|
|
rm -f "$(DESTDIR)$(libdir)/$(RUST_SURICATA_LIBNAME)"
|
|
|
|
|
|
|
|
clean-local:
|
|
|
|
rm -rf target gen
|
|
|
|
|
|
|
|
distclean-local:
|
|
|
|
rm -rf vendor dist
|
|
|
|
|
|
|
|
check-bindgen-bindings:
|
|
|
|
if HAVE_BINDGEN
|
|
|
|
if test "$(top_srcdir)" = "$(top_builddir)"; then \
|
|
|
|
cp sys/src/sys.rs sys/src/sys.rs.orig; \
|
|
|
|
$(MAKE) update-bindings; \
|
|
|
|
if diff sys/src/sys.rs sys/src/sys.rs.orig > /dev/null 2>&1; then \
|
|
|
|
rm -f sys/src/sys.rs.orig; \
|
|
|
|
else \
|
|
|
|
echo "WARNING: bindgen bindings may be out of date"; \
|
|
|
|
fi \
|
|
|
|
else \
|
|
|
|
echo "Not checking bindings for out of tree build"; \
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
@echo "Unable to check bindgen bindings: bindgen not found"
|
|
|
|
endif
|
|
|
|
|
|
|
|
check:
|
|
|
|
cd $(abs_top_srcdir)/rust && \
|
rust: put all rust/cargo env vars in CARGO_ENV
To ensure that all calls to cargo use the same environment variables,
put the environment variables in CARGO_ENV so every call to cargo can
easily use the same vars.
The Cargo build system is smarter than make, it can detect a change in
an environment variable that affects the build, and the setting of
SURICATA_LUA_SYS_HEADER_DST changing could cause a rebuild.
Also update suricata-lua-sys, which is smarter about copying headers. It
will only copy if the destination does not exist, or the source header
is newer than the target, which can also prevent unnecessary rebuilds.
This is mainly to fix an issue where subsequent builds may fail,
especially when running an editor with a LSP enabled:
Update lua crate to 0.1.0-alpha.5. This update will force a rewrite of
the headers if the env var SURICATA_LUA_SYS_HEADER_DST changes. This
fixes the issue where the headers may not be written.
The cause is that Rust dependencies are cached, and if your editor is
using rust-analyzer, it might cache the build without this var being
set, so these headers are not available to Suricata. This crate update
forces the re-run of the Lua build.rs if this env var changes, fixing
this issue.
3 months ago
|
|
|
$(CARGO_ENV) \
|
|
|
|
$(CARGO) test --all $(RELEASE) --features "$(RUST_FEATURES)"
|
|
|
|
$(MAKE) check-bindgen-bindings
|
|
|
|
|
|
|
|
vendor:
|
rust: put all rust/cargo env vars in CARGO_ENV
To ensure that all calls to cargo use the same environment variables,
put the environment variables in CARGO_ENV so every call to cargo can
easily use the same vars.
The Cargo build system is smarter than make, it can detect a change in
an environment variable that affects the build, and the setting of
SURICATA_LUA_SYS_HEADER_DST changing could cause a rebuild.
Also update suricata-lua-sys, which is smarter about copying headers. It
will only copy if the destination does not exist, or the source header
is newer than the target, which can also prevent unnecessary rebuilds.
This is mainly to fix an issue where subsequent builds may fail,
especially when running an editor with a LSP enabled:
Update lua crate to 0.1.0-alpha.5. This update will force a rewrite of
the headers if the env var SURICATA_LUA_SYS_HEADER_DST changes. This
fixes the issue where the headers may not be written.
The cause is that Rust dependencies are cached, and if your editor is
using rust-analyzer, it might cache the build without this var being
set, so these headers are not available to Suricata. This crate update
forces the re-run of the Lua build.rs if this env var changes, fixing
this issue.
3 months ago
|
|
|
$(CARGO_ENV) $(CARGO) vendor
|
|
|
|
|
|
|
|
update-bindings:
|
|
|
|
if HAVE_BINDGEN
|
|
|
|
$(BINDGEN) \
|
|
|
|
-o sys/src/sys.rs.tmp \
|
|
|
|
--rust-target 1.68 \
|
|
|
|
--no-layout-tests \
|
|
|
|
--disable-header-comment \
|
|
|
|
--default-enum-style rust \
|
|
|
|
--allowlist-type 'AppProto.*' \
|
|
|
|
--allowlist-function 'AppProto.*' \
|
|
|
|
--allowlist-type 'SC.*' \
|
|
|
|
--allowlist-function 'SC.*' \
|
|
|
|
$(abs_top_srcdir)/src/bindgen.h \
|
|
|
|
-- \
|
|
|
|
-DHAVE_CONFIG_H -I../src -I../rust/gen $(CPPFLAGS)
|
|
|
|
printf "// This file is automatically generated. Do not edit.\n\n" > sys/src/sys.rs
|
|
|
|
cat sys/src/sys.rs.tmp >> sys/src/sys.rs
|
|
|
|
rm -f sys/src/sys.rs.tmp
|
|
|
|
else
|
|
|
|
@echo "error: bindgen not installed, can't update bindings"
|
|
|
|
exit 1
|
|
|
|
endif
|
|
|
|
|
|
|
|
if HAVE_CBINDGEN
|
|
|
|
gen/rust-bindings.h: $(RUST_SURICATA_LIB) cbindgen.toml
|
|
|
|
cd $(abs_top_srcdir)/rust && \
|
|
|
|
cbindgen --config $(abs_top_srcdir)/rust/cbindgen.toml \
|
|
|
|
--quiet --verify --output $(abs_top_builddir)/rust/gen/rust-bindings.h || true
|
|
|
|
else
|
|
|
|
gen/rust-bindings.h:
|
|
|
|
endif
|
|
|
|
|
|
|
|
doc:
|
|
|
|
CARGO_HOME=$(CARGO_HOME) $(CARGO) doc --all-features --no-deps
|
|
|
|
|
|
|
|
if HAVE_CBINDGEN
|
|
|
|
dist/rust-bindings.h:
|
|
|
|
cbindgen --config $(abs_top_srcdir)/rust/cbindgen.toml \
|
|
|
|
--quiet --output $(abs_top_builddir)/rust/dist/rust-bindings.h
|
|
|
|
else
|
|
|
|
dist/rust-bindings.h:
|
|
|
|
endif
|
|
|
|
|
|
|
|
Cargo.toml: Cargo.toml.in
|
|
|
|
|
|
|
|
update-lock: Cargo.toml
|
|
|
|
cargo update
|
|
|
|
mv Cargo.lock Cargo.lock.in
|