@@ -1,94 +0,0 @@
1−{ lib, stdenv, fetchFromGitHub, fetchurl, python2, makeWrapper, pkg-config, gcc,
2− pypy, libffi, libedit, libuv, boost, zlib,
3− variant ? "jit", buildWithPypy ? false }:
4−
5−let
6− commit-count = "1364";
7− common-flags = "--thread --gcrootfinder=shadowstack --continuation";
8− variants = {
9− jit = { flags = "--opt=jit"; target = "target.py"; };
10− jit-preload = { flags = "--opt=jit"; target = "target_preload.py"; };
11− no-jit = { flags = ""; target = "target.py"; };
12− no-jit-preload = { flags = ""; target = "target_preload.py"; };
13− };
14− pixie-src = fetchFromGitHub {
15− owner = "pixie-lang";
16− repo = "pixie";
17− rev = "5eb0ccbe8b0087d3a5f2d0bbbc6998d624d3cd62";
18− sha256 = "sha256-dQ8ncH0IqU42WYxwBgjH6QQfvMIo7RZpv81UAUsPw10=";
19− };
20− pypy-tag = "91db1a9";
21− pypy-src = fetchurl {
22− name = "pypy-src-${pypy-tag}";
23− url = "https://bitbucket.org/pypy/pypy/get/${pypy-tag}.tar.bz2";
24− sha256 = "0ylbqvhbcp5m09l15i2q2h3a0vjd055x2r37cq71lkhgmmaxrwbq";
25− };
26− libs = [ libffi libedit libuv boost.dev boost.out zlib ];
27− include-path = lib.concatStringsSep ":"
28− (map (p: "${p}/include") libs);
29− library-path = lib.concatStringsSep ":"
30− (map (p: "${p}/lib") libs);
31− bin-path = lib.concatStringsSep ":"
32− (map (p: "${p}/bin") [ gcc ]);
33− build = {flags, target}: stdenv.mkDerivation rec {
34− pname = "pixie";
35− version = "0-r${commit-count}-${variant}";
36− nativeBuildInputs = [ makeWrapper pkg-config ];
37− buildInputs = libs;
38− PYTHON = if buildWithPypy
39− then "${pypy}/pypy-c/pypy-c"
40− else python2.interpreter;
41− unpackPhase = ''
42− cp -R ${pixie-src} pixie-src
43− mkdir pypy-src
44− (cd pypy-src
45− tar --strip-components=1 -xjf ${pypy-src})
46− chmod -R +w pypy-src pixie-src
47− '';
48− patchPhase = ''
49− (cd pixie-src
50− patch -p1 < ${./load_paths.patch}
51− libraryPaths='["${libuv}" "${libedit}" "${libffi.dev}" "${boost.dev}" "${boost.out}" "${zlib.dev}"]'
52− export libraryPaths
53− substituteAllInPlace ./pixie/ffi-infer.pxi)
54− '';
55− buildPhase = ''(
56− PYTHONPATH="`pwd`/pypy-src:$PYTHONPATH";
57− RPYTHON="`pwd`/pypy-src/rpython/bin/rpython";
58− cd pixie-src
59− $PYTHON $RPYTHON ${common-flags} ${target}
60− find pixie -name "*.pxi" -exec ./pixie-vm -c {} \;
61− )'';
62− LD_LIBRARY_PATH = library-path;
63− C_INCLUDE_PATH = include-path;
64− LIBRARY_PATH = library-path;
65− PATH = bin-path;
66− installPhase = ''
67− mkdir -p $out/share $out/bin
68− cp pixie-src/pixie-vm $out/share/pixie-vm
69− cp -R pixie-src/pixie $out/share/pixie
70− makeWrapper $out/share/pixie-vm $out/bin/pixie \
71− --prefix LD_LIBRARY_PATH : ${LD_LIBRARY_PATH} \
72− --prefix C_INCLUDE_PATH : ${C_INCLUDE_PATH} \
73− --prefix LIBRARY_PATH : ${LIBRARY_PATH} \
74− --prefix PATH : ${PATH}
75− '';
76− doCheck = true;
77− checkPhase = ''
78− RES=$(./pixie-src/pixie-vm -e "(print :ok)")
79− if [ "$RES" != ":ok" ]; then
80− echo "ERROR Unexpected output: '$RES'"
81− return 1
82− else
83− echo "$RES"
84− fi
85− '';
86− meta = {
87− description = "A clojure-like lisp, built with the pypy vm toolkit";
88− homepage = "https://github.com/pixie-lang/pixie";
89− license = lib.licenses.lgpl3;
90− platforms = ["x86_64-linux" "i686-linux" "x86_64-darwin"];
91− maintainers = with lib.maintainers; [ bendlas ];
92− };
93− };
94−in build (builtins.getAttr variant variants)