gcc: use Nix instead of bash for conditional
Now that we use the standard builder, the commands produced by pre-configure.nix are wrapped in a bash function. Inside of a bash function, `export foo=` will still add `foo` to the environment of any child processes forked after that point, but those variables will *not* be visible to bash code which is outside of the function-scope in which the `export` occurs. Weird crap like this is yet another reason why we need to move away from using bash for logic. Let's switch.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
{ lib
|
||||
, stdenv
|
||||
, enableMultilib
|
||||
}:
|
||||
|
||||
originalAttrs: (stdenv.mkDerivation (finalAttrs: originalAttrs // {
|
||||
@@ -188,16 +189,22 @@ originalAttrs: (stdenv.mkDerivation (finalAttrs: originalAttrs // {
|
||||
preInstall = ''
|
||||
mkdir -p "$out/''${targetConfig}/lib"
|
||||
mkdir -p "''${!outputLib}/''${targetConfig}/lib"
|
||||
# Make ‘lib64’ symlinks to ‘lib’.
|
||||
if [ -n "$linkLib64toLib" ]; then
|
||||
ln -s lib "$out/''${targetConfig}/lib64"
|
||||
ln -s lib "''${!outputLib}/''${targetConfig}/lib64"
|
||||
fi
|
||||
# Make ‘lib32’ symlinks to ‘lib’.
|
||||
if [ -n "$linkLib32toLib" ]; then
|
||||
ln -s lib "$out/''${targetConfig}/lib32"
|
||||
ln -s lib "''${!outputLib}/''${targetConfig}/lib32"
|
||||
fi
|
||||
'' +
|
||||
# Make `lib64` symlinks to `lib`.
|
||||
lib.optionalString (!enableMultilib && stdenv.hostPlatform.is64bit && !stdenv.hostPlatform.isMips64n32) ''
|
||||
ln -s lib "$out/''${targetConfig}/lib64"
|
||||
ln -s lib "''${!outputLib}/''${targetConfig}/lib64"
|
||||
'' +
|
||||
# On mips platforms, gcc follows the IRIX naming convention:
|
||||
#
|
||||
# $PREFIX/lib = mips32
|
||||
# $PREFIX/lib32 = mips64n32
|
||||
# $PREFIX/lib64 = mips64
|
||||
#
|
||||
# Make `lib32` symlinks to `lib`.
|
||||
lib.optionalString (!enableMultilib && stdenv.targetPlatform.isMips64n32) ''
|
||||
ln -s lib "$out/''${targetConfig}/lib32"
|
||||
ln -s lib "''${!outputLib}/''${targetConfig}/lib32"
|
||||
'';
|
||||
|
||||
postInstall = ''
|
||||
|
||||
@@ -148,16 +148,3 @@ in lib.optionalString (hostPlatform.isSunOS && hostPlatform.is64bit) ''
|
||||
echo 'SHLIB_LC=${SHLIB_LC}' >> libgcc/Makefile.in
|
||||
'')
|
||||
|
||||
+ 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 (!enableMultilib && targetPlatform.isMips64n32) ''
|
||||
export linkLib32toLib=1
|
||||
''
|
||||
|
||||
Reference in New Issue
Block a user