nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{ lib, stdenv, fetchurl, validatePkgConfig }:
2
3stdenv.mkDerivation rec {
4 pname = "duktape";
5 version = "2.7.0";
6 src = fetchurl {
7 url = "http://duktape.org/duktape-${version}.tar.xz";
8 sha256 = "sha256-kPjS+otVZ8aJmDDd7ywD88J5YLEayiIvoXqnrGE8KJA=";
9 };
10
11 # https://github.com/svaarala/duktape/issues/2464
12 LDFLAGS = [ "-lm" ];
13
14 nativeBuildInputs = [ validatePkgConfig ];
15
16 buildPhase = ''
17 make -f Makefile.sharedlibrary
18 make -f Makefile.cmdline
19 '';
20
21 installPhase = ''
22 install -d $out/bin
23 install -m755 duk $out/bin/
24 install -d $out/lib/pkgconfig
25 install -d $out/include
26 make -f Makefile.sharedlibrary install INSTALL_PREFIX=$out
27 substituteAll ${./duktape.pc.in} $out/lib/pkgconfig/duktape.pc
28 '';
29
30 enableParallelBuilding = true;
31
32 meta = with lib; {
33 description = "An embeddable Javascript engine, with a focus on portability and compact footprint";
34 homepage = "https://duktape.org/";
35 downloadPage = "https://duktape.org/download.html";
36 license = licenses.mit;
37 maintainers = [ maintainers.fgaz ];
38 mainProgram = "duk";
39 platforms = platforms.all;
40 };
41}