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