From efd652965bbdbeca619210236eabe3b004c3f315 Mon Sep 17 00:00:00 2001 From: Asko Soukka Date: Fri, 26 Jun 2015 12:29:44 +0300 Subject: [PATCH] darwin: gfortran: add needed inputs and other fixes Close #10532. --- .../compilers/gcc/gfortran-darwin.nix | 27 ++++++++++++++----- .../compilers/gcc/gfortran-darwin.patch | 26 ++++++++++++++++++ pkgs/top-level/all-packages.nix | 4 ++- 3 files changed, 50 insertions(+), 7 deletions(-) create mode 100644 pkgs/development/compilers/gcc/gfortran-darwin.patch diff --git a/pkgs/development/compilers/gcc/gfortran-darwin.nix b/pkgs/development/compilers/gcc/gfortran-darwin.nix index bd11b1ebc8e2..ee405c6fb655 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 000000000000..73c5d35153b0 --- /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 38875d6c1187..c978cdcd5d7b 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";