gcc: Don't use attrByPath

This commit is contained in:
Eelco Dolstra 2014-01-07 10:26:35 +01:00
parent 2a0047bbef
commit bdf34e9059

View File

@ -102,12 +102,12 @@ let version = "4.8.2";
/* Platform flags */ /* Platform flags */
platformFlags = let platformFlags = let
gccArch = stdenv.lib.attrByPath [ "platform" "gcc" "arch" ] null stdenv; gccArch = stdenv.platform.gcc.arch or null;
gccCpu = stdenv.lib.attrByPath [ "platform" "gcc" "cpu" ] null stdenv; gccCpu = stdenv.platform.gcc.cpu or null;
gccAbi = stdenv.lib.attrByPath [ "platform" "gcc" "abi" ] null stdenv; gccAbi = stdenv.platform.gcc.abi or null;
gccFpu = stdenv.lib.attrByPath [ "platform" "gcc" "fpu" ] null stdenv; gccFpu = stdenv.platform.gcc.fpu or null;
gccFloat = stdenv.lib.attrByPath [ "platform" "gcc" "float" ] null stdenv; gccFloat = stdenv.platform.gcc.float or null;
gccMode = stdenv.lib.attrByPath [ "platform" "gcc" "mode" ] null stdenv; gccMode = stdenv.platform.gcc.mode or null;
withArch = if gccArch != null then " --with-arch=${gccArch}" else ""; withArch = if gccArch != null then " --with-arch=${gccArch}" else "";
withCpu = if gccCpu != null then " --with-cpu=${gccCpu}" else ""; withCpu = if gccCpu != null then " --with-cpu=${gccCpu}" else "";
withAbi = if gccAbi != null then " --with-abi=${gccAbi}" else ""; withAbi = if gccAbi != null then " --with-abi=${gccAbi}" else "";
@ -115,22 +115,22 @@ let version = "4.8.2";
withFloat = if gccFloat != null then " --with-float=${gccFloat}" else ""; withFloat = if gccFloat != null then " --with-float=${gccFloat}" else "";
withMode = if gccMode != null then " --with-mode=${gccMode}" else ""; withMode = if gccMode != null then " --with-mode=${gccMode}" else "";
in in
(withArch + withArch +
withCpu + withCpu +
withAbi + withAbi +
withFpu + withFpu +
withFloat + withFloat +
withMode); withMode;
/* Cross-gcc settings */ /* Cross-gcc settings */
crossMingw = (cross != null && cross.libc == "msvcrt"); crossMingw = (cross != null && cross.libc == "msvcrt");
crossConfigureFlags = let crossConfigureFlags = let
gccArch = stdenv.lib.attrByPath [ "gcc" "arch" ] null cross; gccArch = stdenv.cross.gcc.arch or null;
gccCpu = stdenv.lib.attrByPath [ "gcc" "cpu" ] null cross; gccCpu = stdenv.cross.gcc.cpu or null;
gccAbi = stdenv.lib.attrByPath [ "gcc" "abi" ] null cross; gccAbi = stdenv.cross.gcc.abi or null;
gccFpu = stdenv.lib.attrByPath [ "gcc" "fpu" ] null cross; gccFpu = stdenv.cross.gcc.fpu or null;
gccFloat = stdenv.lib.attrByPath [ "gcc" "float" ] null cross; gccFloat = stdenv.cross.gcc.float or null;
gccMode = stdenv.lib.attrByPath [ "gcc" "mode" ] null cross; gccMode = stdenv.cross.gcc.mode or null;
withArch = if gccArch != null then " --with-arch=${gccArch}" else ""; withArch = if gccArch != null then " --with-arch=${gccArch}" else "";
withCpu = if gccCpu != null then " --with-cpu=${gccCpu}" else ""; withCpu = if gccCpu != null then " --with-cpu=${gccCpu}" else "";
withAbi = if gccAbi != null then " --with-abi=${gccAbi}" else ""; withAbi = if gccAbi != null then " --with-abi=${gccAbi}" else "";
@ -193,8 +193,7 @@ let version = "4.8.2";
" --enable-nls" + " --enable-nls" +
" --disable-decimal-float") # No final libdecnumber (it may work only in 386) " --disable-decimal-float") # No final libdecnumber (it may work only in 386)
); );
stageNameAddon = if crossStageStatic then "-stage-static" else stageNameAddon = if crossStageStatic then "-stage-static" else "-stage-final";
"-stage-final";
crossNameAddon = if cross != null then "-${cross.config}" + stageNameAddon else ""; crossNameAddon = if cross != null then "-${cross.config}" + stageNameAddon else "";
bootstrap = cross == null && !stdenv.isArm && !stdenv.isMips; bootstrap = cross == null && !stdenv.isArm && !stdenv.isMips;
@ -379,11 +378,11 @@ stdenv.mkDerivation ({
else "install"; else "install";
crossAttrs = let crossAttrs = let
xgccArch = stdenv.lib.attrByPath [ "gcc" "arch" ] null stdenv.cross; xgccArch = stdenv.cross.gcc.arch or null;
xgccCpu = stdenv.lib.attrByPath [ "gcc" "cpu" ] null stdenv.cross; xgccCpu = stdenv.cross.gcc.cpu or null;
xgccAbi = stdenv.lib.attrByPath [ "gcc" "abi" ] null stdenv.cross; xgccAbi = stdenv.cross.gcc.abi or null;
xgccFpu = stdenv.lib.attrByPath [ "gcc" "fpu" ] null stdenv.cross; xgccFpu = stdenv.cross.gcc.fpu or null;
xgccFloat = stdenv.lib.attrByPath [ "gcc" "float" ] null stdenv.cross; xgccFloat = stdenv.cross.gcc.float or null;
xwithArch = if xgccArch != null then " --with-arch=${xgccArch}" else ""; xwithArch = if xgccArch != null then " --with-arch=${xgccArch}" else "";
xwithCpu = if xgccCpu != null then " --with-cpu=${xgccCpu}" else ""; xwithCpu = if xgccCpu != null then " --with-cpu=${xgccCpu}" else "";
xwithAbi = if xgccAbi != null then " --with-abi=${xgccAbi}" else ""; xwithAbi = if xgccAbi != null then " --with-abi=${xgccAbi}" else "";
@ -443,8 +442,7 @@ stdenv.mkDerivation ({
AR = "ar"; AR = "ar";
LD = "ld"; LD = "ld";
# http://gcc.gnu.org/install/specific.html#x86-64-x-solaris210 # http://gcc.gnu.org/install/specific.html#x86-64-x-solaris210
CC = if stdenv.system == "x86_64-solaris" then "gcc -m64" CC = if stdenv.system == "x86_64-solaris" then "gcc -m64" else "gcc";
else "gcc";
# Setting $CPATH and $LIBRARY_PATH to make sure both `gcc' and `xgcc' find # Setting $CPATH and $LIBRARY_PATH to make sure both `gcc' and `xgcc' find
# the library headers and binaries, regarless of the language being # the library headers and binaries, regarless of the language being
@ -468,8 +466,7 @@ stdenv.mkDerivation ({
# On GNU/Hurd glibc refers to Mach & Hurd # On GNU/Hurd glibc refers to Mach & Hurd
# headers. # headers.
++ optionals (libcCross != null && ++ optionals (libcCross != null && libcCross ? "propagatedBuildInputs" )
hasAttr "propagatedBuildInputs" libcCross)
libcCross.propagatedBuildInputs))); libcCross.propagatedBuildInputs)));
LIBRARY_PATH = concatStrings LIBRARY_PATH = concatStrings
@ -492,8 +489,8 @@ stdenv.mkDerivation ({
" -L${libpthreadCross}/lib -Wl,${libpthreadCross.TARGET_LDFLAGS}") " -L${libpthreadCross}/lib -Wl,${libpthreadCross.TARGET_LDFLAGS}")
else null; else null;
passthru = { inherit langC langCC langAda langFortran langVhdl passthru =
langGo enableMultilib version; }; { inherit langC langCC langAda langFortran langVhdl langGo enableMultilib version; };
inherit enableParallelBuilding; inherit enableParallelBuilding;
@ -526,7 +523,6 @@ stdenv.mkDerivation ({
installTargets = "install-gcc install-target-libgcc"; installTargets = "install-gcc install-target-libgcc";
} }
# Strip kills static libs of other archs (hence cross != null) # Strip kills static libs of other archs (hence cross != null)
// optionalAttrs (!stripped || cross != null) { dontStrip = true; NIX_STRIP_DEBUG = 0; } // optionalAttrs (!stripped || cross != null) { dontStrip = true; NIX_STRIP_DEBUG = 0; }
) )