1{stdenv, fetchurl
2, libtool, autoconf, automake
3, gmp, mpfr, libffi, makeWrapper
4, noUnicode ? false
5, gcc
6, threadSupport ? true
7, useBoehmgc ? false, boehmgc
8}:
9let
10 s = # Generated upstream information
11 rec {
12 baseName="ecl";
13 version="16.1.3";
14 name="${baseName}-${version}";
15 hash="0m0j24w5d5a9dwwqyrg0d35c0nys16ijb4r0nyk87yp82v38b9bn";
16 url="https://common-lisp.net/project/ecl/static/files/release/ecl-16.1.3.tgz";
17 sha256="0m0j24w5d5a9dwwqyrg0d35c0nys16ijb4r0nyk87yp82v38b9bn";
18 };
19 buildInputs = [
20 libtool autoconf automake makeWrapper
21 ];
22 propagatedBuildInputs = [
23 libffi gmp mpfr gcc
24 # replaces ecl's own gc which other packages can depend on, thus propagated
25 ] ++ stdenv.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 buildInputs propagatedBuildInputs;
33
34 src = fetchurl {
35 inherit (s) url sha256;
36 };
37
38 configureFlags = [
39 (if threadSupport then "--enable-threads" else "--disable-threads")
40 "--with-gmp-prefix=${gmp.dev}"
41 "--with-libffi-prefix=${libffi.dev}"
42 ]
43 ++
44 (stdenv.lib.optional (! noUnicode)
45 "--enable-unicode")
46 ;
47
48 hardeningDisable = [ "format" ];
49
50 postInstall = ''
51 sed -e 's/@[-a-zA-Z_]*@//g' -i $out/bin/ecl-config
52 wrapProgram "$out/bin/ecl" \
53 --prefix PATH ':' "${gcc}/bin" \
54 --prefix NIX_LDFLAGS ' ' "-L${gmp.lib or gmp.out or gmp}/lib" \
55 --prefix NIX_LDFLAGS ' ' "-L${libffi.lib or libffi.out or libffi}/lib"
56 '';
57
58 meta = {
59 inherit (s) version;
60 description = "Lisp implementation aiming to be small, fast and easy to embed";
61 homepage = https://common-lisp.net/project/ecl/;
62 license = stdenv.lib.licenses.mit ;
63 maintainers = [stdenv.lib.maintainers.raskin];
64 platforms = stdenv.lib.platforms.linux;
65 };
66}