diff --git a/Cargo.lock b/Cargo.lock index 1fe54c3975165..8ceeba4a592e0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -573,7 +573,7 @@ dependencies = [ [[package]] name = "cranelift-bforest" version = "0.64.0" -source = "git+https://github.com/bytecodealliance/lucet.git?rev=d4fc14a03bdb99ac83173d27fddf1aca48412a86#d4fc14a03bdb99ac83173d27fddf1aca48412a86" +source = "git+https://github.com/bytecodealliance/lucet.git?rev=d741e2e30df19d1f8abd1a8660219ac494336b76#d741e2e30df19d1f8abd1a8660219ac494336b76" dependencies = [ "cranelift-entity", ] @@ -581,7 +581,7 @@ dependencies = [ [[package]] name = "cranelift-codegen" version = "0.64.0" -source = "git+https://github.com/bytecodealliance/lucet.git?rev=d4fc14a03bdb99ac83173d27fddf1aca48412a86#d4fc14a03bdb99ac83173d27fddf1aca48412a86" +source = "git+https://github.com/bytecodealliance/lucet.git?rev=d741e2e30df19d1f8abd1a8660219ac494336b76#d741e2e30df19d1f8abd1a8660219ac494336b76" dependencies = [ "byteorder", "cranelift-bforest", @@ -599,7 +599,7 @@ dependencies = [ [[package]] name = "cranelift-codegen-meta" version = "0.64.0" -source = "git+https://github.com/bytecodealliance/lucet.git?rev=d4fc14a03bdb99ac83173d27fddf1aca48412a86#d4fc14a03bdb99ac83173d27fddf1aca48412a86" +source = "git+https://github.com/bytecodealliance/lucet.git?rev=d741e2e30df19d1f8abd1a8660219ac494336b76#d741e2e30df19d1f8abd1a8660219ac494336b76" dependencies = [ "cranelift-codegen-shared", "cranelift-entity", @@ -608,17 +608,17 @@ dependencies = [ [[package]] name = "cranelift-codegen-shared" version = "0.64.0" -source = "git+https://github.com/bytecodealliance/lucet.git?rev=d4fc14a03bdb99ac83173d27fddf1aca48412a86#d4fc14a03bdb99ac83173d27fddf1aca48412a86" +source = "git+https://github.com/bytecodealliance/lucet.git?rev=d741e2e30df19d1f8abd1a8660219ac494336b76#d741e2e30df19d1f8abd1a8660219ac494336b76" [[package]] name = "cranelift-entity" version = "0.64.0" -source = "git+https://github.com/bytecodealliance/lucet.git?rev=d4fc14a03bdb99ac83173d27fddf1aca48412a86#d4fc14a03bdb99ac83173d27fddf1aca48412a86" +source = "git+https://github.com/bytecodealliance/lucet.git?rev=d741e2e30df19d1f8abd1a8660219ac494336b76#d741e2e30df19d1f8abd1a8660219ac494336b76" [[package]] name = "cranelift-frontend" version = "0.64.0" -source = "git+https://github.com/bytecodealliance/lucet.git?rev=d4fc14a03bdb99ac83173d27fddf1aca48412a86#d4fc14a03bdb99ac83173d27fddf1aca48412a86" +source = "git+https://github.com/bytecodealliance/lucet.git?rev=d741e2e30df19d1f8abd1a8660219ac494336b76#d741e2e30df19d1f8abd1a8660219ac494336b76" dependencies = [ "cranelift-codegen", "log", @@ -629,7 +629,7 @@ dependencies = [ [[package]] name = "cranelift-module" version = "0.64.0" -source = "git+https://github.com/bytecodealliance/lucet.git?rev=d4fc14a03bdb99ac83173d27fddf1aca48412a86#d4fc14a03bdb99ac83173d27fddf1aca48412a86" +source = "git+https://github.com/bytecodealliance/lucet.git?rev=d741e2e30df19d1f8abd1a8660219ac494336b76#d741e2e30df19d1f8abd1a8660219ac494336b76" dependencies = [ "anyhow", "cranelift-codegen", @@ -641,7 +641,7 @@ dependencies = [ [[package]] name = "cranelift-native" version = "0.64.0" -source = "git+https://github.com/bytecodealliance/lucet.git?rev=d4fc14a03bdb99ac83173d27fddf1aca48412a86#d4fc14a03bdb99ac83173d27fddf1aca48412a86" +source = "git+https://github.com/bytecodealliance/lucet.git?rev=d741e2e30df19d1f8abd1a8660219ac494336b76#d741e2e30df19d1f8abd1a8660219ac494336b76" dependencies = [ "cranelift-codegen", "raw-cpuid 7.0.3", @@ -651,7 +651,7 @@ dependencies = [ [[package]] name = "cranelift-object" version = "0.64.0" -source = "git+https://github.com/bytecodealliance/lucet.git?rev=d4fc14a03bdb99ac83173d27fddf1aca48412a86#d4fc14a03bdb99ac83173d27fddf1aca48412a86" +source = "git+https://github.com/bytecodealliance/lucet.git?rev=d741e2e30df19d1f8abd1a8660219ac494336b76#d741e2e30df19d1f8abd1a8660219ac494336b76" dependencies = [ "cranelift-codegen", "cranelift-module", @@ -662,7 +662,7 @@ dependencies = [ [[package]] name = "cranelift-wasm" version = "0.64.0" -source = "git+https://github.com/bytecodealliance/lucet.git?rev=d4fc14a03bdb99ac83173d27fddf1aca48412a86#d4fc14a03bdb99ac83173d27fddf1aca48412a86" +source = "git+https://github.com/bytecodealliance/lucet.git?rev=d741e2e30df19d1f8abd1a8660219ac494336b76#d741e2e30df19d1f8abd1a8660219ac494336b76" dependencies = [ "cranelift-codegen", "cranelift-entity", @@ -1990,12 +1990,12 @@ checksum = "3576a87f2ba00f6f106fdfcd16db1d698d648a26ad8e0573cad8537c3c362d2a" [[package]] name = "leveldb" -version = "0.8.4" -source = "git+https://github.com/timberio/leveldb#64265815bcf1b69f30e6cb35bf687fbd6dd64afb" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5a2fa830c44ac4762564389a7efe22688a469c8d7b71dd11da2e35c33ae96c2" dependencies = [ "db-key", - "leveldb-sys 2.0.5", - "leveldb-sys 3.0.0", + "leveldb-sys", "libc", ] @@ -2008,16 +2008,6 @@ dependencies = [ "libc", ] -[[package]] -name = "leveldb-sys" -version = "3.0.0" -source = "git+https://github.com/timberio/leveldb-sys?branch=v3.0.0#bbdd99a6fab0a7444a8c6eb0cc86a1a5a75f7fa1" -dependencies = [ - "cmake", - "libc", - "num_cpus", -] - [[package]] name = "lexical-core" version = "0.4.6" @@ -2162,7 +2152,7 @@ dependencies = [ [[package]] name = "lucet-module" version = "0.7.0-dev" -source = "git+https://github.com/bytecodealliance/lucet.git?rev=d4fc14a03bdb99ac83173d27fddf1aca48412a86#d4fc14a03bdb99ac83173d27fddf1aca48412a86" +source = "git+https://github.com/bytecodealliance/lucet.git?rev=d741e2e30df19d1f8abd1a8660219ac494336b76#d741e2e30df19d1f8abd1a8660219ac494336b76" dependencies = [ "anyhow", "bincode", @@ -2181,7 +2171,7 @@ dependencies = [ [[package]] name = "lucet-runtime" version = "0.7.0-dev" -source = "git+https://github.com/bytecodealliance/lucet.git?rev=d4fc14a03bdb99ac83173d27fddf1aca48412a86#d4fc14a03bdb99ac83173d27fddf1aca48412a86" +source = "git+https://github.com/bytecodealliance/lucet.git?rev=d741e2e30df19d1f8abd1a8660219ac494336b76#d741e2e30df19d1f8abd1a8660219ac494336b76" dependencies = [ "cc", "cfg-if", @@ -2195,7 +2185,7 @@ dependencies = [ [[package]] name = "lucet-runtime-internals" version = "0.7.0-dev" -source = "git+https://github.com/bytecodealliance/lucet.git?rev=d4fc14a03bdb99ac83173d27fddf1aca48412a86#d4fc14a03bdb99ac83173d27fddf1aca48412a86" +source = "git+https://github.com/bytecodealliance/lucet.git?rev=d741e2e30df19d1f8abd1a8660219ac494336b76#d741e2e30df19d1f8abd1a8660219ac494336b76" dependencies = [ "anyhow", "bincode", @@ -2221,7 +2211,7 @@ dependencies = [ [[package]] name = "lucet-runtime-macros" version = "0.7.0-dev" -source = "git+https://github.com/bytecodealliance/lucet.git?rev=d4fc14a03bdb99ac83173d27fddf1aca48412a86#d4fc14a03bdb99ac83173d27fddf1aca48412a86" +source = "git+https://github.com/bytecodealliance/lucet.git?rev=d741e2e30df19d1f8abd1a8660219ac494336b76#d741e2e30df19d1f8abd1a8660219ac494336b76" dependencies = [ "quote 1.0.2", "syn 1.0.14", @@ -2230,7 +2220,7 @@ dependencies = [ [[package]] name = "lucet-validate" version = "0.7.0-dev" -source = "git+https://github.com/bytecodealliance/lucet.git?rev=d4fc14a03bdb99ac83173d27fddf1aca48412a86#d4fc14a03bdb99ac83173d27fddf1aca48412a86" +source = "git+https://github.com/bytecodealliance/lucet.git?rev=d741e2e30df19d1f8abd1a8660219ac494336b76#d741e2e30df19d1f8abd1a8660219ac494336b76" dependencies = [ "clap", "cranelift-entity", @@ -2242,7 +2232,7 @@ dependencies = [ [[package]] name = "lucet-wasi" version = "0.7.0-dev" -source = "git+https://github.com/bytecodealliance/lucet.git?rev=d4fc14a03bdb99ac83173d27fddf1aca48412a86#d4fc14a03bdb99ac83173d27fddf1aca48412a86" +source = "git+https://github.com/bytecodealliance/lucet.git?rev=d741e2e30df19d1f8abd1a8660219ac494336b76#d741e2e30df19d1f8abd1a8660219ac494336b76" dependencies = [ "anyhow", "cast", @@ -2262,7 +2252,7 @@ dependencies = [ [[package]] name = "lucet-wasi-generate" version = "0.7.0-dev" -source = "git+https://github.com/bytecodealliance/lucet.git?rev=d4fc14a03bdb99ac83173d27fddf1aca48412a86#d4fc14a03bdb99ac83173d27fddf1aca48412a86" +source = "git+https://github.com/bytecodealliance/lucet.git?rev=d741e2e30df19d1f8abd1a8660219ac494336b76#d741e2e30df19d1f8abd1a8660219ac494336b76" dependencies = [ "lucet-wiggle", "proc-macro2 1.0.8", @@ -2275,7 +2265,7 @@ dependencies = [ [[package]] name = "lucet-wiggle" version = "0.7.0-dev" -source = "git+https://github.com/bytecodealliance/lucet.git?rev=d4fc14a03bdb99ac83173d27fddf1aca48412a86#d4fc14a03bdb99ac83173d27fddf1aca48412a86" +source = "git+https://github.com/bytecodealliance/lucet.git?rev=d741e2e30df19d1f8abd1a8660219ac494336b76#d741e2e30df19d1f8abd1a8660219ac494336b76" dependencies = [ "lucet-runtime", "lucet-wiggle-generate", @@ -2286,7 +2276,7 @@ dependencies = [ [[package]] name = "lucet-wiggle-generate" version = "0.7.0-dev" -source = "git+https://github.com/bytecodealliance/lucet.git?rev=d4fc14a03bdb99ac83173d27fddf1aca48412a86#d4fc14a03bdb99ac83173d27fddf1aca48412a86" +source = "git+https://github.com/bytecodealliance/lucet.git?rev=d741e2e30df19d1f8abd1a8660219ac494336b76#d741e2e30df19d1f8abd1a8660219ac494336b76" dependencies = [ "heck", "lucet-module", @@ -2300,7 +2290,7 @@ dependencies = [ [[package]] name = "lucet-wiggle-macro" version = "0.7.0-dev" -source = "git+https://github.com/bytecodealliance/lucet.git?rev=d4fc14a03bdb99ac83173d27fddf1aca48412a86#d4fc14a03bdb99ac83173d27fddf1aca48412a86" +source = "git+https://github.com/bytecodealliance/lucet.git?rev=d741e2e30df19d1f8abd1a8660219ac494336b76#d741e2e30df19d1f8abd1a8660219ac494336b76" dependencies = [ "lucet-wiggle-generate", "quote 1.0.2", @@ -2312,7 +2302,7 @@ dependencies = [ [[package]] name = "lucetc" version = "0.7.0-dev" -source = "git+https://github.com/bytecodealliance/lucet.git?rev=d4fc14a03bdb99ac83173d27fddf1aca48412a86#d4fc14a03bdb99ac83173d27fddf1aca48412a86" +source = "git+https://github.com/bytecodealliance/lucet.git?rev=d741e2e30df19d1f8abd1a8660219ac494336b76#d741e2e30df19d1f8abd1a8660219ac494336b76" dependencies = [ "anyhow", "bimap", @@ -3745,7 +3735,7 @@ dependencies = [ [[package]] name = "rlua" version = "0.17.1-alpha.0" -source = "git+https://github.com/kyren/rlua#25bd7e6bffef9597466a98bfca80a3056c9e6320" +source = "git+https://github.com/kyren/rlua?rev=25bd7e6bffef9597466a98bfca80a3056c9e6320#25bd7e6bffef9597466a98bfca80a3056c9e6320" dependencies = [ "bitflags", "bstr", @@ -5155,7 +5145,7 @@ dependencies = [ [[package]] name = "tower" version = "0.3.1" -source = "git+https://github.com/tower-rs/tower#c87fdd9c1e4c0728fdaa87d3fafe3e48da9b498a" +source = "git+https://github.com/tower-rs/tower?rev=c87fdd9c1e4c0728fdaa87d3fafe3e48da9b498a#c87fdd9c1e4c0728fdaa87d3fafe3e48da9b498a" dependencies = [ "futures-core", "futures-util", @@ -6000,7 +5990,7 @@ dependencies = [ [[package]] name = "wasi-common" version = "0.17.0" -source = "git+https://github.com/bytecodealliance/lucet.git?rev=d4fc14a03bdb99ac83173d27fddf1aca48412a86#d4fc14a03bdb99ac83173d27fddf1aca48412a86" +source = "git+https://github.com/bytecodealliance/lucet.git?rev=d741e2e30df19d1f8abd1a8660219ac494336b76#d741e2e30df19d1f8abd1a8660219ac494336b76" dependencies = [ "anyhow", "cfg-if", @@ -6170,7 +6160,7 @@ checksum = "effc0e4ff8085673ea7b9b2e3c73f6bd4d118810c9009ed8f1e16bd96c331db6" [[package]] name = "wig" version = "0.17.0" -source = "git+https://github.com/bytecodealliance/lucet.git?rev=d4fc14a03bdb99ac83173d27fddf1aca48412a86#d4fc14a03bdb99ac83173d27fddf1aca48412a86" +source = "git+https://github.com/bytecodealliance/lucet.git?rev=d741e2e30df19d1f8abd1a8660219ac494336b76#d741e2e30df19d1f8abd1a8660219ac494336b76" dependencies = [ "heck", "proc-macro2 1.0.8", @@ -6181,7 +6171,7 @@ dependencies = [ [[package]] name = "wiggle" version = "0.17.0" -source = "git+https://github.com/bytecodealliance/lucet.git?rev=d4fc14a03bdb99ac83173d27fddf1aca48412a86#d4fc14a03bdb99ac83173d27fddf1aca48412a86" +source = "git+https://github.com/bytecodealliance/lucet.git?rev=d741e2e30df19d1f8abd1a8660219ac494336b76#d741e2e30df19d1f8abd1a8660219ac494336b76" dependencies = [ "thiserror", "tracing", @@ -6192,7 +6182,7 @@ dependencies = [ [[package]] name = "wiggle-generate" version = "0.17.0" -source = "git+https://github.com/bytecodealliance/lucet.git?rev=d4fc14a03bdb99ac83173d27fddf1aca48412a86#d4fc14a03bdb99ac83173d27fddf1aca48412a86" +source = "git+https://github.com/bytecodealliance/lucet.git?rev=d741e2e30df19d1f8abd1a8660219ac494336b76#d741e2e30df19d1f8abd1a8660219ac494336b76" dependencies = [ "anyhow", "heck", @@ -6205,7 +6195,7 @@ dependencies = [ [[package]] name = "wiggle-macro" version = "0.17.0" -source = "git+https://github.com/bytecodealliance/lucet.git?rev=d4fc14a03bdb99ac83173d27fddf1aca48412a86#d4fc14a03bdb99ac83173d27fddf1aca48412a86" +source = "git+https://github.com/bytecodealliance/lucet.git?rev=d741e2e30df19d1f8abd1a8660219ac494336b76#d741e2e30df19d1f8abd1a8660219ac494336b76" dependencies = [ "quote 1.0.2", "syn 1.0.14", @@ -6286,7 +6276,7 @@ dependencies = [ [[package]] name = "winx" version = "0.17.0" -source = "git+https://github.com/bytecodealliance/lucet.git?rev=d4fc14a03bdb99ac83173d27fddf1aca48412a86#d4fc14a03bdb99ac83173d27fddf1aca48412a86" +source = "git+https://github.com/bytecodealliance/lucet.git?rev=d741e2e30df19d1f8abd1a8660219ac494336b76#d741e2e30df19d1f8abd1a8660219ac494336b76" dependencies = [ "bitflags", "cvt", @@ -6296,7 +6286,7 @@ dependencies = [ [[package]] name = "witx" version = "0.8.5" -source = "git+https://github.com/bytecodealliance/lucet.git?rev=d4fc14a03bdb99ac83173d27fddf1aca48412a86#d4fc14a03bdb99ac83173d27fddf1aca48412a86" +source = "git+https://github.com/bytecodealliance/lucet.git?rev=d741e2e30df19d1f8abd1a8660219ac494336b76#d741e2e30df19d1f8abd1a8660219ac494336b76" dependencies = [ "anyhow", "log", @@ -6341,7 +6331,7 @@ dependencies = [ [[package]] name = "yanix" version = "0.17.0" -source = "git+https://github.com/bytecodealliance/lucet.git?rev=d4fc14a03bdb99ac83173d27fddf1aca48412a86#d4fc14a03bdb99ac83173d27fddf1aca48412a86" +source = "git+https://github.com/bytecodealliance/lucet.git?rev=d741e2e30df19d1f8abd1a8660219ac494336b76#d741e2e30df19d1f8abd1a8660219ac494336b76" dependencies = [ "bitflags", "cfg-if", diff --git a/Cargo.toml b/Cargo.toml index af1791a0381cc..7faff81253da6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -78,7 +78,7 @@ rusoto_signature = { package = "rusoto_signature", version = "0.44.0", optional # Tower tower = "0.1.1" -tower03 = { package = "tower", version = "0.3", git = "https://github.com/tower-rs/tower", features = ["limit", "retry", "timeout", "util"] } +tower03 = { package = "tower", version = "0.3", git = "https://github.com/tower-rs/tower", features = ["limit", "retry", "timeout", "util"], rev = "c87fdd9c1e4c0728fdaa87d3fafe3e48da9b498a" } # Serde serde = { version = "1.0.80", features = ["derive"] } @@ -119,7 +119,7 @@ syslog = "5" syslog_loose = { version = "0.3.0", optional = true } tokio-uds = { version = "0.2.5", optional = true } derive_is_enum_variant = "0.1.1" -leveldb = { git = "https://github.com/timberio/leveldb", optional = true, default-features = false } +leveldb = { version = "0.8", optional = true, default-features = false } db-key = "0.0.5" headers = "0.2.1" headers03 = { package = "headers", version = "0.3" } @@ -128,7 +128,7 @@ hostname = "0.1.5" seahash = { version = "3.0.6", optional = true } jemallocator = { version = "0.3.0", optional = true } lazy_static = "1.3.0" -rlua = { git = "https://github.com/kyren/rlua", optional = true } +rlua = { git = "https://github.com/kyren/rlua", optional = true, rev = "25bd7e6bffef9597466a98bfca80a3056c9e6320" } num_cpus = "1.10.0" bytesize = { version = "1.0.0", optional = true } glob = "0.2.11" @@ -158,9 +158,9 @@ pulsar = { version = "0.3.0", optional = true } task-compat = "0.1" # For WASM vector-wasm = { path = "lib/vector-wasm", optional = true } -lucetc = { git = "https://github.com/bytecodealliance/lucet.git", rev = "d4fc14a03bdb99ac83173d27fddf1aca48412a86", optional = true } -lucet-runtime = { git = "https://github.com/bytecodealliance/lucet.git", rev = "d4fc14a03bdb99ac83173d27fddf1aca48412a86", optional = true } -lucet-wasi = { git = "https://github.com/bytecodealliance/lucet.git", rev = "d4fc14a03bdb99ac83173d27fddf1aca48412a86", optional = true } +lucetc = { git = "https://github.com/bytecodealliance/lucet.git", rev = "d741e2e30df19d1f8abd1a8660219ac494336b76", optional = true } +lucet-runtime = { git = "https://github.com/bytecodealliance/lucet.git", rev = "d741e2e30df19d1f8abd1a8660219ac494336b76", optional = true } +lucet-wasi = { git = "https://github.com/bytecodealliance/lucet.git", rev = "d741e2e30df19d1f8abd1a8660219ac494336b76", optional = true } anyhow = { version = "1.0.28", optional = true } @@ -202,12 +202,11 @@ assert_cmd = "1.0" [features] # Default features for *-unknown-linux-gnu and *-apple-darwin -default = ["sources", "transforms", "sinks", "vendored", "unix", "leveldb-plain", "rdkafka-plain"] +default = ["sources", "transforms", "sinks", "vendored", "unix", "leveldb", "rdkafka-plain"] # Default features for *-unknown-linux-* which make use of `cmake` for dependencies -default-cmake = ["sources", "transforms", "sinks", "vendored", "unix", "leveldb-cmake", "rdkafka-cmake"] +default-cmake = ["sources", "transforms", "sinks", "vendored", "unix", "rdkafka-cmake"] # Default features for *-pc-windows-msvc -default-msvc = ["sources", "transforms", "sinks", "vendored", "leveldb-cmake", "rdkafka-cmake"] -default-nix = ["sources", "transforms", "sinks", "vendored", "unix", "leveldb-plain", "rdkafka", "rdkafka/dynamic_linking"] +default-msvc = ["sources", "transforms", "sinks", "vendored", "rdkafka-cmake"] # Enables features that work only on systems providing `cfg(unix) unix = ["jemallocator", "shiplift/unix-socket"] @@ -219,10 +218,6 @@ rdkafka-plain = ["rdkafka"] # This feature is more portable, but requires `cmake` as build dependency. Use it if `rdkafka-plain` doesn't work. # The `sasl` feature has to be added because of the limitations of `librdkafka` build scripts for `cmake`. rdkafka-cmake = ["rdkafka", "rdkafka/cmake-build"] -# This feature is less portable, but doesn't require `cmake` as build dependency -leveldb-plain = ["leveldb", "leveldb/leveldb-sys-2"] -# This feature is more portable, but requires `cmake` as build dependency. Use it if `leveldb-plain` doesn't work. -leveldb-cmake = ["leveldb", "leveldb/leveldb-sys-3"] # This feature enables the WASM foreign module support. wasm = ["lucetc", "lucet-runtime", "lucet-wasi", "vector-wasm", "anyhow"] wasm-timings = ["wasm"] diff --git a/Makefile b/Makefile index 89d7f0e78856d..18a70e59d90c7 100644 --- a/Makefile +++ b/Makefile @@ -431,25 +431,24 @@ package-rpm-aarch64: package-archive-aarch64-unknown-linux-musl ## Build the aar .PHONY: neu-release-binary neu-release-binary: DRY_RUN ?= false -neu-release-binary: +neu-release-binary: RUST_TARGET ?= ${RUST_TARGET} +neu-release-binary: target/releases/binaries/${RUST_TARGET} + +target/releases/binaries/%: BUILD_TYPE ?= "debug" +target/releases/binaries/%: nix build \ $(if $(findstring true,$(VERBOSE)),--verbose --show-trace --print-build-logs,) \ $(if $(findstring true,$(DRY_RUN)),--dry-run,) \ + --argstr buildType $(BUILD_TYPE) \ --file default.nix \ - --out-link target/releases/binary/$(RUST_TARGET) \ - binaries.$(RUST_TARGET) - -.PHONY: neu-release-binary-native -neu-release-binary-native: override CROSS_SYSTEM ?= "builtins.currentSystem" -neu-release-binary-native: neu-release-binary + --out-link $@ \ + releases.binaries.$(notdir $@) -.PHONY: neu-release-binary-x86_64-unknown-linux-gn -neu-release-binary-x86_64-unknown-linux-gnu: RUST_TARGET = x86_64-unknown-linux-gnu -neu-release-binary-x86_64-unknown-linux-gnu: neu-release-binary +.PHONY: neu-release-binary-x86_64-unknown-linux-gnu +neu-release-binary-x86_64-unknown-linux-gnu: target/releases/binaries/x86_64-unknown-linux-gnu .PHONY: neu-release-binary-x86_64-unknown-linux-musl -neu-release-binary-x86_64-unknown-linux-musl: RUST_TARGET = x86_64-unknown-linux-musl -neu-release-binary-x86_64-unknown-linux-musl: neu-release-binary +neu-release-binary-x86_64-unknown-linux-musl: target/releases/binaries/x86_64-unknown-linux-musl release: release-prepare generate release-commit ## Release a new Vector version diff --git a/default.nix b/default.nix index c0a03dd451b46..69e5bd4746e7d 100644 --- a/default.nix +++ b/default.nix @@ -1,87 +1,140 @@ rec { - binaries = rec { - native = binary { - linking = "dynamic"; - buildType = "debug"; - rustTarget = "x86_64-unknown-linux-gnu"; - logLevel = "debug"; - runCheckPhase = false; + # Output Artifacts + releases = rec { + binaries = rec { + x86_64-unknown-linux-gnu = tasks.binary targets.x86_64-unknown-linux-gnu; + x86_64-unknown-linux-musl = tasks.binary targets.x86_64-unknown-linux-musl; }; - x86_64-unknown-linux-gnu = binary { + }; + + ### Development code. + + cargoToml = (builtins.fromTOML (builtins.readFile ./Cargo.toml)); + + overlays = rec { + mozilla = (import (builtins.fetchTarball https://github.com/mozilla/nixpkgs-mozilla/archive/master.tar.gz)); + }; + + pkgs = import { + overlays = [ + overlays.mozilla + ]; + }; + + # Handy feature aliases for use in `targets` + features = { + components = rec { + sources = cargoToml.features.sources; + sinks = cargoToml.features.sinks; + transforms = cargoToml.features.transforms; + all = sources ++ sinks ++ transforms; + }; + byLinking = { + static = ["rdkafka"]; + dynamic = ["rdkafka" "rdkafka/dynamic_linking"]; + }; + byOs = { + linux = { + # Linux is *special* and has two of differing characteristics. + gnu = [ "unix" ]; + musl = [ ]; + }; + mac = ["unix"]; + windows = []; + freebsd = []; + }; + }; + + # Available compile targets for Vector, leading to their config input for `binary` + targets = rec { + # See `rustup target list` + x86_64-unknown-linux-gnu = { linking = "dynamic"; buildType = "debug"; rustTarget = "x86_64-unknown-linux-gnu"; - crossSystem = (import ).lib.systems.examples.gnu64; + pkgs = pkgs; + cross = if pkgs.targetPlatform.config == pkgs.pkgsCross.gnu64.targetPlatform.config then + null + else + pkgs.pkgsCross.gnu64; logLevel = "debug"; runCheckPhase = false; + features = features.components.all ++ + features.byOs.linux.gnu ++ + features.byLinking.dynamic; }; - x86_64-unknown-linux-musl = binary { - linking = "static"; + x86_64-unknown-linux-musl = { + linking = "dynamic"; buildType = "debug"; rustTarget = "x86_64-unknown-linux-musl"; - crossSystem = (import ).lib.systems.examples.musl64; + pkgs = pkgs; + cross = if pkgs.targetPlatform.config == pkgs.pkgsCross.musl64.targetPlatform.config then + pkgs + else if pkgs.targetPlatform.config == pkgs.pkgsCross.gnu64.targetPlatform.config then + pkgs + else + pkgs.pkgsCross.musl64; logLevel = "debug"; runCheckPhase = false; + features = features.components.all ++ + features.byOs.linux.musl; }; }; + + # Jobs used to build artifacts + tasks = rec { + # Build a binary Vector artifact + binary = args@{ + # This will be set dynamically! + features ? null, + linking ? "dynamic", + rustChannel ? null, # Defaulted below + rustTarget ? null, + pkgs ? pkgs, + cross ? null, + buildType ? "debug", + logLevel ? "debug", + runCheckPhase ? true, + }: + let - binary = args@{ - features ? null, - linking ? "dynamic", - rustChannel ? null, # Defaulted below. - rustTarget ? "x86_64-unknown-linux-gnu", - crossSystem ? builtins.currentSystem, - buildType ? "debug", - logLevel ? "debug", - runCheckPhase ? true, - }: - let - pkgs = import { - overlays = [ - (import (builtins.fetchTarball https://github.com/mozilla/nixpkgs-mozilla/archive/master.tar.gz)) - ]; - } // - (if args ? crossSystem then { - crossSystem = { - config = crossSystem; - }; - } else {}); - - definition = import ./scripts/environment/definition.nix (args // pkgs); - features = builtins.getAttr args.rustTarget definition.features.presets; - - packageDefinition = rec { - # See `definition.nix` for details on these. - pname = definition.cargoToml.package.name; - version = definition.cargoToml.package.version; - nativeBuildInputs = definition.nativeBuildInputs; - buildInputs = definition.buildInputs; - passthru = definition.environmentVariables; - # Configurables - buildType = args.buildType; - logLevel = args.logLevel; + definition = import ./scripts/environment/definition.nix args; + features = (builtins.getAttr args.rustTarget targets).features; - target = args.rustTarget; - # Rest - src = ./.; - cargoSha256 = "062bq8jzgxp822870zgaiqg3i7i2vi0nfggl8nrhpbphfbqn21a5"; - verifyCargoDeps = true; - cargoBuildFlags = [ "--no-default-features" "--features" "${pkgs.lib.concatStringsSep "," features}" ]; - checkPhase = if runCheckPhase then - '' - export TZDIR=${pkgs.tzdata}/share/zoneinfo - cargo test --no-default-features --features ${pkgs.lib.concatStringsSep "," features} -- --test-threads 1 - '' - else - ""; - meta = with pkgs.stdenv.lib; { - description = "A high-performance logs, metrics, and events router"; - homepage = "https://github.com/timberio/vector"; - license = pkgs.lib.licenses.asl20; - maintainers = []; - platforms = platforms.all; - }; - } // definition.environmentVariables; - in - pkgs.rustPlatform.buildRustPackage packageDefinition; + packageDefinition = rec { + pname = cargoToml.package.name; + version = cargoToml.package.version; + # See `definition.nix` for details on these. + nativeBuildInputs = definition.nativeBuildInputs; + buildInputs = definition.buildInputs; + passthru = definition.environmentVariables; + # Configurables + buildType = args.buildType; + logLevel = args.logLevel; + + target = args.rustTarget; + # Rest + root = ./.; + cargoBuildOptions = currentOptions: currentOptions ++ [ "--no-default-features" "--features" "${pkgs.lib.concatStringsSep "," features}" ]; + cargoTestOptions = currentOptions: currentOptions ++ [ "--no-default-features" "--features" "${pkgs.lib.concatStringsSep "," features}" ]; + cargoTestCommands = currentOptions: if runCheckPhase then + currentOptions + else + []; + meta = with pkgs.stdenv.lib; { + description = "A high-performance logs, metrics, and events router"; + homepage = "https://github.com/timberio/vector"; + license = pkgs.lib.licenses.asl20; + maintainers = []; + platforms = platforms.all; + }; + } // definition.environmentVariables; + in + (tools.naersk.buildPackage packageDefinition); + #pkgs.rustPlatform.buildRustPackage packageDefinition; + }; + + tools = { + naersk = pkgs.callPackage (builtins.fetchTarball https://github.com/nmattia/naersk/archive/master.tar.gz) {}; + }; } \ No newline at end of file diff --git a/scripts/environment/definition.nix b/scripts/environment/definition.nix index 7c48665e33ef6..c58c95a852903 100644 --- a/scripts/environment/definition.nix +++ b/scripts/environment/definition.nix @@ -1,60 +1,16 @@ args@{ - rustTarget ? "stable", + rustTarget ? null, linking ? "dynamic", - crossSystem ? builtins.currentSystem, - pkgs ? null, + cross ? null, + pkgs ? (import { + overlays = [ + (import (builtins.fetchTarball https://github.com/mozilla/nixpkgs-mozilla/archive/master.tar.gz)) + ]; + }), ... }: rec { - pkgs = import { - overlays = [ - (import (builtins.fetchTarball https://github.com/mozilla/nixpkgs-mozilla/archive/master.tar.gz)) - ]; - } // - (if args ? crossSystem then { - crossSystem = { - config = crossSystem; - }; - } else {}) // - (if args ? linking && args.linking == "static" then { - static = builtins.trace "Enabling static build..." true; - } else {}); - - # Our Cargo.toml as nix! - cargoToml = (builtins.fromTOML (builtins.readFile ../../Cargo.toml)); - - features = rec { - derived = { - components = rec { - sources = cargoToml.features.sources; - sinks = cargoToml.features.sinks; - transforms = cargoToml.features.transforms; - all = sources ++ sinks ++ transforms; - }; - }; - byLinking = { - static = []; - dynamic = ["rdkafka" "rdkafka/dynamic_linking"]; - }; - byOs = { - linux = ["unix"]; - mac = ["unix"]; - windows = []; - }; - presets = { - x86_64-unknown-linux-gnu = - features.derived.components.all ++ - features.byOs.linux ++ - (builtins.getAttr args.linking features.byLinking); - x86_64-unknown-linux-musl = - features.derived.components.all ++ - features.byOs.linux ++ - (builtins.getAttr args.linking features.byLinking); - }; - }; - - environmentVariables = { # We must set some protoc related env vars for the prost crate. PROTOC = "${pkgs.protobuf}/bin/protoc"; @@ -117,7 +73,13 @@ rec { docker-compose # Wasm llvmPackages.libclang - ] ++ nativeBuildInputs ++ buildInputs; + ] ++ (if stdenv.isDarwin then [ + # Mac only + ] else [ + # Linux + podman + podman-compose + ]) ++ nativeBuildInputs ++ buildInputs; # From: https://nixos.org/nixpkgs/manual/ # @@ -133,39 +95,36 @@ rec { # Since these packages are able to be run at build-time, they are added to the PATH, as described # above. But since these packages are only guaranteed to be able to run then, they shouldn't # persist as run-time dependencies. This isn't currently enforced, but could be in the future. - nativeBuildInputs = with pkgs; [ + nativeBuildInputs = with (if args ? cross && args.cross != null then cross else pkgs); [ pkg-config protobuf openssl - perl - cmake rdkafka - snappy - gnumake - autoconf - git - (if args ? rustTarget then - pkgs.latest.rustChannels.stable.rust.override { - targets = [ - args.rustTarget - ]; - } - else - pkgs.latest.rustChannels.stable.rust - ) + jemalloc + gcc + # Note the `pkgs.` here always brings us to the **host** Rust, since it's a cross compiler. + (pkgs.latest.rustChannels.stable.rust.override { + targets = (if args ? rustTarget && args.rustTarget != null then + builtins.trace args.rustTarget + [ args.rustTarget ] + else + [ ]); + extensions = [ + "rust-std" + ]; + targetExtensions = [ + "rust-std" + ]; + }) ] ++ (if stdenv.isDarwin then [ darwin.cf-private darwin.apple_sdk.frameworks.CoreServices darwin.apple_sdk.frameworks.Security darwin.apple_sdk.frameworks.SecurityFoundation ] else [ - # Build - gcc # Testing systemd # Container tools - podman - podman-compose linuxHeaders ]); # ++ (if pkgs.glibcLocales != null then [ @@ -185,10 +144,14 @@ rec { # run-time, but the derivation containing the library is only needed at build-time. Even in the # dynamic case, the library may also be needed at build-time to appease the linker. buildInputs = with pkgs; [ + pkg-config rdkafka protobuf snappy leveldb - ]; - + snappy + ] ++ (if stdenv.isDarwin then [ + ] else [ + linuxHeaders + ]); }