Merge pull request #268619 from tweag/lib-descriptions
[NixPkgs.git] / pkgs / development / compilers / ecl / default.nix
blobbba1b3026362a94d62ae8c8bb15c92a282168eb9
1 { lib
2 , stdenv
3 , fetchurl
4 , fetchpatch
5 , libtool
6 , autoconf
7 , automake
8 , texinfo
9 , gmp
10 , mpfr
11 , libffi
12 , makeWrapper
13 , noUnicode ? false
14 , gcc
15 , threadSupport ? true
16 , useBoehmgc ? false
17 , boehmgc
20 stdenv.mkDerivation rec {
21   pname = "ecl";
22   version = "21.2.1";
24   src = fetchurl {
25     url = "https://common-lisp.net/project/ecl/static/files/release/ecl-${version}.tgz";
26     sha256 = "sha256-sVp13PhLj2LmhyDMqxOT+WEcB4/NOv3WOaEIbK0BCQA=";
27   };
29   nativeBuildInputs = [
30     libtool
31     autoconf
32     automake
33     texinfo
34     makeWrapper
35   ];
36   propagatedBuildInputs = [
37     libffi
38     gmp
39     mpfr
40     gcc
41     # replaces ecl's own gc which other packages can depend on, thus propagated
42   ] ++ lib.optionals useBoehmgc [
43     # replaces ecl's own gc which other packages can depend on, thus propagated
44     boehmgc
45   ];
47   patches = [
48     # https://gitlab.com/embeddable-common-lisp/ecl/-/merge_requests/1
49     (fetchpatch {
50       url = "https://raw.githubusercontent.com/sagemath/sage/9.2/build/pkgs/ecl/patches/write_error.patch";
51       sha256 = "0hfxacpgn4919hg0mn4wf4m8r7y592r4gw7aqfnva7sckxi6w089";
52     })
53   ];
55   configureFlags = [
56     (if threadSupport then "--enable-threads" else "--disable-threads")
57     "--with-gmp-incdir=${lib.getDev gmp}/include"
58     "--with-gmp-libdir=${lib.getLib gmp}/lib"
59     "--with-libffi-incdir=${lib.getDev libffi}/include"
60     "--with-libffi-libdir=${lib.getLib libffi}/lib"
61   ] ++ lib.optionals useBoehmgc [
62     "--with-libgc-incdir=${lib.getDev boehmgc}/include"
63     "--with-libgc-libdir=${lib.getLib boehmgc}/lib"
64   ] ++ lib.optional (!noUnicode) "--enable-unicode";
66   hardeningDisable = [ "format" ];
68   postInstall = ''
69     sed -e 's/@[-a-zA-Z_]*@//g' -i $out/bin/ecl-config
70     wrapProgram "$out/bin/ecl" --prefix PATH ':' "${
71       lib.makeBinPath [
72         gcc                   # for the C compiler
73         gcc.bintools.bintools # for ar
74       ]
75     }"
76   '';
78   meta = with lib; {
79     description = "Lisp implementation aiming to be small, fast and easy to embed";
80     homepage = "https://common-lisp.net/project/ecl/";
81     license = licenses.mit;
82     maintainers = lib.teams.lisp.members;
83     platforms = platforms.unix;
84     changelog = "https://gitlab.com/embeddable-common-lisp/ecl/-/raw/${version}/CHANGELOG";
85   };