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-03-30 09:31:56 +00:00
|
|
|
version = "unstable-2021-09-23";
|
|
|
|
|
|
|
|
src = buildPackages.fetchFromGitHub {
|
|
|
|
owner = "WebAssembly";
|
2020-04-24 23:36:52 +00:00
|
|
|
repo = "wasi-libc";
|
2022-03-30 09:31:56 +00:00
|
|
|
rev = "ad5133410f66b93a2381db5b542aad5e0964db96";
|
|
|
|
hash = "sha256-RiIClVXrb18jF9qCt+5iALHPCZKYcnad7JsILHBV0pA=";
|
|
|
|
fetchSubmodules = true;
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
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 = ''
|
|
|
|
export NIX_CFLAGS_COMPILE="-I$(pwd)/sysroot/include $NIX_CFLAGS_COMPILE"
|
|
|
|
'';
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
makeFlags = [
|
|
|
|
"WASM_CC=${stdenv.cc.targetPrefix}cc"
|
|
|
|
"WASM_NM=${stdenv.cc.targetPrefix}nm"
|
|
|
|
"WASM_AR=${stdenv.cc.targetPrefix}ar"
|
|
|
|
"INSTALL_DIR=${placeholder "out"}"
|
|
|
|
];
|
|
|
|
|
2022-03-30 09:31:56 +00:00
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
postInstall = ''
|
|
|
|
mv $out/lib/*/* $out/lib
|
|
|
|
ln -s $out/share/wasm32-wasi/undefined-symbols.txt $out/lib/wasi.imports
|
|
|
|
'';
|
|
|
|
|
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
|
|
|
};
|
|
|
|
}
|