Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at 23.05 64 lines 1.6 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 postPatch = lib.optionalString stdenv.isDarwin '' 19 substituteInPlace Makefile --replace "CONFIG_LTO=y" "" 20 ''; 21 22 makeFlags = [ "prefix=${placeholder "out"}" ]; 23 enableParallelBuilding = true; 24 25 nativeBuildInputs = [ 26 texinfo 27 ]; 28 29 postBuild = '' 30 (cd doc 31 makeinfo *texi) 32 ''; 33 34 postInstall = '' 35 (cd doc 36 install -Dt $out/share/doc *texi *info) 37 ''; 38 39 doInstallCheck = true; 40 installCheckPhase = '' 41 PATH="$out/bin:$PATH" 42 43 # Programs exit with code 1 when testing help, so grep for a string 44 set +o pipefail 45 qjs --help 2>&1 | grep "QuickJS version" 46 qjscalc --help 2>&1 | grep "QuickJS version" 47 set -o pipefail 48 49 temp=$(mktemp).js 50 echo "console.log('Output from compiled program');" > "$temp" 51 set -o verbose 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" 54 ''; 55 56 meta = with lib; { 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; 62 mainProgram = "qjs"; 63 }; 64}