2022-03-30 09:31:56 +00:00
|
|
|
{ stdenv, buildPackages, fetchFromGitHub, lib }:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation {
|
2021-05-28 09:39:13 +00:00
|
|
|
pname = "wasilibc";
|
2022-04-27 09:35:20 +00:00
|
|
|
version = "unstable-2022-04-12";
|
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-04-27 09:35:20 +00:00
|
|
|
rev = "a279514a6ef30cd8ee1469345b33172fcbc8d52d";
|
|
|
|
sha256 = "0a9ldas8p7jg7jlkhb9wdiw141z7vfz6p18mnmxnnnna7bp1y3fz";
|
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-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
|
|
|
'';
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
meta = with lib; {
|
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;
|
|
|
|
maintainers = with maintainers; [ matthewbauer ];
|
2020-07-18 16:06:22 +00:00
|
|
|
license = with licenses; [ asl20 mit llvm-exception ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|