mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-02-23 20:44:12 +00:00

In preparation for the deprecation of `stdenv.isX`. These shorthands are not conducive to cross-compilation because they hide the platforms. Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way One example of why this is bad and especially affects compiler packages https://www.github.com/NixOS/nixpkgs/pull/343059 There are too many files to go through manually but a treewide should get users thinking when they see a `hostPlatform.isX` in a place where it doesn't make sense. ``` fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is" fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is" ```
54 lines
1.3 KiB
Nix
54 lines
1.3 KiB
Nix
{ lib, stdenv, cmake, python3, fetchFromGitHub, emscripten,
|
|
gtest, lit, nodejs, filecheck
|
|
}:
|
|
|
|
stdenv.mkDerivation rec {
|
|
pname = "binaryen";
|
|
version = "118";
|
|
|
|
src = 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;
|
|
};
|
|
}
|