at 23.05-pre 60 lines 1.5 kB view raw
1{ lib 2, stdenv 3, fetchFromGitHub 4, texinfo 5}: 6 7stdenv.mkDerivation rec { 8 pname = "quickjs"; 9 version = "2021-03-27"; 10 11 src = fetchFromGitHub { 12 owner = "bellard"; 13 repo = pname; 14 rev = "b5e62895c619d4ffc75c9d822c8d85f1ece77e5b"; 15 hash = "sha256-VMaxVVQuJ3DAwYrC14uJqlRBg0//ugYvtyhOXsTUbCA="; 16 }; 17 18 makeFlags = [ "prefix=${placeholder "out"}" ]; 19 enableParallelBuilding = true; 20 21 nativeBuildInputs = [ 22 texinfo 23 ]; 24 25 postBuild = '' 26 (cd doc 27 makeinfo *texi) 28 ''; 29 30 postInstall = '' 31 (cd doc 32 install -Dt $out/share/doc *texi *info) 33 ''; 34 35 doInstallCheck = true; 36 installCheckPhase = '' 37 PATH="$out/bin:$PATH" 38 39 # Programs exit with code 1 when testing help, so grep for a string 40 set +o pipefail 41 qjs --help 2>&1 | grep "QuickJS version" 42 qjscalc --help 2>&1 | grep "QuickJS version" 43 set -o pipefail 44 45 temp=$(mktemp).js 46 echo "console.log('Output from compiled program');" > "$temp" 47 set -o verbose 48 out=$(mktemp) && qjsc "$temp" -o "$out" && "$out" | grep -q "Output from compiled program" 49 out=$(mktemp) && qjsc -flto "$temp" -o "$out" && "$out" | grep -q "Output from compiled program" 50 ''; 51 52 meta = with lib; { 53 description = "A small and embeddable Javascript engine"; 54 homepage = "https://bellard.org/quickjs/"; 55 maintainers = with maintainers; [ stesie AndersonTorres ]; 56 platforms = platforms.linux; 57 license = licenses.mit; 58 mainProgram = "qjs"; 59 }; 60}