lol

envoy: switch default WASM runtime to wasmtime (#435633)

authored by

Luke Granger-Brown and committed by
GitHub
b62edf00 507f4945

+35 -11
+16 -2
pkgs/by-name/en/envoy/bazel_nix.BUILD.bazel
··· 1 load("@bazel_tools//tools/sh:sh_toolchain.bzl", "sh_toolchain") 2 load("@rules_rust//rust:toolchain.bzl", "rust_toolchain") 3 4 toolchains = { 5 "x86_64": "x86_64-unknown-linux-gnu", 6 "aarch64": "aarch64-unknown-linux-gnu", 7 } 8 9 - exports_files(["cargo", "rustdoc", "ruststd", "rustc"]) 10 11 [ 12 rust_toolchain( ··· 16 exec_triple = v, 17 cargo = ":cargo", 18 rust_doc = ":rustdoc", 19 - rust_std = ":ruststd", 20 rustc = ":rustc", 21 stdlib_linkflags = ["-ldl", "-lpthread"], 22 staticlib_ext = ".a",
··· 1 load("@bazel_tools//tools/sh:sh_toolchain.bzl", "sh_toolchain") 2 load("@rules_rust//rust:toolchain.bzl", "rust_toolchain") 3 + load("@rules_rust//rust:defs.bzl", "rust_stdlib_filegroup") 4 5 toolchains = { 6 "x86_64": "x86_64-unknown-linux-gnu", 7 "aarch64": "aarch64-unknown-linux-gnu", 8 } 9 10 + exports_files(["cargo", "rustdoc", "rustc"]) 11 + 12 + [ 13 + rust_stdlib_filegroup( 14 + name = "rust_nix_" + k + "_stdlib", 15 + srcs = glob( 16 + [ 17 + "rustcroot/lib/rustlib/" + v + "/lib/**", 18 + ], 19 + allow_empty=True, 20 + ), 21 + ) 22 + for k, v in toolchains.items() 23 + ] 24 25 [ 26 rust_toolchain( ··· 30 exec_triple = v, 31 cargo = ":cargo", 32 rust_doc = ":rustdoc", 33 + rust_std = ":rust_nix_" + k + "_stdlib", 34 rustc = ":rustc", 35 stdlib_linkflags = ["-ldl", "-lpthread"], 36 staticlib_ext = ".a",
+19 -9
pkgs/by-name/en/envoy/package.nix
··· 23 gnutar, 24 gnugrep, 25 envoy, 26 27 # v8 (upstream default), wavm, wamr, wasmtime, disabled 28 - wasmRuntime ? "wamr", 29 }: 30 31 let ··· 40 }; 41 42 # these need to be updated for any changes to fetchAttrs 43 - depsHash = 44 - { 45 - x86_64-linux = "sha256-E6yUSd00ngmjaMds+9UVZLtcYhzeS8F9eSIkC1mZSps="; 46 - aarch64-linux = "sha256-ivboOrV/uORKVHRL3685aopcElGvzsxgVcUmYsBwzXY="; 47 - } 48 - .${stdenv.system} or (throw "unsupported system ${stdenv.system}"); 49 50 python3 = python312; 51 ··· 94 ln -sf "${cargo}/bin/cargo" bazel/nix/cargo 95 ln -sf "${rustc}/bin/rustc" bazel/nix/rustc 96 ln -sf "${rustc}/bin/rustdoc" bazel/nix/rustdoc 97 - ln -sf "${rustPlatform.rustLibSrc}" bazel/nix/ruststd 98 substituteInPlace bazel/dependency_imports.bzl \ 99 --replace-fail 'crate_universe_dependencies()' 'crate_universe_dependencies(rust_toolchain_cargo_template="@@//bazel/nix:cargo", rust_toolchain_rustc_template="@@//bazel/nix:rustc")' \ 100 --replace-fail 'crates_repository(' 'crates_repository(rust_toolchain_cargo_template="@@//bazel/nix:cargo", rust_toolchain_rustc_template="@@//bazel/nix:rustc",' ··· 120 ninja 121 patchelf 122 cacert 123 ]; 124 125 buildInputs = [ linuxHeaders ]; 126 127 fetchAttrs = { 128 - sha256 = depsHash; 129 env.CARGO_BAZEL_REPIN = true; 130 dontUseCmakeConfigure = true; 131 dontUseGnConfigure = true; ··· 239 "--linkopt=-Wl,-z,noexecstack" 240 "--config=gcc" 241 "--verbose_failures" 242 243 # Force use of system Java. 244 "--extra_toolchains=@local_jdk//:all"
··· 23 gnutar, 24 gnugrep, 25 envoy, 26 + git, 27 28 # v8 (upstream default), wavm, wamr, wasmtime, disabled 29 + wasmRuntime ? "wasmtime", 30 + 31 + # Allows overriding the deps hash used for building - you will likely need to 32 + # set this if you have changed the 'wasmRuntime' setting. 33 + depsHash ? null, 34 }: 35 36 let ··· 45 }; 46 47 # these need to be updated for any changes to fetchAttrs 48 + depsHash' = 49 + if depsHash != null then 50 + depsHash 51 + else 52 + { 53 + x86_64-linux = "sha256-t4Xv4UGYW5YU0kmv+1rdf2JvM1BYQyNWdtpz6Cdmxm4="; 54 + aarch64-linux = "sha256-aIBnNGzc0hTdlTgRyJ7eLnWvHqZ5ywhqOM+mHfH3/18="; 55 + } 56 + .${stdenv.system} or (throw "unsupported system ${stdenv.system}"); 57 58 python3 = python312; 59 ··· 102 ln -sf "${cargo}/bin/cargo" bazel/nix/cargo 103 ln -sf "${rustc}/bin/rustc" bazel/nix/rustc 104 ln -sf "${rustc}/bin/rustdoc" bazel/nix/rustdoc 105 + ln -sf "${rustc.unwrapped}" bazel/nix/rustcroot 106 substituteInPlace bazel/dependency_imports.bzl \ 107 --replace-fail 'crate_universe_dependencies()' 'crate_universe_dependencies(rust_toolchain_cargo_template="@@//bazel/nix:cargo", rust_toolchain_rustc_template="@@//bazel/nix:rustc")' \ 108 --replace-fail 'crates_repository(' 'crates_repository(rust_toolchain_cargo_template="@@//bazel/nix:cargo", rust_toolchain_rustc_template="@@//bazel/nix:rustc",' ··· 128 ninja 129 patchelf 130 cacert 131 + git 132 ]; 133 134 buildInputs = [ linuxHeaders ]; 135 136 fetchAttrs = { 137 + sha256 = depsHash'; 138 env.CARGO_BAZEL_REPIN = true; 139 dontUseCmakeConfigure = true; 140 dontUseGnConfigure = true; ··· 248 "--linkopt=-Wl,-z,noexecstack" 249 "--config=gcc" 250 "--verbose_failures" 251 + "--incompatible_enable_cc_toolchain_resolution=true" 252 253 # Force use of system Java. 254 "--extra_toolchains=@local_jdk//:all"