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