7 stdenv.mkDerivation rec {
9 version = "2021-03-27";
11 src = fetchFromGitHub {
14 rev = "b5e62895c619d4ffc75c9d822c8d85f1ece77e5b";
15 hash = "sha256-VMaxVVQuJ3DAwYrC14uJqlRBg0//ugYvtyhOXsTUbCA=";
18 postPatch = lib.optionalString stdenv.isDarwin ''
19 substituteInPlace Makefile --replace "CONFIG_LTO=y" ""
22 makeFlags = [ "prefix=${placeholder "out"}" ];
23 enableParallelBuilding = true;
36 install -Dt $out/share/doc *texi *info)
39 doInstallCheck = true;
40 installCheckPhase = ''
43 # Programs exit with code 1 when testing help, so grep for a string
45 qjs --help 2>&1 | grep "QuickJS version"
46 qjscalc --help 2>&1 | grep "QuickJS version"
50 echo "console.log('Output from compiled program');" > "$temp"
52 out=$(mktemp) && qjsc -o "$out" "$temp" && "$out" | grep -q "Output from compiled program"
53 out=$(mktemp) && qjsc -flto -o "$out" "$temp" && "$out" | grep -q "Output from compiled program"
57 description = "A small and embeddable Javascript engine";
58 homepage = "https://bellard.org/quickjs/";
59 maintainers = with maintainers; [ stesie AndersonTorres ];
60 platforms = platforms.unix;
61 license = licenses.mit;