From fd38b5fa49544cbd56444bcd34e4781c71bd2a35 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 20 Aug 2015 11:49:55 +0200 Subject: [PATCH] Revert gcc darwin fixes This reverts commits cb7c053383ff76a454484992b3a6d6a2f1530c15, ebda45e6b9db3225c30a998b2624d90b0c08edb4, 4a495cfbab2b3ab9ae8219ef1812c766bf27b01e because they broke Nixpkgs evaluation. http://hydra.nixos.org/build/24813270 --- .../development/compilers/gcc/4.8/default.nix | 28 ++++++++++------ .../development/compilers/gcc/4.9/default.nix | 28 ++++++++++------ pkgs/development/compilers/gcc/5/default.nix | 33 +++++++++++++------ pkgs/development/compilers/gcc/builder.sh | 7 ++-- pkgs/top-level/all-packages.nix | 6 ---- 5 files changed, 61 insertions(+), 41 deletions(-) diff --git a/pkgs/development/compilers/gcc/4.8/default.nix b/pkgs/development/compilers/gcc/4.8/default.nix index bbf730a26fae..ff1d388b6e23 100644 --- a/pkgs/development/compilers/gcc/4.8/default.nix +++ b/pkgs/development/compilers/gcc/4.8/default.nix @@ -32,7 +32,7 @@ , gnat ? null , libpthread ? null, libpthreadCross ? null # required for GNU/Hurd , stripped ? true -, CF ? null +, gnused ? null }: assert langJava -> zip != null && unzip != null @@ -47,8 +47,8 @@ assert cloog != null -> isl != null; # LTO needs libelf and zlib. assert libelf != null -> zlib != null; -# Make sure we get CoreFoundation -assert stdenv.isDarwin -> CF != null; +# Make sure we get GNU sed. +assert stdenv.isDarwin -> gnused != null; # The go frontend is written in c++ assert langGo -> langCC; @@ -288,6 +288,10 @@ stdenv.mkDerivation ({ ++ (optionals (cross != null) [binutilsCross]) ++ (optionals langAda [gnatboot]) ++ (optionals langVhdl [gnat]) + + # The builder relies on GNU sed (for instance, Darwin's `sed' fails with + # "-i may not be used with stdin"), and `stdenvNative' doesn't provide it. + ++ (optional stdenv.isDarwin gnused) ; NIX_LDFLAGS = stdenv.lib.optionalString stdenv.isSunOS "-lm -ldl"; @@ -298,10 +302,14 @@ stdenv.mkDerivation ({ export CXXFLAGS_FOR_TARGET="-Wl,-rpath,$prefix/lib/amd64 $CXXFLAGS_FOR_TARGET" export CFLAGS_FOR_TARGET="-Wl,-rpath,$prefix/lib/amd64 $CFLAGS_FOR_TARGET" '' + stdenv.lib.optionalString stdenv.isDarwin '' - configureFlagsArray+=( - --with-sysroot="${stdenv.libc}" - --with-native-system-header-dir=/include - ) + if SDKROOT=$(/usr/bin/xcrun --show-sdk-path); then + configureFlagsArray+=(--with-native-system-header-dir=$SDKROOT/usr/include) + makeFlagsArray+=( \ + CFLAGS_FOR_BUILD=-F$SDKROOT/System/Library/Frameworks \ + CFLAGS_FOR_TARGET=-F$SDKROOT/System/Library/Frameworks \ + FLAGS_FOR_TARGET=-F$SDKROOT/System/Library/Frameworks \ + ) + fi ''; dontDisableStatic = true; @@ -470,10 +478,10 @@ stdenv.mkDerivation ({ ++ optionals javaAwtGtk [ gmp mpfr ] ++ optional (libpthread != null) libpthread))); - extraFlags = - (if cross != null && libcCross != null + EXTRA_TARGET_CFLAGS = + if cross != null && libcCross != null then "-idirafter ${libcCross}/include" - else "") + optionalString stdenv.isDarwin " -F${CF}/Library/Frameworks"; + else null; EXTRA_TARGET_LDFLAGS = if cross != null && libcCross != null diff --git a/pkgs/development/compilers/gcc/4.9/default.nix b/pkgs/development/compilers/gcc/4.9/default.nix index ed5e9ed920bc..13154ddd27a6 100644 --- a/pkgs/development/compilers/gcc/4.9/default.nix +++ b/pkgs/development/compilers/gcc/4.9/default.nix @@ -32,7 +32,7 @@ , gnat ? null , libpthread ? null, libpthreadCross ? null # required for GNU/Hurd , stripped ? true -, CF ? null +, gnused ? null }: assert langJava -> zip != null && unzip != null @@ -47,8 +47,8 @@ assert cloog != null -> isl != null; # LTO needs libelf and zlib. assert libelf != null -> zlib != null; -# Make sure we get CoreFoundation -assert stdenv.isDarwin -> CF != null; +# Make sure we get GNU sed. +assert stdenv.isDarwin -> gnused != null; # The go frontend is written in c++ assert langGo -> langCC; @@ -287,6 +287,10 @@ stdenv.mkDerivation ({ ++ (optionals (cross != null) [binutilsCross]) ++ (optionals langAda [gnatboot]) ++ (optionals langVhdl [gnat]) + + # The builder relies on GNU sed (for instance, Darwin's `sed' fails with + # "-i may not be used with stdin"), and `stdenvNative' doesn't provide it. + ++ (optional stdenv.isDarwin gnused) ; NIX_LDFLAGS = stdenv.lib.optionalString stdenv.isSunOS "-lm -ldl"; @@ -297,10 +301,14 @@ stdenv.mkDerivation ({ export CXXFLAGS_FOR_TARGET="-Wl,-rpath,$prefix/lib/amd64 $CXXFLAGS_FOR_TARGET" export CFLAGS_FOR_TARGET="-Wl,-rpath,$prefix/lib/amd64 $CFLAGS_FOR_TARGET" '' + stdenv.lib.optionalString stdenv.isDarwin '' - configureFlagsArray+=( - --with-sysroot="${stdenv.libc}" - --with-native-system-header-dir=/include - ) + if SDKROOT=$(/usr/bin/xcrun --show-sdk-path); then + configureFlagsArray+=(--with-native-system-header-dir=$SDKROOT/usr/include) + makeFlagsArray+=( \ + CFLAGS_FOR_BUILD=-F$SDKROOT/System/Library/Frameworks \ + CFLAGS_FOR_TARGET=-F$SDKROOT/System/Library/Frameworks \ + FLAGS_FOR_TARGET=-F$SDKROOT/System/Library/Frameworks \ + ) + fi ''; dontDisableStatic = true; @@ -469,10 +477,10 @@ stdenv.mkDerivation ({ ++ optionals javaAwtGtk [ gmp mpfr ] ++ optional (libpthread != null) libpthread))); - extraFlags = - (if cross != null && libcCross != null + EXTRA_TARGET_CFLAGS = + if cross != null && libcCross != null then "-idirafter ${libcCross}/include" - else "") + optionalString stdenv.isDarwin " -F${CF}/Library/Frameworks"; + else null; EXTRA_TARGET_LDFLAGS = if cross != null && libcCross != null diff --git a/pkgs/development/compilers/gcc/5/default.nix b/pkgs/development/compilers/gcc/5/default.nix index fc007fe447ba..6decc4c8cc3f 100644 --- a/pkgs/development/compilers/gcc/5/default.nix +++ b/pkgs/development/compilers/gcc/5/default.nix @@ -32,7 +32,8 @@ , gnat ? null , libpthread ? null, libpthreadCross ? null # required for GNU/Hurd , stripped ? true -, CF ? null +, gnused ? null +, binutils ? null }: assert langJava -> zip != null && unzip != null @@ -44,8 +45,11 @@ assert langVhdl -> gnat != null; # LTO needs libelf and zlib. assert libelf != null -> zlib != null; -# Make sure we get CoreFoundation. -assert stdenv.isDarwin -> CF != null; +# Make sure we get GNU sed. +assert stdenv.isDarwin -> gnused != null; + +# Need c++filt on darwin +assert stdenv.isDarwin -> binutils != null; # The go frontend is written in c++ assert langGo -> langCC; @@ -282,6 +286,11 @@ stdenv.mkDerivation ({ ++ (optionals (cross != null) [binutilsCross]) ++ (optionals langAda [gnatboot]) ++ (optionals langVhdl [gnat]) + + # The builder relies on GNU sed (for instance, Darwin's `sed' fails with + # "-i may not be used with stdin"), and `stdenvNative' doesn't provide it. + ++ (optional stdenv.isDarwin gnused) + ++ (optional stdenv.isDarwin binutils) ; NIX_LDFLAGS = stdenv.lib.optionalString stdenv.isSunOS "-lm -ldl"; @@ -292,10 +301,14 @@ stdenv.mkDerivation ({ export CXXFLAGS_FOR_TARGET="-Wl,-rpath,$prefix/lib/amd64 $CXXFLAGS_FOR_TARGET" export CFLAGS_FOR_TARGET="-Wl,-rpath,$prefix/lib/amd64 $CFLAGS_FOR_TARGET" '' + stdenv.lib.optionalString stdenv.isDarwin '' - configureFlagsArray+=( - --with-sysroot="${stdenv.libc}" - --with-native-system-header-dir=/include - ) + if SDKROOT=$(/usr/bin/xcrun --show-sdk-path); then + configureFlagsArray+=(--with-native-system-header-dir=$SDKROOT/usr/include) + makeFlagsArray+=( \ + CFLAGS_FOR_BUILD=-F$SDKROOT/System/Library/Frameworks \ + CFLAGS_FOR_TARGET=-F$SDKROOT/System/Library/Frameworks \ + FLAGS_FOR_TARGET=-F$SDKROOT/System/Library/Frameworks \ + ) + fi ''; dontDisableStatic = true; @@ -462,10 +475,10 @@ stdenv.mkDerivation ({ ++ optionals javaAwtGtk [ gmp mpfr ] ++ optional (libpthread != null) libpthread))); - extraFlags = - (if cross != null && libcCross != null + EXTRA_TARGET_CFLAGS = + if cross != null && libcCross != null then "-idirafter ${libcCross}/include" - else "") + optionalString stdenv.isDarwin " -F${CF}/Library/Frameworks"; + else null; EXTRA_TARGET_LDFLAGS = if cross != null && libcCross != null diff --git a/pkgs/development/compilers/gcc/builder.sh b/pkgs/development/compilers/gcc/builder.sh index ee38fadf418b..dd77c67a023e 100644 --- a/pkgs/development/compilers/gcc/builder.sh +++ b/pkgs/development/compilers/gcc/builder.sh @@ -23,11 +23,8 @@ if test "$noSysDirs" = "1"; then # Figure out what extra flags to pass to the gcc compilers # being generated to make sure that they use our glibc. - extraFlags="$(cat $NIX_CC/nix-support/libc-cflags) ${extraFlags}" - extraLDFlags="$(cat $NIX_CC/nix-support/libc-ldflags)" - if [ -e "$NIX_CC/nix-support/libc-ldflags-before" ]; then - extraLDFlags+=" $(cat $NIX_CC/nix-support/libc-ldflags-before)" - fi + extraFlags="$(cat $NIX_CC/nix-support/libc-cflags)" + extraLDFlags="$(cat $NIX_CC/nix-support/libc-ldflags) $(cat $NIX_CC/nix-support/libc-ldflags-before)" # Use *real* header files, otherwise a limits.h is generated # that does not include Glibc's limits.h (notably missing diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 4f4987c9ccb9..3a7db14da460 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -3866,8 +3866,6 @@ let libcCross = if crossSystem != null then libcCross else null; isl = isl_0_14; - - inherit (darwin) CF; })); gcc49 = lowPrio (wrapCC (callPackage ../development/compilers/gcc/4.9 { @@ -3885,8 +3883,6 @@ let isl = isl_0_11; cloog = cloog_0_18_0; - - inherit (darwin) CF; })); gcc5 = lowPrio (wrapCC (callPackage ../development/compilers/gcc/5 { @@ -3902,8 +3898,6 @@ let libcCross = if crossSystem != null then libcCross else null; isl = isl_0_14; - - inherit (darwin) CF; })); gfortran = if !stdenv.isDarwin then gfortran49