gcc*: Replace stdenv.is* with {host,target}Platform.is*

Host everywhere would be guaranteed to preserve the old semantics,
but in a few places it doesn't matter in practice, target is used
instead for clarity.
This commit is contained in:
John Ericson 2017-06-04 23:55:29 -04:00
parent e854685d65
commit 35ed21d096
6 changed files with 57 additions and 57 deletions

View File

@ -138,7 +138,7 @@ stdenv.mkDerivation ({
hardeningDisable = [ "format" ] ++ optional (name != "gnat") "all"; hardeningDisable = [ "format" ] ++ optional (name != "gnat") "all";
outputs = if (stdenv.is64bit && langAda) then [ "out" "doc" ] outputs = if (hostPlatform.is64bit && langAda) then [ "out" "doc" ]
else [ "out" "lib" "doc" ]; else [ "out" "lib" "doc" ];
setOutputFlags = false; setOutputFlags = false;
NIX_NO_SELF_RPATH = true; NIX_NO_SELF_RPATH = true;
@ -266,7 +266,7 @@ stdenv.mkDerivation ({
${ # Trick that should be taken out once we have a mips64el-linux not loongson2f ${ # Trick that should be taken out once we have a mips64el-linux not loongson2f
if targetPlatform == hostPlatform && stdenv.system == "mips64el-linux" then "--with-arch=loongson2f" else ""} if targetPlatform == hostPlatform && stdenv.system == "mips64el-linux" then "--with-arch=loongson2f" else ""}
${if langAda then " --enable-libada" else ""} ${if langAda then " --enable-libada" else ""}
${if targetPlatform == hostPlatform && stdenv.isi686 then "--with-arch=i686" else ""} ${if targetPlatform == hostPlatform && targetPlatform.isi686 then "--with-arch=i686" else ""}
${if targetPlatform != hostPlatform then crossConfigureFlags else ""} ${if targetPlatform != hostPlatform then crossConfigureFlags else ""}
"; ";
@ -311,7 +311,7 @@ stdenv.mkDerivation ({
) )
} }
${if langAda then " --enable-libada" else ""} ${if langAda then " --enable-libada" else ""}
${if targetPlatform == hostPlatform && stdenv.isi686 then "--with-arch=i686" else ""} ${if targetplatform == hostPlatform && targetPlatform.isi686 then "--with-arch=i686" else ""}
${if targetPlatform != hostPlatform then crossConfigureFlags else ""} ${if targetPlatform != hostPlatform then crossConfigureFlags else ""}
--target=${targetPlatform.config} --target=${targetPlatform.config}
''; '';

View File

@ -1,7 +1,7 @@
{ stdenv, fetchurl, noSysDirs { stdenv, fetchurl, noSysDirs
, langC ? true, langCC ? true, langFortran ? false , langC ? true, langCC ? true, langFortran ? false
, langObjC ? stdenv.isDarwin , langObjC ? targetPlatform.isDarwin
, langObjCpp ? stdenv.isDarwin , langObjCpp ? targetPlatform.isDarwin
, langJava ? false , langJava ? false
, langAda ? false , langAda ? false
, langVhdl ? false , langVhdl ? false
@ -48,7 +48,7 @@ assert cloog != null -> isl != null;
assert libelf != null -> zlib != null; assert libelf != null -> zlib != null;
# Make sure we get GNU sed. # Make sure we get GNU sed.
assert stdenv.isDarwin -> gnused != null; assert hostPlatform.isDarwin -> gnused != null;
# The go frontend is written in c++ # The go frontend is written in c++
assert langGo -> langCC; assert langGo -> langCC;
@ -71,7 +71,7 @@ let version = "4.8.5";
# target libraries and tools. # target libraries and tools.
++ optional langAda ../gnat-cflags.patch ++ optional langAda ../gnat-cflags.patch
++ optional langFortran ../gfortran-driving.patch ++ optional langFortran ../gfortran-driving.patch
++ optional stdenv.isDarwin ../gfortran-darwin-NXConstStr.patch; ++ optional hostPlatform.isDarwin ../gfortran-darwin-NXConstStr.patch;
javaEcj = fetchurl { javaEcj = fetchurl {
# The `$(top_srcdir)/ecj.jar' file is automatically picked up at # The `$(top_srcdir)/ecj.jar' file is automatically picked up at
@ -197,7 +197,7 @@ let version = "4.8.5";
stageNameAddon = if crossStageStatic then "-stage-static" else "-stage-final"; stageNameAddon = if crossStageStatic then "-stage-static" else "-stage-final";
crossNameAddon = if targetPlatform != hostPlatform then "-${targetPlatform.config}" + stageNameAddon else ""; crossNameAddon = if targetPlatform != hostPlatform then "-${targetPlatform.config}" + stageNameAddon else "";
bootstrap = targetPlatform == hostPlatform && !stdenv.isArm && !stdenv.isMips; bootstrap = targetPlatform == hostPlatform && !hostPlatform.isArm && !hostPlatform.isMips;
in in
@ -225,7 +225,7 @@ stdenv.mkDerivation ({
libc_dev = stdenv.cc.libc_dev; libc_dev = stdenv.cc.libc_dev;
postPatch = postPatch =
if (stdenv.isHurd if (hostPlatform.isHurd
|| (libcCross != null # e.g., building `gcc.crossDrv' || (libcCross != null # e.g., building `gcc.crossDrv'
&& libcCross ? crossConfig && libcCross ? crossConfig
&& libcCross.crossConfig == "i586-pc-gnu") && libcCross.crossConfig == "i586-pc-gnu")
@ -297,11 +297,11 @@ stdenv.mkDerivation ({
# The builder relies on GNU sed (for instance, Darwin's `sed' fails with # 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. # "-i may not be used with stdin"), and `stdenvNative' doesn't provide it.
++ (optional stdenv.isDarwin gnused) ++ (optional hostPlatform.isDarwin gnused)
; ;
preConfigure = stdenv.lib.optionalString (stdenv.isSunOS && stdenv.is64bit) '' preConfigure = stdenv.lib.optionalString (hostPlatform.isSunOS && hostPlatform.is64bit) ''
export NIX_LDFLAGS=`echo $NIX_LDFLAGS | sed -e s~$prefix/lib~$prefix/lib/amd64~g` export NIX_LDFLAGS=`echo $NIX_LDFLAGS | sed -e s~$prefix/lib~$prefix/lib/amd64~g`
export LDFLAGS_FOR_TARGET="-Wl,-rpath,$prefix/lib/amd64 $LDFLAGS_FOR_TARGET" export LDFLAGS_FOR_TARGET="-Wl,-rpath,$prefix/lib/amd64 $LDFLAGS_FOR_TARGET"
export CXXFLAGS_FOR_TARGET="-Wl,-rpath,$prefix/lib/amd64 $CXXFLAGS_FOR_TARGET" export CXXFLAGS_FOR_TARGET="-Wl,-rpath,$prefix/lib/amd64 $CXXFLAGS_FOR_TARGET"
@ -311,7 +311,7 @@ stdenv.mkDerivation ({
dontDisableStatic = true; dontDisableStatic = true;
configureFlags = " configureFlags = "
${if stdenv.isSunOS then ${if hostPlatform.isSunOS then
" --enable-long-long --enable-libssp --enable-threads=posix --disable-nls --enable-__cxa_atexit " + " --enable-long-long --enable-libssp --enable-threads=posix --disable-nls --enable-__cxa_atexit " +
# On Illumos/Solaris GNU as is preferred # On Illumos/Solaris GNU as is preferred
" --with-gnu-as --without-gnu-ld " " --with-gnu-as --without-gnu-ld "
@ -357,7 +357,7 @@ stdenv.mkDerivation ({
) )
} }
${if targetPlatform == hostPlatform ${if targetPlatform == hostPlatform
then if stdenv.isDarwin then if hostPlatform.isDarwin
then " --with-native-system-header-dir=${darwin.usr-include}" then " --with-native-system-header-dir=${darwin.usr-include}"
else " --with-native-system-header-dir=${getDev stdenv.cc.libc}/include" else " --with-native-system-header-dir=${getDev stdenv.cc.libc}/include"
else ""} else ""}

View File

@ -1,7 +1,7 @@
{ stdenv, fetchurl, noSysDirs { stdenv, fetchurl, noSysDirs
, langC ? true, langCC ? true, langFortran ? false , langC ? true, langCC ? true, langFortran ? false
, langObjC ? stdenv.isDarwin , langObjC ? targetPlatform.isDarwin
, langObjCpp ? stdenv.isDarwin , langObjCpp ? targetPlatform.isDarwin
, langJava ? false , langJava ? false
, langAda ? false , langAda ? false
, langVhdl ? false , langVhdl ? false
@ -48,7 +48,7 @@ assert cloog != null -> isl != null;
assert libelf != null -> zlib != null; assert libelf != null -> zlib != null;
# Make sure we get GNU sed. # Make sure we get GNU sed.
assert stdenv.isDarwin -> gnused != null; assert hostPlatform.isDarwin -> gnused != null;
# The go frontend is written in c++ # The go frontend is written in c++
assert langGo -> langCC; assert langGo -> langCC;
@ -73,7 +73,7 @@ let version = "4.9.4";
++ optional langAda ../gnat-cflags.patch ++ optional langAda ../gnat-cflags.patch
++ optional langFortran ../gfortran-driving.patch ++ optional langFortran ../gfortran-driving.patch
# The NXConstStr.patch can be removed at 4.9.4 # The NXConstStr.patch can be removed at 4.9.4
++ optional stdenv.isDarwin ../gfortran-darwin-NXConstStr.patch; ++ optional hostPlatform.isDarwin ../gfortran-darwin-NXConstStr.patch;
javaEcj = fetchurl { javaEcj = fetchurl {
# The `$(top_srcdir)/ecj.jar' file is automatically picked up at # The `$(top_srcdir)/ecj.jar' file is automatically picked up at
@ -229,7 +229,7 @@ stdenv.mkDerivation ({
libc_dev = stdenv.cc.libc_dev; libc_dev = stdenv.cc.libc_dev;
postPatch = postPatch =
if (stdenv.isHurd if (hostPlatform.isHurd
|| (libcCross != null # e.g., building `gcc.crossDrv' || (libcCross != null # e.g., building `gcc.crossDrv'
&& libcCross ? crossConfig && libcCross ? crossConfig
&& libcCross.crossConfig == "i586-pc-gnu") && libcCross.crossConfig == "i586-pc-gnu")
@ -301,10 +301,10 @@ stdenv.mkDerivation ({
# The builder relies on GNU sed (for instance, Darwin's `sed' fails with # 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. # "-i may not be used with stdin"), and `stdenvNative' doesn't provide it.
++ (optional stdenv.isDarwin gnused) ++ (optional hostPlatform.isDarwin gnused)
; ;
preConfigure = stdenv.lib.optionalString (stdenv.isSunOS && stdenv.is64bit) '' preConfigure = stdenv.lib.optionalString (hostPlatform.isSunOS && hostPlatform.is64bit) ''
sed -i -e "s/-lrt//g" libstdc++-v3/configure sed -i -e "s/-lrt//g" libstdc++-v3/configure
export NIX_LDFLAGS=`echo $NIX_LDFLAGS | sed -e s~$prefix/lib~$prefix/lib/amd64~g` export NIX_LDFLAGS=`echo $NIX_LDFLAGS | sed -e s~$prefix/lib~$prefix/lib/amd64~g`
export LDFLAGS_FOR_TARGET="-Wl,-rpath,$prefix/lib/amd64 $LDFLAGS_FOR_TARGET" export LDFLAGS_FOR_TARGET="-Wl,-rpath,$prefix/lib/amd64 $LDFLAGS_FOR_TARGET"
@ -319,7 +319,7 @@ stdenv.mkDerivation ({
dontDisableStatic = true; dontDisableStatic = true;
configureFlags = " configureFlags = "
${if stdenv.isSunOS then ${if hostPlatform.isSunOS then
" --enable-long-long --enable-libssp --enable-threads=posix --disable-nls --enable-__cxa_atexit " + " --enable-long-long --enable-libssp --enable-threads=posix --disable-nls --enable-__cxa_atexit " +
# On Illumos/Solaris GNU as is preferred # On Illumos/Solaris GNU as is preferred
" --with-gnu-as --without-gnu-ld " " --with-gnu-as --without-gnu-ld "
@ -363,7 +363,7 @@ stdenv.mkDerivation ({
) )
} }
${if targetPlatform == hostPlatform ${if targetPlatform == hostPlatform
then if stdenv.isDarwin then if hostPlatform.isDarwin
then " --with-native-system-header-dir=${darwin.usr-include}" then " --with-native-system-header-dir=${darwin.usr-include}"
else " --with-native-system-header-dir=${getDev stdenv.cc.libc}/include" else " --with-native-system-header-dir=${getDev stdenv.cc.libc}/include"
else ""} else ""}

View File

@ -1,7 +1,7 @@
{ stdenv, fetchurl, noSysDirs { stdenv, fetchurl, noSysDirs
, langC ? true, langCC ? true, langFortran ? false , langC ? true, langCC ? true, langFortran ? false
, langObjC ? stdenv.isDarwin , langObjC ? targetPlatform.isDarwin
, langObjCpp ? stdenv.isDarwin , langObjCpp ? targetPlatform.isDarwin
, langJava ? false , langJava ? false
, langAda ? false , langAda ? false
, langVhdl ? false , langVhdl ? false
@ -47,10 +47,10 @@ assert langVhdl -> gnat != null;
assert libelf != null -> zlib != null; assert libelf != null -> zlib != null;
# Make sure we get GNU sed. # Make sure we get GNU sed.
assert stdenv.isDarwin -> gnused != null; assert hostPlatform.isDarwin -> gnused != null;
# Need c++filt on darwin # Need c++filt on darwin
assert stdenv.isDarwin -> binutils != null; assert hostPlatform.isDarwin -> binutils != null;
# The go frontend is written in c++ # The go frontend is written in c++
assert langGo -> langCC; assert langGo -> langCC;
@ -234,7 +234,7 @@ stdenv.mkDerivation ({
# This should kill all the stdinc frameworks that gcc and friends like to # This should kill all the stdinc frameworks that gcc and friends like to
# insert into default search paths. # insert into default search paths.
prePatch = stdenv.lib.optionalString stdenv.isDarwin '' prePatch = stdenv.lib.optionalString hostPlatform.isDarwin ''
substituteInPlace gcc/config/darwin-c.c \ substituteInPlace gcc/config/darwin-c.c \
--replace 'if (stdinc)' 'if (0)' --replace 'if (stdinc)' 'if (0)'
@ -246,7 +246,7 @@ stdenv.mkDerivation ({
''; '';
postPatch = postPatch =
if (stdenv.isHurd if (hostPlatform.isHurd
|| (libcCross != null # e.g., building `gcc.crossDrv' || (libcCross != null # e.g., building `gcc.crossDrv'
&& libcCross ? crossConfig && libcCross ? crossConfig
&& libcCross.crossConfig == "i586-pc-gnu") && libcCross.crossConfig == "i586-pc-gnu")
@ -317,13 +317,13 @@ stdenv.mkDerivation ({
# The builder relies on GNU sed (for instance, Darwin's `sed' fails with # 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. # "-i may not be used with stdin"), and `stdenvNative' doesn't provide it.
++ (optional stdenv.isDarwin gnused) ++ (optional hostPlatform.isDarwin gnused)
++ (optional stdenv.isDarwin binutils) ++ (optional hostPlatform.isDarwin binutils)
; ;
NIX_LDFLAGS = stdenv.lib.optionalString stdenv.isSunOS "-lm -ldl"; NIX_LDFLAGS = stdenv.lib.optionalString hostPlatform.isSunOS "-lm -ldl";
preConfigure = stdenv.lib.optionalString (stdenv.isSunOS && stdenv.is64bit) '' preConfigure = stdenv.lib.optionalString (hostPlatform.isSunOS && hostPlatform.is64bit) ''
export NIX_LDFLAGS=`echo $NIX_LDFLAGS | sed -e s~$prefix/lib~$prefix/lib/amd64~g` export NIX_LDFLAGS=`echo $NIX_LDFLAGS | sed -e s~$prefix/lib~$prefix/lib/amd64~g`
export LDFLAGS_FOR_TARGET="-Wl,-rpath,$prefix/lib/amd64 $LDFLAGS_FOR_TARGET" export LDFLAGS_FOR_TARGET="-Wl,-rpath,$prefix/lib/amd64 $LDFLAGS_FOR_TARGET"
export CXXFLAGS_FOR_TARGET="-Wl,-rpath,$prefix/lib/amd64 $CXXFLAGS_FOR_TARGET" export CXXFLAGS_FOR_TARGET="-Wl,-rpath,$prefix/lib/amd64 $CXXFLAGS_FOR_TARGET"
@ -333,7 +333,7 @@ stdenv.mkDerivation ({
dontDisableStatic = true; dontDisableStatic = true;
configureFlags = " configureFlags = "
${if stdenv.isSunOS then ${if hostPlatform.isSunOS then
" --enable-long-long --enable-libssp --enable-threads=posix --disable-nls --enable-__cxa_atexit " + " --enable-long-long --enable-libssp --enable-threads=posix --disable-nls --enable-__cxa_atexit " +
# On Illumos/Solaris GNU as is preferred # On Illumos/Solaris GNU as is preferred
" --with-gnu-as --without-gnu-ld " " --with-gnu-as --without-gnu-ld "
@ -378,7 +378,7 @@ stdenv.mkDerivation ({
) )
} }
${if targetPlatform == hostPlatform ${if targetPlatform == hostPlatform
then if stdenv.isDarwin then if hostPlatform.isDarwin
then " --with-native-system-header-dir=${darwin.usr-include}" then " --with-native-system-header-dir=${darwin.usr-include}"
else " --with-native-system-header-dir=${getDev stdenv.cc.libc}/include" else " --with-native-system-header-dir=${getDev stdenv.cc.libc}/include"
else ""} else ""}

View File

@ -1,7 +1,7 @@
{ stdenv, fetchurl, noSysDirs { stdenv, fetchurl, noSysDirs
, langC ? true, langCC ? true, langFortran ? false , langC ? true, langCC ? true, langFortran ? false
, langObjC ? stdenv.isDarwin , langObjC ? targetPlatform.isDarwin
, langObjCpp ? stdenv.isDarwin , langObjCpp ? targetPlatform.isDarwin
, langJava ? false , langJava ? false
, langAda ? false , langAda ? false
, langVhdl ? false , langVhdl ? false
@ -47,10 +47,10 @@ assert langVhdl -> gnat != null;
assert libelf != null -> zlib != null; assert libelf != null -> zlib != null;
# Make sure we get GNU sed. # Make sure we get GNU sed.
assert stdenv.isDarwin -> gnused != null; assert hostPlatform.isDarwin -> gnused != null;
# Need c++filt on darwin # Need c++filt on darwin
assert stdenv.isDarwin -> binutils != null; assert hostPlatform.isDarwin -> binutils != null;
# The go frontend is written in c++ # The go frontend is written in c++
assert langGo -> langCC; assert langGo -> langCC;
@ -73,7 +73,7 @@ let version = "6.3.0";
# target libraries and tools. # target libraries and tools.
++ optional langAda ../gnat-cflags.patch ++ optional langAda ../gnat-cflags.patch
++ optional langFortran ../gfortran-driving.patch ++ optional langFortran ../gfortran-driving.patch
++ optional stdenv.isDarwin ./darwin-const-correct.patch; # Kill this after 6.3.0 ++ optional hostPlatform.isDarwin ./darwin-const-correct.patch; # Kill this after 6.3.0
javaEcj = fetchurl { javaEcj = fetchurl {
# The `$(top_srcdir)/ecj.jar' file is automatically picked up at # The `$(top_srcdir)/ecj.jar' file is automatically picked up at
@ -228,7 +228,7 @@ stdenv.mkDerivation ({
hardeningDisable = [ "format" ]; hardeningDisable = [ "format" ];
postPatch = postPatch =
if (stdenv.isHurd if (hostPlatform.isHurd
|| (libcCross != null # e.g., building `gcc.crossDrv' || (libcCross != null # e.g., building `gcc.crossDrv'
&& libcCross ? crossConfig && libcCross ? crossConfig
&& libcCross.crossConfig == "i586-pc-gnu") && libcCross.crossConfig == "i586-pc-gnu")
@ -299,13 +299,13 @@ stdenv.mkDerivation ({
# The builder relies on GNU sed (for instance, Darwin's `sed' fails with # 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. # "-i may not be used with stdin"), and `stdenvNative' doesn't provide it.
++ (optional stdenv.isDarwin gnused) ++ (optional hostPlatform.isDarwin gnused)
++ (optional stdenv.isDarwin binutils) ++ (optional hostPlatform.isDarwin binutils)
; ;
NIX_LDFLAGS = stdenv.lib.optionalString stdenv.isSunOS "-lm -ldl"; NIX_LDFLAGS = stdenv.lib.optionalString hostPlatform.isSunOS "-lm -ldl";
preConfigure = stdenv.lib.optionalString (stdenv.isSunOS && stdenv.is64bit) '' preConfigure = stdenv.lib.optionalString (hostPlatform.isSunOS && hostPlatform.is64bit) ''
export NIX_LDFLAGS=`echo $NIX_LDFLAGS | sed -e s~$prefix/lib~$prefix/lib/amd64~g` export NIX_LDFLAGS=`echo $NIX_LDFLAGS | sed -e s~$prefix/lib~$prefix/lib/amd64~g`
export LDFLAGS_FOR_TARGET="-Wl,-rpath,$prefix/lib/amd64 $LDFLAGS_FOR_TARGET" export LDFLAGS_FOR_TARGET="-Wl,-rpath,$prefix/lib/amd64 $LDFLAGS_FOR_TARGET"
export CXXFLAGS_FOR_TARGET="-Wl,-rpath,$prefix/lib/amd64 $CXXFLAGS_FOR_TARGET" export CXXFLAGS_FOR_TARGET="-Wl,-rpath,$prefix/lib/amd64 $CXXFLAGS_FOR_TARGET"
@ -315,7 +315,7 @@ stdenv.mkDerivation ({
dontDisableStatic = true; dontDisableStatic = true;
configureFlags = " configureFlags = "
${if stdenv.isSunOS then ${if hostPlatform.isSunOS then
" --enable-long-long --enable-libssp --enable-threads=posix --disable-nls --enable-__cxa_atexit " + " --enable-long-long --enable-libssp --enable-threads=posix --disable-nls --enable-__cxa_atexit " +
# On Illumos/Solaris GNU as is preferred # On Illumos/Solaris GNU as is preferred
" --with-gnu-as --without-gnu-ld " " --with-gnu-as --without-gnu-ld "
@ -360,7 +360,7 @@ stdenv.mkDerivation ({
) )
} }
${if targetPlatform == hostPlatform ${if targetPlatform == hostPlatform
then if stdenv.isDarwin then if hostPlatform.isDarwin
then " --with-native-system-header-dir=${darwin.usr-include}" then " --with-native-system-header-dir=${darwin.usr-include}"
else " --with-native-system-header-dir=${getDev stdenv.cc.libc}/include" else " --with-native-system-header-dir=${getDev stdenv.cc.libc}/include"
else ""} else ""}

View File

@ -1,7 +1,7 @@
{ stdenv, fetchurl, noSysDirs { stdenv, fetchurl, noSysDirs
, langC ? true, langCC ? true, langFortran ? false , langC ? true, langCC ? true, langFortran ? false
, langObjC ? stdenv.isDarwin , langObjC ? targetPlatform.isDarwin
, langObjCpp ? stdenv.isDarwin , langObjCpp ? targetPlatform.isDarwin
, langJava ? false , langJava ? false
, langAda ? false , langAda ? false
, langVhdl ? false , langVhdl ? false
@ -48,10 +48,10 @@ assert langVhdl -> gnat != null;
assert libelf != null -> zlib != null; assert libelf != null -> zlib != null;
# Make sure we get GNU sed. # Make sure we get GNU sed.
assert stdenv.isDarwin -> gnused != null; assert hostPlatform.isDarwin -> gnused != null;
# Need c++filt on darwin # Need c++filt on darwin
assert stdenv.isDarwin -> binutils != null; assert hostPlatform.isDarwin -> binutils != null;
# The go frontend is written in c++ # The go frontend is written in c++
assert langGo -> langCC; assert langGo -> langCC;
@ -229,7 +229,7 @@ stdenv.mkDerivation ({
hardeningDisable = [ "format" ]; hardeningDisable = [ "format" ];
postPatch = postPatch =
if (stdenv.isHurd if (hostPlatform.isHurd
|| (libcCross != null # e.g., building `gcc.crossDrv' || (libcCross != null # e.g., building `gcc.crossDrv'
&& libcCross ? crossConfig && libcCross ? crossConfig
&& libcCross.crossConfig == "i586-pc-gnu") && libcCross.crossConfig == "i586-pc-gnu")
@ -300,13 +300,13 @@ stdenv.mkDerivation ({
# The builder relies on GNU sed (for instance, Darwin's `sed' fails with # 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. # "-i may not be used with stdin"), and `stdenvNative' doesn't provide it.
++ (optional stdenv.isDarwin gnused) ++ (optional hostPlatform.isDarwin gnused)
++ (optional stdenv.isDarwin binutils) ++ (optional hostPlatform.isDarwin binutils)
; ;
NIX_LDFLAGS = stdenv.lib.optionalString stdenv.isSunOS "-lm -ldl"; NIX_LDFLAGS = stdenv.lib.optionalString hostPlatform.isSunOS "-lm -ldl";
preConfigure = stdenv.lib.optionalString (stdenv.isSunOS && stdenv.is64bit) '' preConfigure = stdenv.lib.optionalString (hostPlatform.isSunOS && hostPlatform.is64bit) ''
export NIX_LDFLAGS=`echo $NIX_LDFLAGS | sed -e s~$prefix/lib~$prefix/lib/amd64~g` export NIX_LDFLAGS=`echo $NIX_LDFLAGS | sed -e s~$prefix/lib~$prefix/lib/amd64~g`
export LDFLAGS_FOR_TARGET="-Wl,-rpath,$prefix/lib/amd64 $LDFLAGS_FOR_TARGET" export LDFLAGS_FOR_TARGET="-Wl,-rpath,$prefix/lib/amd64 $LDFLAGS_FOR_TARGET"
export CXXFLAGS_FOR_TARGET="-Wl,-rpath,$prefix/lib/amd64 $CXXFLAGS_FOR_TARGET" export CXXFLAGS_FOR_TARGET="-Wl,-rpath,$prefix/lib/amd64 $CXXFLAGS_FOR_TARGET"
@ -316,7 +316,7 @@ stdenv.mkDerivation ({
dontDisableStatic = true; dontDisableStatic = true;
configureFlags = " configureFlags = "
${if stdenv.isSunOS then ${if hostPlatform.isSunOS then
" --enable-long-long --enable-libssp --enable-threads=posix --disable-nls --enable-__cxa_atexit " + " --enable-long-long --enable-libssp --enable-threads=posix --disable-nls --enable-__cxa_atexit " +
# On Illumos/Solaris GNU as is preferred # On Illumos/Solaris GNU as is preferred
" --with-gnu-as --without-gnu-ld " " --with-gnu-as --without-gnu-ld "
@ -361,7 +361,7 @@ stdenv.mkDerivation ({
) )
} }
${if targetPlatform == hostPlatform ${if targetPlatform == hostPlatform
then if stdenv.isDarwin then if hostPlatform.isDarwin
then " --with-native-system-header-dir=${darwin.usr-include}" then " --with-native-system-header-dir=${darwin.usr-include}"
else " --with-native-system-header-dir=${getDev stdenv.cc.libc}/include" else " --with-native-system-header-dir=${getDev stdenv.cc.libc}/include"
else ""} else ""}