Merge pull request #24152 from copumpkin/gcc-simplify

gfortran/gcc: simplify & clean up on Darwin
This commit is contained in:
Daniel Peebles 2017-03-21 09:04:55 -04:00 committed by GitHub
commit 555a37e5bc
4 changed files with 10 additions and 83 deletions

View File

@ -76,7 +76,8 @@ let version = "5.4.0";
++ optional langAda ../gnat-cflags.patch
++ optional langFortran ../gfortran-driving.patch
# This could be applied unconditionally but I don't want to cause a full Linux rebuild.
# This could be applied unconditionally but I don't want to cause a full
# Linux rebuild.
++ optional stdenv.cc.isClang ./libcxx38-and-above.patch;
javaEcj = fetchurl {
@ -234,6 +235,13 @@ stdenv.mkDerivation ({
libc_dev = stdenv.cc.libc_dev;
# This should kill all the stdinc frameworks that gcc and friends like to
# insert into default search paths.
prePatch = if stdenv.isDarwin then ''
substituteInPlace gcc/config/darwin-c.c \
--replace 'if (stdinc)' 'if (0)'
'' else null;
postPatch =
if (stdenv.isGNU
|| (libcCross != null # e.g., building `gcc.crossDrv'

View File

@ -1,52 +0,0 @@
# 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 isl_0_14 cloog zlib ];
src = fetchurl {
url = "mirror://gnu/gcc/gcc-${version}/gcc-${version}.tar.bz2";
sha256 = "1bd5vj4px3s8nlakbgrh38ynxq4s654m6nxz7lrj03mvkkwgvnmp";
};
patches = ./gfortran-darwin.patch;
hardeningDisable = [ "format" ];
configureFlags = ''
--disable-bootstrap
--disable-cloog-version-check
--disable-isl-version-check
--disable-multilib
--enable-checking=release
--enable-languages=fortran
--with-cloog=${cloog}
--with-gmp=${gmp.dev}
--with-isl=${isl_0_14}
--with-mpc=${libmpc}
--with-mpfr=${mpfr.dev}
--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;
meta = with stdenv.lib; {
description = "GNU Fortran compiler, part of the GNU Compiler Collection";
homepage = "https://gcc.gnu.org/fortran/";
license = licenses.gpl3Plus;
platforms = platforms.darwin;
};
}

View File

@ -1,26 +0,0 @@
--- 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;

View File

@ -5058,10 +5058,7 @@ with pkgs;
isl = if !stdenv.isDarwin then isl_0_14 else null;
}));
gfortran = if !stdenv.isDarwin then gfortran5
else callPackage ../development/compilers/gcc/gfortran-darwin.nix {
inherit (darwin) Libsystem;
};
gfortran = gfortran5;
gfortran48 = wrapCC (gcc48.cc.override {
name = "gfortran";