Skip to content

Commit

Permalink
build gcc-4.9 on darwin
Browse files Browse the repository at this point in the history
  • Loading branch information
Jude Taylor committed Jul 31, 2015
1 parent 7024b4d commit 4a495cf
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 20 deletions.
29 changes: 11 additions & 18 deletions pkgs/development/compilers/gcc/4.9/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
, gnat ? null
, libpthread ? null, libpthreadCross ? null # required for GNU/Hurd
, stripped ? true
, gnused ? null
, CF ? null
}:

assert langJava -> zip != null && unzip != null
Expand All @@ -47,8 +47,8 @@ assert cloog != null -> isl != null;
# LTO needs libelf and zlib.
assert libelf != null -> zlib != null;

# Make sure we get GNU sed.
assert stdenv.isDarwin -> gnused != null;
# Make sure we get CoreFoundation
assert stdenv.isDarwin -> CF != null;

# The go frontend is written in c++
assert langGo -> langCC;
Expand Down Expand Up @@ -290,10 +290,6 @@ 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";
Expand All @@ -304,14 +300,11 @@ 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 ''
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
configureFlagsArray+=(
--with-sysroot="${stdenv.libc}"

This comment has been minimized.

Copy link
@vcunat

vcunat Aug 16, 2015

Member

This line breaks tarball evaluation (on darwin). Perhaps you meant stdenv.cc.libc?

This comment has been minimized.

Copy link
@edolstra

edolstra Aug 19, 2015

Member

Still broken (http://hydra.nixos.org/build/24813270). I think we should revert this patch.

This comment has been minimized.

Copy link
@wkennington

wkennington Aug 19, 2015

Contributor

If reverting remember this are also applied to 4.8 and 5.0
ebda45e cb7c053

This comment has been minimized.

Copy link
@edolstra

edolstra Aug 20, 2015

Member

Thanks, reverted them all in fd38b5f.

--with-native-system-header-dir=/include
CFLAGS_FOR_BUILD=
)
'';

dontDisableStatic = true;
Expand Down Expand Up @@ -480,10 +473,10 @@ stdenv.mkDerivation ({
++ optionals javaAwtGtk [ gmp mpfr ]
++ optional (libpthread != null) libpthread)));

EXTRA_TARGET_CFLAGS =
if cross != null && libcCross != null
extraFlags =
(if cross != null && libcCross != null
then "-idirafter ${libcCross}/include"
else null;
else "") + optionalString stdenv.isDarwin " -F${CF}/Library/Frameworks";

EXTRA_TARGET_LDFLAGS =
if cross != null && libcCross != null
Expand Down
7 changes: 5 additions & 2 deletions pkgs/development/compilers/gcc/builder.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,11 @@ 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)"
extraLDFlags="$(cat $NIX_CC/nix-support/libc-ldflags) $(cat $NIX_CC/nix-support/libc-ldflags-before)"
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

# Use *real* header files, otherwise a limits.h is generated
# that does not include Glibc's limits.h (notably missing
Expand Down
2 changes: 2 additions & 0 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3849,6 +3849,8 @@ let
isl = isl_0_11;

cloog = cloog_0_18_0;

inherit (darwin) CF;
}));

gcc5 = lowPrio (wrapCC (callPackage ../development/compilers/gcc/5 {
Expand Down

0 comments on commit 4a495cf

Please sign in to comment.