nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchurl,
5 fetchpatch,
6 libtool,
7 autoconf,
8 automake,
9 texinfo,
10 gmp,
11 mpfr,
12 libffi,
13 makeWrapper,
14 noUnicode ? false,
15 gcc,
16 clang,
17 threadSupport ? true,
18 useBoehmgc ? false,
19 boehmgc,
20}:
21
22let
23 cc = if stdenv.cc.isClang then clang else gcc;
24in
25stdenv.mkDerivation rec {
26 pname = "ecl";
27 version = "24.5.10";
28
29 src = fetchurl {
30 url = "https://common-lisp.net/project/ecl/static/files/release/ecl-${version}.tgz";
31 hash = "sha256-5Opluxhh4OSVOGv6i8ZzvQFOltPPnZHpA4+RQ1y+Yis=";
32 };
33
34 nativeBuildInputs = [
35 libtool
36 autoconf
37 automake
38 texinfo
39 makeWrapper
40 ];
41 propagatedBuildInputs = [
42 libffi
43 gmp
44 mpfr
45 cc
46 # replaces ecl's own gc which other packages can depend on, thus propagated
47 ]
48 ++ lib.optionals useBoehmgc [
49 # replaces ecl's own gc which other packages can depend on, thus propagated
50 boehmgc
51 ];
52
53 patches = [
54 # https://gitlab.com/embeddable-common-lisp/ecl/-/merge_requests/1
55 (fetchpatch {
56 url = "https://raw.githubusercontent.com/sagemath/sage/9.2/build/pkgs/ecl/patches/write_error.patch";
57 sha256 = "0hfxacpgn4919hg0mn4wf4m8r7y592r4gw7aqfnva7sckxi6w089";
58 })
59 ]
60 ++ lib.optionals stdenv.cc.isGNU [
61 # Fix gcc15 compat for downstream packages e.g. sage
62 # error: ‘bool’ cannot be defined via ‘typedef’
63 (fetchpatch {
64 url = "https://gitlab.com/embeddable-common-lisp/ecl/-/commit/1aec8f741f69fd736f020b7fe4d3afc33e60ae6a.patch";
65 sha256 = "sha256-/cA6iOOob0ATViQm5EwBbdin5peqRMjLPKa7RjkrJ94=";
66 })
67 # error: too many arguments to function 'fn'; expected 0, have 1
68 (fetchpatch {
69 url = "https://gitlab.com/embeddable-common-lisp/ecl/-/commit/5b4e9c4bbd7cce4a678eecd493e56c495490e8b5.patch";
70 sha256 = "sha256-QHxswFiW2rfDAQ98Sl+VVmyP4M/eIjJWQEcR/B+m398=";
71 })
72 (fetchpatch {
73 url = "https://gitlab.com/embeddable-common-lisp/ecl/-/commit/5ec9e02f6db9694dcdef7574036f1e320d64a8af.patch";
74 sha256 = "sha256-ZRah0IqOt6OQZGqlCq0RKiToyxsRXQEXAiSUGgqZnKU=";
75 })
76 ];
77
78 configureFlags = [
79 (if threadSupport then "--enable-threads" else "--disable-threads")
80 "--with-gmp-incdir=${lib.getDev gmp}/include"
81 "--with-gmp-libdir=${lib.getLib gmp}/lib"
82 "--with-libffi-incdir=${lib.getDev libffi}/include"
83 "--with-libffi-libdir=${lib.getLib libffi}/lib"
84 ]
85 ++ lib.optionals useBoehmgc [
86 "--with-libgc-incdir=${lib.getDev boehmgc}/include"
87 "--with-libgc-libdir=${lib.getLib boehmgc}/lib"
88 ]
89 ++ lib.optional (!noUnicode) "--enable-unicode";
90
91 hardeningDisable = [ "format" ];
92
93 # ECL’s ‘make check’ only works after install, making it a de-facto
94 # installCheck.
95 doInstallCheck = true;
96 installCheckTarget = "check";
97
98 postInstall = ''
99 sed -e 's/@[-a-zA-Z_]*@//g' -i $out/bin/ecl-config
100 wrapProgram "$out/bin/ecl" --prefix PATH ':' "${
101 lib.makeBinPath [
102 cc # for the C compiler
103 cc.bintools.bintools # for ar
104 ]
105 }"
106 '';
107
108 meta = {
109 description = "Lisp implementation aiming to be small, fast and easy to embed";
110 homepage = "https://common-lisp.net/project/ecl/";
111 license = lib.licenses.mit;
112 mainProgram = "ecl";
113 teams = [ lib.teams.lisp ];
114 platforms = lib.platforms.unix;
115 changelog = "https://gitlab.com/embeddable-common-lisp/ecl/-/raw/${version}/CHANGELOG";
116 };
117}