Files
nixpkgs/pkgs/by-name/wa/wasilibc/package.nix
Dark Steveneq 646b892680
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s
push sheeet
2025-10-09 14:15:47 +02:00

78 lines
1.8 KiB
Nix

{
stdenvNoLibc,
fetchFromGitHub,
lib,
firefox-unwrapped,
firefox-esr-unwrapped,
enablePosixThreads ? false,
}:
stdenvNoLibc.mkDerivation (finalAttrs: {
pname = "wasilibc";
version = "27";
src = fetchFromGitHub {
owner = "WebAssembly";
repo = "wasi-libc";
tag = "wasi-sdk-${finalAttrs.version}";
hash = "sha256-RIjph1XdYc1aGywKks5JApcLajbNFEuWm+Wy/GMHddg=";
fetchSubmodules = true;
};
outputs = [
"out"
"dev"
"share"
];
# clang-13: error: argument unused during compilation: '-rtlib=compiler-rt' [-Werror,-Wunused-command-line-argument]
postPatch = ''
substituteInPlace Makefile \
--replace "-Werror" ""
patchShebangs scripts/
'';
preBuild = ''
export SYSROOT_LIB=${placeholder "out"}/lib
export SYSROOT_INC=${placeholder "dev"}/include
export SYSROOT_SHARE=${placeholder "share"}/share
mkdir -p "$SYSROOT_LIB" "$SYSROOT_INC" "$SYSROOT_SHARE"
makeFlagsArray+=(
"SYSROOT_LIB:=$SYSROOT_LIB"
"SYSROOT_INC:=$SYSROOT_INC"
"SYSROOT_SHARE:=$SYSROOT_SHARE"
${lib.strings.optionalString enablePosixThreads "THREAD_MODEL:=posix"}
)
'';
enableParallelBuilding = true;
# 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
'';
passthru.tests = {
inherit firefox-unwrapped firefox-esr-unwrapped;
};
meta = with lib; {
changelog = "https://github.com/WebAssembly/wasi-sdk/releases/tag/wasi-sdk-${finalAttrs.version}";
description = "WASI libc implementation for WebAssembly";
homepage = "https://wasi.dev";
platforms = platforms.wasi;
maintainers = with maintainers; [
matthewbauer
rvolosatovs
wucke13
];
license = with licenses; [
asl20
llvm-exception
mit
];
};
})