about summary refs log tree commit diff
path: root/pkgs/development/compilers/ecl
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/compilers/ecl')
-rw-r--r--pkgs/development/compilers/ecl/16.1.2.nix44
-rw-r--r--pkgs/development/compilers/ecl/default.nix25
2 files changed, 43 insertions, 26 deletions
diff --git a/pkgs/development/compilers/ecl/16.1.2.nix b/pkgs/development/compilers/ecl/16.1.2.nix
index 0789addb337b..2742c2b8c07e 100644
--- a/pkgs/development/compilers/ecl/16.1.2.nix
+++ b/pkgs/development/compilers/ecl/16.1.2.nix
@@ -7,15 +7,13 @@
 , useBoehmgc ? true, boehmgc
 }:
 
-assert useBoehmgc -> boehmgc != null;
-
 let
   s = # Generated upstream information
   rec {
     baseName="ecl";
     version="16.1.2";
     name="${baseName}-${version}";
-    url="https://common-lisp.net/project/ecl/static/files/release/ecl-16.1.2.tgz";
+    url="https://common-lisp.net/project/ecl/static/files/release/ecl-${version}.tgz";
     sha256="16ab8qs3awvdxy8xs8jy82v8r04x4wr70l9l2j45vgag18d2nj1d";
   };
   buildInputs = [
@@ -38,12 +36,11 @@ stdenv.mkDerivation {
 
   configureFlags = [
     (if threadSupport then "--enable-threads" else "--disable-threads")
-    "--with-gmp-prefix=${gmp.dev}"
-    "--with-libffi-prefix=${libffi.dev}"
-    ]
-    ++
-    (lib.optional (! noUnicode)
-      "--enable-unicode")
+    "--with-gmp-incdir=${lib.getDev gmp}/include"
+    "--with-gmp-libdir=${lib.getLib gmp}/lib"
+    # -incdir, -libdir doesn't seem to be supported for libffi
+    "--with-libffi-prefix=${lib.getDev libffi}"
+    ] ++ lib.optional (! noUnicode) "--enable-unicode"
     ;
 
   patches = [
@@ -69,16 +66,31 @@ stdenv.mkDerivation {
   postInstall = ''
     sed -e 's/@[-a-zA-Z_]*@//g' -i $out/bin/ecl-config
     wrapProgram "$out/bin/ecl" \
-      --prefix PATH ':' "${gcc}/bin" \
-      --prefix NIX_LDFLAGS ' ' "-L${gmp.lib or gmp.out or gmp}/lib" \
-      --prefix NIX_LDFLAGS ' ' "-L${libffi.lib or libffi.out or libffi}/lib"
+      --prefix PATH ':' "${
+        lib.makeBinPath [
+          gcc                   # for the C compiler
+          gcc.bintools.bintools # for ar
+        ]
+      }" \
+  ''
+  # ecl 16.1.2 is too old to have -libdir for libffi and boehmgc, so we need to
+  # use NIX_LDFLAGS_BEFORE to make gcc find these particular libraries.
+  # Since it is missing even the prefix flag for boehmgc we also need to inject
+  # the correct -I flag via NIX_CFLAGS_COMPILE. Since we have access to it, we
+  # create the variables with suffixSalt (which seems to be necessary for
+  # NIX_CFLAGS_COMPILE even).
+  + lib.optionalString useBoehmgc ''
+      --prefix NIX_CFLAGS_COMPILE_${gcc.suffixSalt} ' ' "-I${lib.getDev boehmgc}/include" \
+      --prefix NIX_LDFLAGS_BEFORE_${gcc.bintools.suffixSalt} ' ' "-L${lib.getLib boehmgc}/lib" \
+  '' + ''
+      --prefix NIX_LDFLAGS_BEFORE_${gcc.bintools.suffixSalt} ' ' "-L${lib.getLib libffi}/lib"
   '';
 
-  meta = {
+  meta = with lib; {
     inherit (s) version;
     description = "Lisp implementation aiming to be small, fast and easy to embed";
-    license = lib.licenses.mit ;
-    maintainers = [lib.maintainers.raskin];
-    platforms = lib.platforms.unix;
+    license = licenses.mit ;
+    maintainers = [ maintainers.raskin ];
+    platforms = platforms.unix;
   };
 }
diff --git a/pkgs/development/compilers/ecl/default.nix b/pkgs/development/compilers/ecl/default.nix
index 269beef9e7a2..44f7eab62ee5 100644
--- a/pkgs/development/compilers/ecl/default.nix
+++ b/pkgs/development/compilers/ecl/default.nix
@@ -45,20 +45,25 @@ stdenv.mkDerivation {
 
   configureFlags = [
     (if threadSupport then "--enable-threads" else "--disable-threads")
-    "--with-gmp-prefix=${lib.getDev gmp}"
-    "--with-libffi-prefix=${lib.getDev libffi}"
-  ] ++ lib.optional useBoehmgc "--with-libgc-prefix=${lib.getDev boehmgc}"
-  ++ lib.optional (!noUnicode) "--enable-unicode";
+    "--with-gmp-incdir=${lib.getDev gmp}/include"
+    "--with-gmp-libdir=${lib.getLib gmp}/lib"
+    "--with-libffi-incdir=${lib.getDev libffi}/include"
+    "--with-libffi-libdir=${lib.getLib libffi}/lib"
+  ] ++ lib.optionals useBoehmgc [
+    "--with-libgc-incdir=${lib.getDev boehmgc}/include"
+    "--with-libgc-libdir=${lib.getLib boehmgc}/lib"
+  ] ++ lib.optional (!noUnicode) "--enable-unicode";
 
   hardeningDisable = [ "format" ];
 
-  postInstall = let
-    ldArgs = lib.strings.concatMapStringsSep " "
-      (l: ''--prefix NIX_LDFLAGS ' ' "-L${l.lib or l.out or l}/lib"'')
-      ([ gmp libffi ] ++ lib.optional useBoehmgc boehmgc);
-  in ''
+  postInstall = ''
     sed -e 's/@[-a-zA-Z_]*@//g' -i $out/bin/ecl-config
-    wrapProgram "$out/bin/ecl" --prefix PATH ':' "${gcc}/bin" ${ldArgs}
+    wrapProgram "$out/bin/ecl" --prefix PATH ':' "${
+      lib.makeBinPath [
+        gcc                   # for the C compiler
+        gcc.bintools.bintools # for ar
+      ]
+    }"
   '';
 
   meta = with lib; {