From a31471876d9e80709759d01d929f0d2f105b7b7c Mon Sep 17 00:00:00 2001 From: Tomas Hlavaty Date: Sat, 28 Mar 2015 01:57:00 +0100 Subject: [PATCH] ensure that gmp and libffi are found when compiling with gcc dynamically --- pkgs/development/compilers/ecl/default.nix | 15 ++++++- .../compilers/ecl/libffi-prefix.patch | 39 +++++++++++++++++++ 2 files changed, 52 insertions(+), 2 deletions(-) create mode 100644 pkgs/development/compilers/ecl/libffi-prefix.patch diff --git a/pkgs/development/compilers/ecl/default.nix b/pkgs/development/compilers/ecl/default.nix index be65061c544c..bb57ebbfa875 100644 --- a/pkgs/development/compilers/ecl/default.nix +++ b/pkgs/development/compilers/ecl/default.nix @@ -1,4 +1,5 @@ {stdenv, fetchurl +, libtool, autoconf, automake , gmp, mpfr, libffi , noUnicode ? false, }: @@ -13,10 +14,10 @@ let sha256="13wlxkd5prm93gcm2dhm7v52fl803yx93aa97lrb39z0y6xzziid"; }; buildInputs = [ - libffi + libtool autoconf automake ]; propagatedBuildInputs = [ - gmp mpfr + libffi gmp mpfr ]; in stdenv.mkDerivation { @@ -25,8 +26,18 @@ stdenv.mkDerivation { src = fetchurl { inherit (s) url sha256; }; + patches = [ ./libffi-prefix.patch ]; + preConfigure = '' + (cd src ; libtoolize -f) + (cd src ; autoheader -f) + (cd src ; aclocal) + (cd src ; automake --add-missing -c) + (cd src ; autoconf -f) + ''; configureFlags = [ "--enable-threads" + "--with-gmp-prefix=${gmp}" + "--with-libffi-prefix=${libffi}" ] ++ (stdenv.lib.optional (! noUnicode) diff --git a/pkgs/development/compilers/ecl/libffi-prefix.patch b/pkgs/development/compilers/ecl/libffi-prefix.patch new file mode 100644 index 000000000000..d02cc214f31f --- /dev/null +++ b/pkgs/development/compilers/ecl/libffi-prefix.patch @@ -0,0 +1,39 @@ +diff --git a/src/configure.in b/src/configure.in +index 434da49..642c66c 100644 +--- ecl-15.3.7.orig/src/configure.ac ++++ ecl-15.3.7/src/configure.ac +@@ -191,6 +191,11 @@ AC_ARG_WITH(dffi, + [(system|included|auto|no, default=AUTO if libffi available)]), + [enable_libffi=${withval}], [enable_libffi=auto]) + ++AC_ARG_WITH(libffi-prefix, ++ AS_HELP_STRING( [--with-libffi-prefix=path], ++ [prefix for system LIBFFI includes and libraries] ), ++ [LIBFFI_INCDIR="$withval/include"; LIBFFI_LIBDIR="$withval/lib"], []) ++ + AC_ARG_WITH(fpe, + AS_HELP_STRING( [--with-fpe], + [detect floating point exceptions] +@@ -368,6 +373,22 @@ else + INFOEXT=info + fi + ++dnl libffi ++ ++if test "x$LIBFFI_INCDIR" != "x"; then ++ LIBFFI_CPPFLAGS="-I$LIBFFI_INCDIR" ++fi ++if test "x$LIBFFI_LIBDIR" != "x"; then ++ LIBFFI_LDFLAGS="-L$LIBFFI_LIBDIR" ++ if test "$enable_rpath" = "yes"; then ++ if (echo "$ECL_LDRPATH" | grep '~A') > /dev/null; then ++ LIBFFI_LDFLAGS=`echo $ECL_LDRPATH | sed "s,~A,$LIBFFI_LIBDIR,"`" $LIBFFI_LDFLAGS" ++ fi ++ fi ++fi ++CPPFLAGS="$CPPFLAGS $LIBFFI_CPPFLAGS" ++LDFLAGS="$LDFLAGS $LIBFFI_LDFLAGS" ++ + dnl ====================================================================== + dnl GNU multiprecision library + dnl