about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAsko Soukka <asko.soukka@iki.fi>2015-06-26 12:29:44 +0300
committerVladimír Čunát <vcunat@gmail.com>2015-10-28 13:37:02 +0100
commitefd652965bbdbeca619210236eabe3b004c3f315 (patch)
tree21999f9b879093793ef86f0f63baef54afcefb51
parent1e285a7eef633d276465f8508bd6dc9a45785fe8 (diff)
darwin: gfortran: add needed inputs and other fixes
Close #10532.
-rw-r--r--pkgs/development/compilers/gcc/gfortran-darwin.nix27
-rw-r--r--pkgs/development/compilers/gcc/gfortran-darwin.patch26
-rw-r--r--pkgs/top-level/all-packages.nix4
3 files changed, 50 insertions, 7 deletions
diff --git a/pkgs/development/compilers/gcc/gfortran-darwin.nix b/pkgs/development/compilers/gcc/gfortran-darwin.nix
index bd11b1ebc8e26..ee405c6fb6557 100644
--- a/pkgs/development/compilers/gcc/gfortran-darwin.nix
+++ b/pkgs/development/compilers/gcc/gfortran-darwin.nix
@@ -1,20 +1,35 @@
-# This is a derivation specific to OS X (Darwin). It may work on other
-# systems as well but has not been tested.
-{gmp, mpfr, libmpc, fetchurl, stdenv}:
+# This is a derivation specific to OS X (Darwin)
+{gmp, mpfr, libmpc, isl_0_14, cloog, zlib, fetchurl, stdenv
+
+, Libsystem
+}:
 
 stdenv.mkDerivation rec {
   name = "gfortran-${version}";
   version = "5.1.0";
-  buildInputs = [gmp mpfr libmpc];
+  buildInputs = [gmp mpfr libmpc isl_0_14 cloog zlib];
   src = fetchurl {
     url = "mirror://gnu/gcc/gcc-${version}/gcc-${version}.tar.bz2";
     sha256 = "1bd5vj4px3s8nlakbgrh38ynxq4s654m6nxz7lrj03mvkkwgvnmp";
   };
+  patches = ./gfortran-darwin.patch;
   configureFlags = ''
-    --enable-languages=fortran --enable-checking=release --disable-bootstrap
+    --disable-bootstrap
+    --disable-cloog-version-check
+    --disable-isl-version-check
+    --disable-multilib
+    --enable-checking=release
+    --enable-languages=fortran
+    --with-cloog=${cloog}
     --with-gmp=${gmp}
-    --with-mpfr=${mpfr}
+    --with-isl=${isl_0_14}
     --with-mpc=${libmpc}
+    --with-mpfr=${mpfr}
+    --with-native-system-header-dir=${Libsystem}/include
+    --with-system-zlib
+  '';
+  postConfigure = ''
+    export DYLD_LIBRARY_PATH=`pwd`/`uname -m`-apple-darwin`uname -r`/libgcc
   '';
   makeFlags = ["CC=clang"];
   passthru.cc = stdenv.cc.cc;
diff --git a/pkgs/development/compilers/gcc/gfortran-darwin.patch b/pkgs/development/compilers/gcc/gfortran-darwin.patch
new file mode 100644
index 0000000000000..73c5d35153b00
--- /dev/null
+++ b/pkgs/development/compilers/gcc/gfortran-darwin.patch
@@ -0,0 +1,26 @@
+--- a/gcc/config/darwin-c.c	2015-01-09 22:18:42.000000000 +0200
++++ b/gcc/config/darwin-c.c	2015-06-27 04:17:58.000000000 +0300
+@@ -490,8 +490,7 @@
+ 
+ static const char *framework_defaults [] =
+   {
+-    "/System/Library/Frameworks",
+-    "/Library/Frameworks",
++// stdenvDarwinPure
+   };
+ 
+ /* Register the GNU objective-C runtime include path if STDINC.  */
+ 
+ /* Register the GNU objective-C runtime include path if STDINC.  */
+--- a/gcc/cppdefault.c	2015-01-05 14:33:28.000000000 +0200
++++ b/gcc/cppdefault.c	2015-06-27 04:16:15.000000000 +0300
+@@ -35,6 +35,9 @@
+ # undef CROSS_INCLUDE_DIR
+ #endif
+ 
++// stdenvDarwinPure
++# undef LOCAL_INCLUDE_DIR
++
+ const struct default_include cpp_include_defaults[]
+ #ifdef INCLUDE_DEFAULTS
+ = INCLUDE_DEFAULTS;
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 38875d6c1187b..c978cdcd5d7b1 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -3939,7 +3939,9 @@ let
   }));
 
   gfortran = if !stdenv.isDarwin then gfortran49
-             else callPackage ../development/compilers/gcc/gfortran-darwin.nix {};
+             else callPackage ../development/compilers/gcc/gfortran-darwin.nix {
+    inherit (darwin) Libsystem;
+  };
 
   gfortran48 = wrapCC (gcc48.cc.override {
     name = "gfortran";