gcc: factor out $linkLib64toLib, move it from bash to nix

This commit factors out the conditional which creates the `lib64->lib`
symlink in the `preInstall` phase, and calculates its value in nix
code rather than bash code so touching it doesn't cause a global
rebuild on every platform.
This commit is contained in:
Adam Joseph 2022-08-05 13:52:25 -07:00
parent dfba0bf93b
commit a6daffb118
11 changed files with 16 additions and 29 deletions

View File

@ -188,7 +188,7 @@ stdenv.mkDerivation ({
preConfigure = import ../common/pre-configure.nix {
inherit lib;
inherit version targetPlatform hostPlatform gnatboot langAda langGo langJit crossStageStatic;
inherit version targetPlatform hostPlatform gnatboot langAda langGo langJit crossStageStatic enableMultilib;
};
dontDisableStatic = true;
@ -268,8 +268,6 @@ stdenv.mkDerivation ({
enableParallelBuilding = true;
inherit enableMultilib enableShared;
is64bit = stdenv.is64bit && !stdenv.hostPlatform.isMips64n32;
meta = {
homepage = "https://gcc.gnu.org/";
license = lib.licenses.gpl3Plus; # runtime support libraries are typically LGPLv3+

View File

@ -196,7 +196,7 @@ stdenv.mkDerivation ({
preConfigure = import ../common/pre-configure.nix {
inherit lib;
inherit version targetPlatform hostPlatform gnatboot langAda langGo langJit crossStageStatic;
inherit version targetPlatform hostPlatform gnatboot langAda langGo langJit crossStageStatic enableMultilib;
};
dontDisableStatic = true;
@ -276,8 +276,6 @@ stdenv.mkDerivation ({
enableParallelBuilding = true;
inherit enableShared enableMultilib;
is64bit = stdenv.is64bit && !stdenv.hostPlatform.isMips64n32;
meta = {
homepage = "https://gcc.gnu.org/";
license = lib.licenses.gpl3Plus; # runtime support libraries are typically LGPLv3+

View File

@ -191,7 +191,7 @@ stdenv.mkDerivation ({
preConfigure = import ../common/pre-configure.nix {
inherit lib;
inherit version targetPlatform hostPlatform gnatboot langAda langGo langJit crossStageStatic;
inherit version targetPlatform hostPlatform gnatboot langAda langGo langJit crossStageStatic enableMultilib;
};
dontDisableStatic = true;
@ -271,8 +271,6 @@ stdenv.mkDerivation ({
enableParallelBuilding = true;
inherit enableShared enableMultilib;
is64bit = stdenv.is64bit && !stdenv.hostPlatform.isMips64n32;
meta = {
homepage = "https://gcc.gnu.org/";
license = lib.licenses.gpl3Plus; # runtime support libraries are typically LGPLv3+

View File

@ -195,7 +195,7 @@ stdenv.mkDerivation ({
preConfigure = import ../common/pre-configure.nix {
inherit lib;
inherit version targetPlatform hostPlatform langJava langGo crossStageStatic;
inherit version targetPlatform hostPlatform langJava langGo crossStageStatic enableMultilib;
};
dontDisableStatic = true;
@ -291,8 +291,6 @@ stdenv.mkDerivation ({
enableParallelBuilding = true;
inherit enableShared enableMultilib;
is64bit = stdenv.is64bit && !stdenv.hostPlatform.isMips64n32;
meta = {
homepage = "https://gcc.gnu.org/";
license = lib.licenses.gpl3Plus; # runtime support libraries are typically LGPLv3+

View File

@ -215,7 +215,7 @@ stdenv.mkDerivation ({
preConfigure = import ../common/pre-configure.nix {
inherit lib;
inherit version targetPlatform hostPlatform langJava langGo crossStageStatic;
inherit version targetPlatform hostPlatform langJava langGo crossStageStatic enableMultilib;
};
dontDisableStatic = true;
@ -310,8 +310,6 @@ stdenv.mkDerivation ({
enableParallelBuilding = true;
inherit enableShared enableMultilib;
is64bit = stdenv.is64bit && !stdenv.hostPlatform.isMips64n32;
meta = {
homepage = "https://gcc.gnu.org/";
license = lib.licenses.gpl3Plus; # runtime support libraries are typically LGPLv3+

View File

@ -227,7 +227,7 @@ stdenv.mkDerivation ({
preConfigure = import ../common/pre-configure.nix {
inherit lib;
inherit version targetPlatform hostPlatform gnatboot langJava langAda langGo crossStageStatic;
inherit version targetPlatform hostPlatform gnatboot langJava langAda langGo crossStageStatic enableMultilib;
};
dontDisableStatic = true;
@ -322,8 +322,6 @@ stdenv.mkDerivation ({
enableParallelBuilding = true;
inherit enableShared enableMultilib;
is64bit = stdenv.is64bit && !stdenv.hostPlatform.isMips64n32;
meta = {
homepage = "https://gcc.gnu.org/";
license = lib.licenses.gpl3Plus; # runtime support libraries are typically LGPLv3+

View File

@ -194,7 +194,7 @@ stdenv.mkDerivation ({
preConfigure = import ../common/pre-configure.nix {
inherit lib;
inherit version targetPlatform hostPlatform langGo crossStageStatic;
inherit version targetPlatform hostPlatform langGo crossStageStatic enableMultilib;
};
dontDisableStatic = true;
@ -276,8 +276,6 @@ stdenv.mkDerivation ({
enableParallelBuilding = true;
inherit enableShared enableMultilib;
is64bit = stdenv.is64bit && !stdenv.hostPlatform.isMips64n32;
meta = {
homepage = "https://gcc.gnu.org/";
license = lib.licenses.gpl3Plus; # runtime support libraries are typically LGPLv3+

View File

@ -177,7 +177,7 @@ stdenv.mkDerivation ({
preConfigure = import ../common/pre-configure.nix {
inherit lib;
inherit version targetPlatform hostPlatform langGo crossStageStatic;
inherit version targetPlatform hostPlatform langGo crossStageStatic enableMultilib;
};
dontDisableStatic = true;
@ -255,8 +255,6 @@ stdenv.mkDerivation ({
enableParallelBuilding = true;
inherit enableShared enableMultilib;
is64bit = stdenv.is64bit && !stdenv.hostPlatform.isMips64n32;
meta = {
homepage = "https://gcc.gnu.org/";
license = lib.licenses.gpl3Plus; # runtime support libraries are typically LGPLv3+

View File

@ -190,7 +190,7 @@ stdenv.mkDerivation ({
preConfigure = import ../common/pre-configure.nix {
inherit lib;
inherit version targetPlatform hostPlatform gnatboot langAda langGo langJit crossStageStatic;
inherit version targetPlatform hostPlatform gnatboot langAda langGo langJit crossStageStatic enableMultilib;
};
dontDisableStatic = true;
@ -270,8 +270,6 @@ stdenv.mkDerivation ({
enableParallelBuilding = true;
inherit enableShared enableMultilib;
is64bit = stdenv.is64bit && !stdenv.hostPlatform.isMips64n32;
meta = {
homepage = "https://gcc.gnu.org/";
license = lib.licenses.gpl3Plus; # runtime support libraries are typically LGPLv3+

View File

@ -193,7 +193,7 @@ preInstall() {
mkdir -p "$out/${targetConfig}/lib"
mkdir -p "${!outputLib}/${targetConfig}/lib"
# Make lib64 symlinks to lib.
if [ -n "$is64bit" -a -z "$enableMultilib" ]; then
if [ -n "$linkLib64toLib" ]; then
ln -s lib "$out/${targetConfig}/lib64"
ln -s lib "${!outputLib}/${targetConfig}/lib64"
fi

View File

@ -5,6 +5,7 @@
, langJit ? false
, langGo
, crossStageStatic
, enableMultilib
}:
assert langJava -> lib.versionOlder version "7";
@ -79,12 +80,16 @@ in lib.optionalString (hostPlatform.isSunOS && hostPlatform.is64bit) ''
export inhibit_libc=true
''
+ lib.optionalString (!enableMultilib && hostPlatform.is64bit && !hostPlatform.isMips64n32) ''
export linkLib64toLib=1
''
# On mips platforms, gcc follows the IRIX naming convention:
#
# $PREFIX/lib = mips32
# $PREFIX/lib32 = mips64n32
# $PREFIX/lib64 = mips64
#
+ lib.optionalString (targetPlatform.isMips64n32) ''
+ lib.optionalString (!enableMultilib && targetPlatform.isMips64n32) ''
export linkLib32toLib=1
''