From 35ed21d09636ea85806685c92723a5ebc2d6bb39 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Sun, 4 Jun 2017 23:55:29 -0400 Subject: [PATCH] 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. --- .../development/compilers/gcc/4.5/default.nix | 6 ++--- .../development/compilers/gcc/4.8/default.nix | 20 ++++++++-------- .../development/compilers/gcc/4.9/default.nix | 18 +++++++------- pkgs/development/compilers/gcc/5/default.nix | 24 +++++++++---------- pkgs/development/compilers/gcc/6/default.nix | 24 +++++++++---------- .../compilers/gcc/snapshot/default.nix | 22 ++++++++--------- 6 files changed, 57 insertions(+), 57 deletions(-) diff --git a/pkgs/development/compilers/gcc/4.5/default.nix b/pkgs/development/compilers/gcc/4.5/default.nix index 7c5d91c91285..67981ad1056e 100644 --- a/pkgs/development/compilers/gcc/4.5/default.nix +++ b/pkgs/development/compilers/gcc/4.5/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} ''; diff --git a/pkgs/development/compilers/gcc/4.8/default.nix b/pkgs/development/compilers/gcc/4.8/default.nix index c057624398b3..de9d3165b55e 100644 --- a/pkgs/development/compilers/gcc/4.8/default.nix +++ b/pkgs/development/compilers/gcc/4.8/default.nix @@ -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 ""} diff --git a/pkgs/development/compilers/gcc/4.9/default.nix b/pkgs/development/compilers/gcc/4.9/default.nix index 3469710f9916..c5bebdf33003 100644 --- a/pkgs/development/compilers/gcc/4.9/default.nix +++ b/pkgs/development/compilers/gcc/4.9/default.nix @@ -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 ""} diff --git a/pkgs/development/compilers/gcc/5/default.nix b/pkgs/development/compilers/gcc/5/default.nix index 2569b8c5dc7a..b4a74300d366 100644 --- a/pkgs/development/compilers/gcc/5/default.nix +++ b/pkgs/development/compilers/gcc/5/default.nix @@ -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 ""} diff --git a/pkgs/development/compilers/gcc/6/default.nix b/pkgs/development/compilers/gcc/6/default.nix index 8086bfb24df6..057acf9794e7 100644 --- a/pkgs/development/compilers/gcc/6/default.nix +++ b/pkgs/development/compilers/gcc/6/default.nix @@ -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 ""} diff --git a/pkgs/development/compilers/gcc/snapshot/default.nix b/pkgs/development/compilers/gcc/snapshot/default.nix index 33a202fdb98b..bb2c9d8a5c09 100644 --- a/pkgs/development/compilers/gcc/snapshot/default.nix +++ b/pkgs/development/compilers/gcc/snapshot/default.nix @@ -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 ""}