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.
wip/yesman
John Ericson 7 years ago
parent e854685d65
commit 35ed21d096
  1. 6
      pkgs/development/compilers/gcc/4.5/default.nix
  2. 20
      pkgs/development/compilers/gcc/4.8/default.nix
  3. 18
      pkgs/development/compilers/gcc/4.9/default.nix
  4. 24
      pkgs/development/compilers/gcc/5/default.nix
  5. 24
      pkgs/development/compilers/gcc/6/default.nix
  6. 22
      pkgs/development/compilers/gcc/snapshot/default.nix

@ -138,7 +138,7 @@ stdenv.mkDerivation ({
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" ];
setOutputFlags = false;
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
if targetPlatform == hostPlatform && stdenv.system == "mips64el-linux" then "--with-arch=loongson2f" 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 ""}
";
@ -311,7 +311,7 @@ stdenv.mkDerivation ({
)
}
${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 ""}
--target=${targetPlatform.config}
'';

@ -1,7 +1,7 @@
{ stdenv, fetchurl, noSysDirs
, langC ? true, langCC ? true, langFortran ? false
, langObjC ? stdenv.isDarwin
, langObjCpp ? stdenv.isDarwin
, langObjC ? targetPlatform.isDarwin
, langObjCpp ? targetPlatform.isDarwin
, langJava ? false
, langAda ? false
, langVhdl ? false
@ -48,7 +48,7 @@ assert cloog != null -> isl != null;
assert libelf != null -> zlib != null;
# Make sure we get GNU sed.
assert stdenv.isDarwin -> gnused != null;
assert hostPlatform.isDarwin -> gnused != null;
# The go frontend is written in c++
assert langGo -> langCC;
@ -71,7 +71,7 @@ let version = "4.8.5";
# target libraries and tools.
++ optional langAda ../gnat-cflags.patch
++ optional langFortran ../gfortran-driving.patch
++ optional stdenv.isDarwin ../gfortran-darwin-NXConstStr.patch;
++ optional hostPlatform.isDarwin ../gfortran-darwin-NXConstStr.patch;
javaEcj = fetchurl {
# 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";
crossNameAddon = if targetPlatform != hostPlatform then "-${targetPlatform.config}" + stageNameAddon else "";
bootstrap = targetPlatform == hostPlatform && !stdenv.isArm && !stdenv.isMips;
bootstrap = targetPlatform == hostPlatform && !hostPlatform.isArm && !hostPlatform.isMips;
in
@ -225,7 +225,7 @@ stdenv.mkDerivation ({
libc_dev = stdenv.cc.libc_dev;
postPatch =
if (stdenv.isHurd
if (hostPlatform.isHurd
|| (libcCross != null # e.g., building `gcc.crossDrv'
&& libcCross ? crossConfig
&& libcCross.crossConfig == "i586-pc-gnu")
@ -297,11 +297,11 @@ stdenv.mkDerivation ({
# 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 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 LDFLAGS_FOR_TARGET="-Wl,-rpath,$prefix/lib/amd64 $LDFLAGS_FOR_TARGET"
export CXXFLAGS_FOR_TARGET="-Wl,-rpath,$prefix/lib/amd64 $CXXFLAGS_FOR_TARGET"
@ -311,7 +311,7 @@ stdenv.mkDerivation ({
dontDisableStatic = true;
configureFlags = "
${if stdenv.isSunOS then
${if hostPlatform.isSunOS then
" --enable-long-long --enable-libssp --enable-threads=posix --disable-nls --enable-__cxa_atexit " +
# On Illumos/Solaris GNU as is preferred
" --with-gnu-as --without-gnu-ld "
@ -357,7 +357,7 @@ stdenv.mkDerivation ({
)
}
${if targetPlatform == hostPlatform
then if stdenv.isDarwin
then if hostPlatform.isDarwin
then " --with-native-system-header-dir=${darwin.usr-include}"
else " --with-native-system-header-dir=${getDev stdenv.cc.libc}/include"
else ""}

@ -1,7 +1,7 @@
{ stdenv, fetchurl, noSysDirs
, langC ? true, langCC ? true, langFortran ? false
, langObjC ? stdenv.isDarwin
, langObjCpp ? stdenv.isDarwin
, langObjC ? targetPlatform.isDarwin
, langObjCpp ? targetPlatform.isDarwin
, langJava ? false
, langAda ? false
, langVhdl ? false
@ -48,7 +48,7 @@ assert cloog != null -> isl != null;
assert libelf != null -> zlib != null;
# Make sure we get GNU sed.
assert stdenv.isDarwin -> gnused != null;
assert hostPlatform.isDarwin -> gnused != null;
# The go frontend is written in c++
assert langGo -> langCC;
@ -73,7 +73,7 @@ let version = "4.9.4";
++ optional langAda ../gnat-cflags.patch
++ optional langFortran ../gfortran-driving.patch
# 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 {
# The `$(top_srcdir)/ecj.jar' file is automatically picked up at
@ -229,7 +229,7 @@ stdenv.mkDerivation ({
libc_dev = stdenv.cc.libc_dev;
postPatch =
if (stdenv.isHurd
if (hostPlatform.isHurd
|| (libcCross != null # e.g., building `gcc.crossDrv'
&& libcCross ? crossConfig
&& libcCross.crossConfig == "i586-pc-gnu")
@ -301,10 +301,10 @@ stdenv.mkDerivation ({
# 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 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
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"
@ -319,7 +319,7 @@ stdenv.mkDerivation ({
dontDisableStatic = true;
configureFlags = "
${if stdenv.isSunOS then
${if hostPlatform.isSunOS then
" --enable-long-long --enable-libssp --enable-threads=posix --disable-nls --enable-__cxa_atexit " +
# On Illumos/Solaris GNU as is preferred
" --with-gnu-as --without-gnu-ld "
@ -363,7 +363,7 @@ stdenv.mkDerivation ({
)
}
${if targetPlatform == hostPlatform
then if stdenv.isDarwin
then if hostPlatform.isDarwin
then " --with-native-system-header-dir=${darwin.usr-include}"
else " --with-native-system-header-dir=${getDev stdenv.cc.libc}/include"
else ""}

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

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

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

Loading…
Cancel
Save