3
0
Fork 0
forked from mirrors/nixpkgs

quickjs: fix build on darwin

This commit is contained in:
Mario Rodas 2023-04-05 04:20:00 +00:00 committed by Anderson Torres
parent ea50b72f4d
commit 429c8adc9b

View file

@ -15,6 +15,10 @@ stdenv.mkDerivation rec {
hash = "sha256-VMaxVVQuJ3DAwYrC14uJqlRBg0//ugYvtyhOXsTUbCA=";
};
postPatch = lib.optionalString stdenv.isDarwin ''
substituteInPlace Makefile --replace "CONFIG_LTO=y" ""
'';
makeFlags = [ "prefix=${placeholder "out"}" ];
enableParallelBuilding = true;
@ -45,15 +49,15 @@ stdenv.mkDerivation rec {
temp=$(mktemp).js
echo "console.log('Output from compiled program');" > "$temp"
set -o verbose
out=$(mktemp) && qjsc "$temp" -o "$out" && "$out" | grep -q "Output from compiled program"
out=$(mktemp) && qjsc -flto "$temp" -o "$out" && "$out" | grep -q "Output from compiled program"
out=$(mktemp) && qjsc -o "$out" "$temp" && "$out" | grep -q "Output from compiled program"
out=$(mktemp) && qjsc -flto -o "$out" "$temp" && "$out" | grep -q "Output from compiled program"
'';
meta = with lib; {
description = "A small and embeddable Javascript engine";
homepage = "https://bellard.org/quickjs/";
maintainers = with maintainers; [ stesie AndersonTorres ];
platforms = platforms.linux;
platforms = platforms.unix;
license = licenses.mit;
mainProgram = "qjs";
};