Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
104 changes: 56 additions & 48 deletions pkgs/development/compilers/binaryen/default.nix
Original file line number Diff line number Diff line change
@@ -1,53 +1,61 @@
{ lib, stdenv, cmake, python3, fetchFromGitHub, emscripten,
gtest, lit, nodejs, filecheck
}:

stdenv.mkDerivation rec {
pname = "binaryen";
version = "118";

src = fetchFromGitHub {
let
testsuite = fetchFromGitHub {
owner = "WebAssembly";
repo = "binaryen";
rev = "version_${version}";
hash = "sha256-akMW3S2/qUyLK8F77EtnaXPDXvIMpkGfNB2jOD6hQho=";
};

nativeBuildInputs = [ cmake python3 ];

preConfigure = ''
if [ $doCheck -eq 1 ]; then
sed -i '/googletest/d' third_party/CMakeLists.txt
else
cmakeFlagsArray=($cmakeFlagsArray -DBUILD_TESTS=0)
fi
'';

nativeCheckInputs = [ gtest lit nodejs filecheck ];
checkPhase = ''
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PWD/lib python3 ../check.py $tests
'';

tests = [
"version" "wasm-opt" "wasm-dis"
"crash" "dylink" "ctor-eval"
"wasm-metadce" "wasm-reduce" "spec"
"lld" "wasm2js" "validator"
"example" "unit"
# "binaryenjs" "binaryenjs_wasm" # not building this
"lit" "gtest"
];
doCheck = stdenv.hostPlatform.isLinux;

meta = with lib; {
homepage = "https://github.com/WebAssembly/binaryen";
description = "Compiler infrastructure and toolchain library for WebAssembly, in C++";
platforms = platforms.all;
maintainers = with maintainers; [ asppsa willcohen ];
license = licenses.asl20;
};

passthru.tests = {
inherit emscripten;
repo = "testsuite";
rev = "e05365077e13a1d86ffe77acfb1a835b7aa78422";
hash = "sha256-yvZ5AZTPUA6nsD3xpFC0VLthiu2CxVto66RTXBXXeJM=";
};
}
in
stdenv.mkDerivation rec {
pname = "binaryen";
version = "119";

src = fetchFromGitHub {
owner = "WebAssembly";
repo = "binaryen";
rev = "version_${version}";
hash = "sha256-JYXtN3CW4qm/nnjGRvv3GxQ0x9O9wHtNYQLqHIYTTOA=";
};

nativeBuildInputs = [ cmake python3 ];

preConfigure = ''
if [ $doCheck -eq 1 ]; then
sed -i '/googletest/d' third_party/CMakeLists.txt
rmdir test/spec/testsuite
ln -s ${testsuite} test/spec/testsuite
else
cmakeFlagsArray=($cmakeFlagsArray -DBUILD_TESTS=0)
fi
'';

nativeCheckInputs = [ gtest lit nodejs filecheck ];
checkPhase = ''
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PWD/lib python3 ../check.py $tests
'';

tests = [
"version" "wasm-opt" "wasm-dis"
"crash" "dylink" "ctor-eval"
"wasm-metadce" "wasm-reduce" "spec"
"lld" "wasm2js" "validator"
"example" "unit"
# "binaryenjs" "binaryenjs_wasm" # not building this
"lit" "gtest"
];
doCheck = stdenv.isLinux;

meta = with lib; {
homepage = "https://github.com/WebAssembly/binaryen";
description = "Compiler infrastructure and toolchain library for WebAssembly, in C++";
platforms = platforms.all;
maintainers = with maintainers; [ asppsa willcohen ];
license = licenses.asl20;
};
passthru.tests = {
inherit emscripten;
};
}
9 changes: 6 additions & 3 deletions pkgs/development/compilers/emscripten/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

stdenv.mkDerivation rec {
pname = "emscripten";
version = "3.1.64";
version = "3.1.73";

llvmEnv = symlinkJoin {
name = "emscripten-llvm-${version}";
Expand All @@ -19,7 +19,7 @@ stdenv.mkDerivation rec {
name = "emscripten-node-modules-${version}";
inherit pname version src;

npmDepsHash = "sha256-2dsIuB6P+Z3wflIsn6QaZvjHeHHGzsFAI3GcP3SfiP4=";
npmDepsHash = "sha256-bqxUlxpIH1IAx9RbnaMq4dZW8fy+M/Q02Q7VrW/AKNQ=";

dontBuild = true;

Expand All @@ -32,7 +32,7 @@ stdenv.mkDerivation rec {
src = fetchFromGitHub {
owner = "emscripten-core";
repo = "emscripten";
hash = "sha256-AbO1b4pxZ7I6n1dRzxhLC7DnXIUnaCK9SbLy96Qxqr0=";
hash = "sha256-QlC2k2rhF3/Pz+knnrlBDV8AfHHBSlGr7b9Ae6TNsxY=";
rev = version;
};

Expand All @@ -51,6 +51,9 @@ stdenv.mkDerivation rec {

patchShebangs .

# emscripten 3.1.67 requires LLVM tip-of-tree instead of LLVM 18
sed -i -e "s/EXPECTED_LLVM_VERSION = 20/EXPECTED_LLVM_VERSION = 19/g" tools/shared.py

# fixes cmake support
sed -i -e "s/print \('emcc (Emscript.*\)/sys.stderr.write(\1); sys.stderr.flush()/g" emcc.py

Expand Down