forgejo-lts: 7.0.10 -> 7.0.11
[NixPkgs.git] / pkgs / development / libraries / wasilibc / default.nix
blobc0714a78556a347127372c6d8e2311ef0d66bd3f
1 { stdenv
2 , buildPackages
3 , fetchFromGitHub
4 , lib
5 , firefox-unwrapped
6 , firefox-esr-unwrapped
7 }:
9 let
10   pname = "wasilibc";
11   version = "21";
13 stdenv.mkDerivation {
14   inherit pname version;
16   src = buildPackages.fetchFromGitHub {
17     owner = "WebAssembly";
18     repo = "wasi-libc";
19     rev = "refs/tags/wasi-sdk-${version}";
20     hash = "sha256-1LsMpO29y79twVrUsuM/JvC7hK8O6Yey4Ard/S3Mvvc=";
21     fetchSubmodules = true;
22   };
24   outputs = [ "out" "dev" "share" ];
26   # clang-13: error: argument unused during compilation: '-rtlib=compiler-rt' [-Werror,-Wunused-command-line-argument]
27   postPatch = ''
28     substituteInPlace Makefile \
29       --replace "-Werror" ""
30   '';
32   preBuild = ''
33     export SYSROOT_LIB=${builtins.placeholder "out"}/lib
34     export SYSROOT_INC=${builtins.placeholder "dev"}/include
35     export SYSROOT_SHARE=${builtins.placeholder "share"}/share
36     mkdir -p "$SYSROOT_LIB" "$SYSROOT_INC" "$SYSROOT_SHARE"
37     makeFlagsArray+=(
38       "SYSROOT_LIB:=$SYSROOT_LIB"
39       "SYSROOT_INC:=$SYSROOT_INC"
40       "SYSROOT_SHARE:=$SYSROOT_SHARE"
41       # https://bugzilla.mozilla.org/show_bug.cgi?id=1773200
42       "BULK_MEMORY_SOURCES:="
43     )
45   '';
47   enableParallelBuilding = true;
49   # We just build right into the install paths, per the `preBuild`.
50   dontInstall = true;
52   preFixup = ''
53     ln -s $share/share/undefined-symbols.txt $out/lib/wasi.imports
54   '';
56   passthru.tests = {
57     inherit firefox-unwrapped firefox-esr-unwrapped;
58   };
60   meta = with lib; {
61     changelog = "https://github.com/WebAssembly/wasi-sdk/releases/tag/wasi-sdk-${version}";
62     description = "WASI libc implementation for WebAssembly";
63     homepage = "https://wasi.dev";
64     platforms = platforms.wasi;
65     maintainers = with maintainers; [ matthewbauer rvolosatovs ];
66     license = with licenses; [ asl20-llvm mit ];
67   };