at master 2.2 kB view raw
1{ 2 lib, 3 stdenv, 4 fetchurl, 5 gcc, 6 flex, 7 bison, 8 texinfo, 9 jdk_headless, 10 erlang, 11 makeWrapper, 12 readline, 13}: 14 15stdenv.mkDerivation rec { 16 pname = "mercury"; 17 version = "22.01.8"; 18 19 src = fetchurl { 20 url = "https://dl.mercurylang.org/release/mercury-srcdist-${version}.tar.gz"; 21 sha256 = "sha256-oJfozI7KAVLtlSfByvc+XJyD9q2h0xOiW4D+eQcvutg="; 22 }; 23 24 nativeBuildInputs = [ makeWrapper ]; 25 buildInputs = [ 26 gcc 27 flex 28 bison 29 texinfo 30 jdk_headless 31 erlang 32 readline 33 ]; 34 35 patchPhase = '' 36 # Fix calls to programs in /bin 37 for p in uname pwd ; do 38 for f in $(egrep -lr /bin/$p *) ; do 39 sed -i 's@/bin/'$p'@'$p'@g' $f ; 40 done 41 done 42 ''; 43 44 preConfigure = '' 45 mkdir -p $out/lib/mercury/cgi-bin ; 46 configureFlags="--enable-deep-profiler=$out/lib/mercury/cgi-bin"; 47 ''; 48 49 preBuild = '' 50 # Mercury buildsystem does not take -jN directly. 51 makeFlags="PARALLEL=-j$NIX_BUILD_CORES" ; 52 ''; 53 54 postInstall = '' 55 # Wrap with compilers for the different targets. 56 for e in $(ls $out/bin) ; do 57 wrapProgram $out/bin/$e \ 58 --prefix PATH ":" "${gcc}/bin" \ 59 --prefix PATH ":" "${jdk_headless}/bin" \ 60 --prefix PATH ":" "${erlang}/bin" 61 done 62 ''; 63 64 meta = { 65 description = "Pure logic programming language"; 66 longDescription = '' 67 Mercury is a logic/functional programming language which combines the 68 clarity and expressiveness of declarative programming with advanced 69 static analysis and error detection features. Its highly optimized 70 execution algorithm delivers efficiency far in excess of existing logic 71 programming systems, and close to conventional programming systems. 72 Mercury addresses the problems of large-scale program development, 73 allowing modularity, separate compilation, and numerous optimization/time 74 trade-offs. 75 ''; 76 homepage = "https://mercurylang.org/"; 77 changelog = "https://dl.mercurylang.org/release/release-notes-${version}.html"; 78 license = lib.licenses.gpl2Only; 79 platforms = lib.platforms.all; 80 maintainers = with lib.maintainers; [ vieta ]; 81 }; 82}