mirror of https://github.com/OISF/suricata
rust: hook rust into the build
Rust is currently optional, use the --enable-rust configure argument to enable Rust. By default Rust will be built in release mode. If debug is enabled then it will be built in debug mode. On make dist, "cargo vendor" will be run to make a local copy of Rust dependencies for the distribution archive file. Add autoconf checks to test for the vendored source, and if it exists setup the build to use the vendored code instead of fetching it from the network. Also, as Cargo requires semantic versioning, the Suricata version had to change from 4.0dev to 4.0.0-dev.pull/2746/head
parent
cf0b9dd45f
commit
8f81792da5
@ -0,0 +1,8 @@
|
||||
@rust_vendor_comment@[source]
|
||||
@rust_vendor_comment@
|
||||
@rust_vendor_comment@[source.crates-io]
|
||||
@rust_vendor_comment@registry = 'https://github.com/rust-lang/crates.io-index'
|
||||
@rust_vendor_comment@replace-with = 'vendored-sources'
|
||||
@rust_vendor_comment@
|
||||
@rust_vendor_comment@[source.vendored-sources]
|
||||
@rust_vendor_comment@directory = './vendor'
|
@ -1,2 +1,5 @@
|
||||
target
|
||||
Cargo.lock
|
||||
!Cargo.toml.in
|
||||
/.cargo/config
|
||||
/Cargo.toml
|
||||
/target
|
||||
/vendor
|
||||
|
@ -0,0 +1,21 @@
|
||||
[root]
|
||||
name = "suricata"
|
||||
version = "4.0.0-dev"
|
||||
dependencies = [
|
||||
"libc 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"nom 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.21"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "nom"
|
||||
version = "2.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[metadata]
|
||||
"checksum libc 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)" = "88ee81885f9f04bff991e306fea7c1c60a5f0f9e409e99f6b40e3311a3363135"
|
||||
"checksum nom 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e5d4598834859fedb9a0a69d5b862a970e77982a92f544d547257a4d49469067"
|
@ -0,0 +1,44 @@
|
||||
EXTRA_DIST = Cargo.toml \
|
||||
Cargo.lock \
|
||||
src/lib.rs \
|
||||
.cargo/config.in
|
||||
|
||||
if HAVE_RUST
|
||||
EXTRA_DIST += vendor
|
||||
endif
|
||||
|
||||
if HAVE_RUST_VENDOR
|
||||
FROZEN = --frozen
|
||||
endif
|
||||
|
||||
if !DEBUG
|
||||
RELEASE = --release
|
||||
endif
|
||||
|
||||
if HAVE_RUST
|
||||
all-local:
|
||||
cd $(top_srcdir)/rust && CARGO_TARGET_DIR=$(abs_builddir)/target \
|
||||
cargo build $(RELEASE) $(FROZEN)
|
||||
|
||||
clean-local:
|
||||
cd $(top_srcdir)/rust && CARGO_TARGET_DIR=$(abs_builddir)/target \
|
||||
cargo clean
|
||||
|
||||
distclean-local:
|
||||
rm -rf vendor
|
||||
|
||||
check:
|
||||
cd $(top_srcdir)/rust && CARGO_TARGET_DIR=$(abs_builddir)/target \
|
||||
cargo test
|
||||
else
|
||||
all-local clean-local check:
|
||||
endif
|
||||
|
||||
if HAVE_CARGO_VENDOR
|
||||
vendor:
|
||||
cargo vendor > /dev/null
|
||||
else
|
||||
vendor:
|
||||
@echo "error: cargo vendor not installed"
|
||||
exit 1
|
||||
endif
|
Loading…
Reference in New Issue