1{ lib, stdenv, fetchurl, makeWrapper,
2 libllvm, gmp, mpfr, readline, bison, flex }:
3
4stdenv.mkDerivation rec {
5 baseName="pure";
6 version="0.68";
7 name="${baseName}-${version}";
8
9 src = fetchurl {
10 url="https://github.com/agraef/pure-lang/releases/download/${name}/${name}.tar.gz";
11 sha256="0px6x5ivcdbbp2pz5n1r1cwg1syadklhjw8piqhl63n91i4r7iyb";
12 };
13
14 nativeBuildInputs = [ makeWrapper ];
15 buildInputs = [ bison flex ];
16 propagatedBuildInputs = [ libllvm gmp mpfr readline ];
17 NIX_LDFLAGS = "-lLLVMJIT";
18
19 postPatch = ''
20 for f in expr.cc matcher.cc printer.cc symtable.cc parserdefs.hh; do
21 sed -i '1i\#include <stddef.h>' $f
22 done
23 '';
24
25 configureFlags = [ "--enable-release" ];
26 doCheck = true;
27 checkPhase = ''
28 LD_LIBRARY_PATH=$LD_LIBRARY_PATH''${LD_LIBRARY_PATH:+:}${libllvm}/lib make check
29 '';
30 postInstall = ''
31 wrapProgram $out/bin/pure --prefix LD_LIBRARY_PATH : ${libllvm}/lib
32 '';
33
34 meta = {
35 description = "A modern-style functional programming language based on term rewriting";
36 maintainers = with lib.maintainers;
37 [
38 raskin
39 asppsa
40 ];
41 platforms = with lib.platforms;
42 linux;
43 license = lib.licenses.gpl3Plus;
44 broken = true;
45 };
46}