31 lines
538 B
Nix
31 lines
538 B
Nix
{ stdenv, clang, pkgsCross }:
|
|
|
|
stdenv.mkDerivation {
|
|
name = "triangle";
|
|
src = ./.;
|
|
|
|
nativeBuildInputs = [ clang ];
|
|
|
|
|
|
configurePhase = "";
|
|
buildPhase = ''
|
|
clang \
|
|
--target=wasm32-unknown-wasi \
|
|
--sysroot ${pkgsCross.wasi32.wasilibc} \
|
|
-O3 \
|
|
-flto \
|
|
-nostdlib \
|
|
-Wl,--no-entry \
|
|
-Wl,--export-all \
|
|
-Wl,--lto-O3 \
|
|
-o triangle.wasm \
|
|
triangle.c
|
|
'';
|
|
|
|
checkPhase = "";
|
|
installPhase = ''
|
|
mkdir -p $out
|
|
ls -al
|
|
mv triangle.js triangle.wasm $out
|
|
'';
|
|
}
|