Skip to content

Commit

Permalink
feat: remove need for tools/vendor
Browse files Browse the repository at this point in the history
  • Loading branch information
benluelo committed Jan 31, 2024
1 parent 89e31fa commit 623cd81
Show file tree
Hide file tree
Showing 30,569 changed files with 47 additions and 9,534,483 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
3 changes: 1 addition & 2 deletions dictionary.txt
Original file line number Diff line number Diff line change
Expand Up @@ -553,6 +553,7 @@ outdir
outfile
overrrides
oxalica
oxlint
pagefind
paramaters
paramproposal
Expand Down Expand Up @@ -833,10 +834,8 @@ vhosts
viem
virtualisation
vmdebug
voluptas
vuex
wakey
warningbox
wasi
wasmd
wasmer
Expand Down
1 change: 0 additions & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@
./evm/evm.nix
./tools/rust-proto.nix
./tools/wasm-light-client.nix
./tools/vendor.nix
./tools/generate-rust-sol-bindings/generate-rust-sol-bindings.nix
./tools/libwasmvm/libwasmvm.nix
./tools/rust/rust.nix
Expand Down
67 changes: 46 additions & 21 deletions tools/libwasmvm/libwasmvm.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{ ... }: {
perSystem = { pkgs, self', crane, rust, system, ensureAtRepositoryRoot, srcWithVendoredSources, ... }:
perSystem = { pkgs, self', crane, rust, system, ensureAtRepositoryRoot, srcWithVendoredSources, dbg, ... }:
let
throwBadSystem = throw "libwasmvm cannot be built on system `${system}`";

Expand All @@ -12,13 +12,20 @@

rustToolchain = rust.mkNightly { target = CARGO_BUILD_TARGET; };

wasmvm_1_3_0 = pkgs.fetchFromGitHub {
owner = "CosmWasm";
repo = "wasmvm";
rev = "v1.3.0"; # wasmd 0.41.0
hash = "sha256-rsTYvbkYpDkUE4IvILdSL3hXMgAWxz5ltGotJB2t1e4=";
# wasmvm_1_3_0 = builtins.fetchGit {
# owner = "CosmWasm";
# repo = "wasmvm";
# # hash = "sha256-rsTYvbkYpDkUE4IvILdSL3hXMgAWxz5ltGotJB2t1e4=";
# };
wasmvm_1_3_0 = builtins.fetchGit {
name = "wasmvm_1_3_0";
url = "[email protected]:CosmWasm/wasmvm";
# ref = "v1.3.0"; # wasmd 0.41.0
rev = "71a9c0dc0ecf9623148e82facb3564fbbf0a896f"; # wasmd 0.41.0
allRefs = true;
};
wasmvm_1_5_0 = pkgs.fetchFromGitHub {
name = "wasmvm_1_5_0";
owner = "CosmWasm";
repo = "wasmvm";
rev = "v1.5.0";
Expand All @@ -33,42 +40,60 @@
inherit CARGO_BUILD_TARGET;

pname = "libwasmvm";
version = wasmvm.rev;
version = (dbg wasmvm).rev;

# cargoArtifacts = null;

buildInputs = [ rustToolchain ];

src = "${wasmvm}/libwasmvm";

# dummySrc = crane.lib.mkDummySrc "${wasmvm}/libwasmvm";

# cargoVendorDir = crane.lib.vendorMultipleCargoDeps {
# inherit (crane.lib.findCargoFiles wasmvm) cargoConfigs;
# cargoLockList = [
# workspaceCargoLockPath
# ] ++ (lib.optionals (buildStdTarget != null) ([
# ./rust-std-Cargo.lock
# ]));
# };


# cargoLock = "${wasmvm}/libwasmvm/Cargo.lock";
# # cargoVendorDir = vendorDir;
# doCheck = false;
# doInstallCargoArtifacts = false;
# buildPhaseCargoCommand = "";
} // (if pkgs.stdenv.isLinux then {
cargoExtraArgs = "--release --locked --offline --example=wasmvmstatic";
# installPhase = ''
# mkdir -p $out/lib
# mv target/${CARGO_BUILD_TARGET}/release/examples/libwasmvmstatic.a $out/lib/libwasmvm.${builtins.head (pkgs.lib.strings.splitString "-" system)}.a
# '';
cargoExtraArgs = "--locked --offline --example=wasmvmstatic";
installPhase = ''
mkdir -p $out/lib
mv target/${CARGO_BUILD_TARGET}/release/examples/libwasmvmstatic.a $out/lib/libwasmvm.${builtins.head (pkgs.lib.strings.splitString "-" system)}.a
'';
} else if pkgs.stdenv.isDarwin then {
# non-static dylib build on macOS
cargoExtraArgs = "cargo build --release --locked --offline";
# installPhase = ''
# mkdir -p $out/lib
# mv target/${CARGO_BUILD_TARGET}/release/deps/libwasmvm.dylib $out/lib/libwasmvm.dylib
# '';
cargoExtraArgs = "--locked --offline";
installPhase = ''
mkdir -p $out/lib
mv target/${CARGO_BUILD_TARGET}/release/deps/libwasmvm.dylib $out/lib/libwasmvm.dylib
'';
} else throwBadSystem);

craneLib = crane.lib.overrideToolchain (rust.mkNightly { target = CARGO_BUILD_TARGET; });
in
crane.lib.buildPackage (attrs // {
cargoArtifacts = crane.lib.buildDepsOnly attrs;
craneLib.buildPackage (attrs // {
cargoArtifacts = craneLib.buildDepsOnly attrs;
});
in
{
_module.args.libwasmvmCargoToml_1_3_0 = "${wasmvm_1_3_0}/libwasmvm/Cargo.toml";
_module.args.libwasmvmCargoToml_1_5_0 = "${wasmvm_1_5_0}/libwasmvm/Cargo.toml";
# _module.args.libwasmvmCargoToml_1_3_0 = "${wasmvm_1_3_0}/libwasmvm/Cargo.toml";
# _module.args.libwasmvmCargoToml_1_5_0 = "${wasmvm_1_5_0}/libwasmvm/Cargo.toml";

packages.libwasmvm = mkLibwasmvm wasmvm_1_3_0;
packages.libwasmvm_1_5_0 = mkLibwasmvm wasmvm_1_5_0;

packages.test = dbg (pkgs.lib.trivial.importTOML ("${wasmvm_1_3_0}/libwasmvm/Cargo.toml"));

};
}
1 change: 0 additions & 1 deletion tools/vendor/addr2line/.cargo-checksum.json

This file was deleted.

Loading

0 comments on commit 623cd81

Please sign in to comment.