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