2022-12-17 10:02:37 +00:00
|
|
|
{ stdenv
|
|
|
|
, buildPackages
|
|
|
|
, fetchFromGitHub
|
|
|
|
, lib
|
|
|
|
, firefox-unwrapped
|
|
|
|
, firefox-esr-unwrapped
|
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-12-17 10:02:37 +00:00
|
|
|
let
|
2021-05-28 09:39:13 +00:00
|
|
|
pname = "wasilibc";
|
2023-02-16 17:41:37 +00:00
|
|
|
version = "19";
|
2022-12-17 10:02:37 +00:00
|
|
|
in
|
|
|
|
stdenv.mkDerivation {
|
|
|
|
inherit pname version;
|
2022-03-30 09:31:56 +00:00
|
|
|
|
|
|
|
src = buildPackages.fetchFromGitHub {
|
|
|
|
owner = "WebAssembly";
|
2020-04-24 23:36:52 +00:00
|
|
|
repo = "wasi-libc";
|
2022-12-17 10:02:37 +00:00
|
|
|
rev = "refs/tags/wasi-sdk-${version}";
|
2023-02-16 17:41:37 +00:00
|
|
|
hash = "sha256-yQSKoSil/C/1lIHwEO9eQKC/ye3PJIFGYjHyNDn61y4=";
|
2022-03-30 09:31:56 +00:00
|
|
|
fetchSubmodules = true;
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
2022-03-30 09:31:56 +00:00
|
|
|
|
2022-04-27 09:35:20 +00:00
|
|
|
outputs = [ "out" "dev" "share" ];
|
|
|
|
|
2022-03-30 09:31:56 +00:00
|
|
|
# clang-13: error: argument unused during compilation: '-rtlib=compiler-rt' [-Werror,-Wunused-command-line-argument]
|
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace Makefile \
|
|
|
|
--replace "-Werror" ""
|
|
|
|
'';
|
|
|
|
|
|
|
|
preBuild = ''
|
2022-04-27 09:35:20 +00:00
|
|
|
export SYSROOT_LIB=${builtins.placeholder "out"}/lib
|
|
|
|
export SYSROOT_INC=${builtins.placeholder "dev"}/include
|
|
|
|
export SYSROOT_SHARE=${builtins.placeholder "share"}/share
|
|
|
|
mkdir -p "$SYSROOT_LIB" "$SYSROOT_INC" "$SYSROOT_SHARE"
|
|
|
|
makeFlagsArray+=(
|
|
|
|
"SYSROOT_LIB:=$SYSROOT_LIB"
|
|
|
|
"SYSROOT_INC:=$SYSROOT_INC"
|
|
|
|
"SYSROOT_SHARE:=$SYSROOT_SHARE"
|
2022-12-17 10:02:37 +00:00
|
|
|
# https://bugzilla.mozilla.org/show_bug.cgi?id=1773200
|
|
|
|
"BULK_MEMORY_SOURCES:="
|
2022-04-27 09:35:20 +00:00
|
|
|
)
|
2022-12-17 10:02:37 +00:00
|
|
|
|
2022-03-30 09:31:56 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2022-04-27 09:35:20 +00:00
|
|
|
# We just build right into the install paths, per the `preBuild`.
|
|
|
|
dontInstall = true;
|
|
|
|
|
|
|
|
preFixup = ''
|
|
|
|
ln -s $share/share/undefined-symbols.txt $out/lib/wasi.imports
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2022-12-17 10:02:37 +00:00
|
|
|
passthru.tests = {
|
|
|
|
inherit firefox-unwrapped firefox-esr-unwrapped;
|
|
|
|
};
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
meta = with lib; {
|
2022-12-17 10:02:37 +00:00
|
|
|
changelog = "https://github.com/WebAssembly/wasi-sdk/releases/tag/wasi-sdk-${version}";
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "WASI libc implementation for WebAssembly";
|
2022-03-30 09:31:56 +00:00
|
|
|
homepage = "https://wasi.dev";
|
|
|
|
platforms = platforms.wasi;
|
2022-12-17 10:02:37 +00:00
|
|
|
maintainers = with maintainers; [ matthewbauer rvolosatovs ];
|
2023-03-04 12:14:45 +00:00
|
|
|
license = with licenses; [ asl20-llvm mit ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|