treewide: simplify exec format conditionals
This commit is contained in:
parent
1bf1c7a244
commit
c324705cc3
13 changed files with 16 additions and 26 deletions
|
@ -80,7 +80,7 @@ stdenv.mkDerivation {
|
||||||
cp -L "$libblas" $out/lib/libblas${canonicalExtension}
|
cp -L "$libblas" $out/lib/libblas${canonicalExtension}
|
||||||
chmod +w $out/lib/libblas${canonicalExtension}
|
chmod +w $out/lib/libblas${canonicalExtension}
|
||||||
|
|
||||||
'' + (if stdenv.hostPlatform.parsed.kernel.execFormat.name == "elf" then ''
|
'' + (if stdenv.hostPlatform.isElf then ''
|
||||||
patchelf --set-soname libblas${canonicalExtension} $out/lib/libblas${canonicalExtension}
|
patchelf --set-soname libblas${canonicalExtension} $out/lib/libblas${canonicalExtension}
|
||||||
patchelf --set-rpath "$(patchelf --print-rpath $out/lib/libblas${canonicalExtension}):${lib.getLib blasProvider'}/lib" $out/lib/libblas${canonicalExtension}
|
patchelf --set-rpath "$(patchelf --print-rpath $out/lib/libblas${canonicalExtension}):${lib.getLib blasProvider'}/lib" $out/lib/libblas${canonicalExtension}
|
||||||
'' else lib.optionalString (stdenv.hostPlatform.isDarwin) ''
|
'' else lib.optionalString (stdenv.hostPlatform.isDarwin) ''
|
||||||
|
@ -112,7 +112,7 @@ EOF
|
||||||
cp -L "$libcblas" $out/lib/libcblas${canonicalExtension}
|
cp -L "$libcblas" $out/lib/libcblas${canonicalExtension}
|
||||||
chmod +w $out/lib/libcblas${canonicalExtension}
|
chmod +w $out/lib/libcblas${canonicalExtension}
|
||||||
|
|
||||||
'' + (if stdenv.hostPlatform.parsed.kernel.execFormat.name == "elf" then ''
|
'' + (if stdenv.hostPlatform.isElf then ''
|
||||||
patchelf --set-soname libcblas${canonicalExtension} $out/lib/libcblas${canonicalExtension}
|
patchelf --set-soname libcblas${canonicalExtension} $out/lib/libcblas${canonicalExtension}
|
||||||
patchelf --set-rpath "$(patchelf --print-rpath $out/lib/libcblas${canonicalExtension}):${lib.getLib blasProvider'}/lib" $out/lib/libcblas${canonicalExtension}
|
patchelf --set-rpath "$(patchelf --print-rpath $out/lib/libcblas${canonicalExtension}):${lib.getLib blasProvider'}/lib" $out/lib/libcblas${canonicalExtension}
|
||||||
'' else lib.optionalString stdenv.hostPlatform.isDarwin ''
|
'' else lib.optionalString stdenv.hostPlatform.isDarwin ''
|
||||||
|
|
|
@ -57,7 +57,7 @@ stdenv.mkDerivation {
|
||||||
cp -L "$liblapack" $out/lib/liblapack${canonicalExtension}
|
cp -L "$liblapack" $out/lib/liblapack${canonicalExtension}
|
||||||
chmod +w $out/lib/liblapack${canonicalExtension}
|
chmod +w $out/lib/liblapack${canonicalExtension}
|
||||||
|
|
||||||
'' + (lib.optionalString (stdenv.hostPlatform.parsed.kernel.execFormat.name == "elf") ''
|
'' + (lib.optionalString stdenv.hostPlatform.isElf ''
|
||||||
patchelf --set-soname liblapack${canonicalExtension} $out/lib/liblapack${canonicalExtension}
|
patchelf --set-soname liblapack${canonicalExtension} $out/lib/liblapack${canonicalExtension}
|
||||||
patchelf --set-rpath "$(patchelf --print-rpath $out/lib/liblapack${canonicalExtension}):${lapackProvider'}/lib" $out/lib/liblapack${canonicalExtension}
|
patchelf --set-rpath "$(patchelf --print-rpath $out/lib/liblapack${canonicalExtension}):${lapackProvider'}/lib" $out/lib/liblapack${canonicalExtension}
|
||||||
'') + ''
|
'') + ''
|
||||||
|
@ -86,7 +86,7 @@ EOF
|
||||||
cp -L "$liblapacke" $out/lib/liblapacke${canonicalExtension}
|
cp -L "$liblapacke" $out/lib/liblapacke${canonicalExtension}
|
||||||
chmod +w $out/lib/liblapacke${canonicalExtension}
|
chmod +w $out/lib/liblapacke${canonicalExtension}
|
||||||
|
|
||||||
'' + (lib.optionalString (stdenv.hostPlatform.parsed.kernel.execFormat.name == "elf") ''
|
'' + (lib.optionalString stdenv.hostPlatform.isElf ''
|
||||||
patchelf --set-soname liblapacke${canonicalExtension} $out/lib/liblapacke${canonicalExtension}
|
patchelf --set-soname liblapacke${canonicalExtension} $out/lib/liblapacke${canonicalExtension}
|
||||||
patchelf --set-rpath "$(patchelf --print-rpath $out/lib/liblapacke${canonicalExtension}):${lib.getLib lapackProvider'}/lib" $out/lib/liblapacke${canonicalExtension}
|
patchelf --set-rpath "$(patchelf --print-rpath $out/lib/liblapacke${canonicalExtension}):${lib.getLib lapackProvider'}/lib" $out/lib/liblapacke${canonicalExtension}
|
||||||
'') + ''
|
'') + ''
|
||||||
|
|
|
@ -98,8 +98,7 @@ rustPlatform.buildRustPackage.override {
|
||||||
# Disable check phase as there are failures (4 tests fail)
|
# Disable check phase as there are failures (4 tests fail)
|
||||||
doCheck = false;
|
doCheck = false;
|
||||||
|
|
||||||
doInstallCheck = !stdenv.hostPlatform.isStatic &&
|
doInstallCheck = !stdenv.hostPlatform.isStatic && stdenv.hostPlatform.isElf;
|
||||||
stdenv.hostPlatform.parsed.kernel.execFormat == lib.systems.parse.execFormats.elf;
|
|
||||||
installCheckPhase = ''
|
installCheckPhase = ''
|
||||||
runHook preInstallCheck
|
runHook preInstallCheck
|
||||||
readelf -a $out/bin/.cargo-wrapped | grep -F 'Shared library: [libcurl.so'
|
readelf -a $out/bin/.cargo-wrapped | grep -F 'Shared library: [libcurl.so'
|
||||||
|
|
|
@ -73,8 +73,7 @@ let
|
||||||
else if stdenv.hostPlatform.parsed.cpu.name == "s390x" then "s390x"
|
else if stdenv.hostPlatform.parsed.cpu.name == "s390x" then "s390x"
|
||||||
else toString stdenv.hostPlatform.parsed.cpu.family}"
|
else toString stdenv.hostPlatform.parsed.cpu.family}"
|
||||||
# env in host triplet for Mach-O is "macho", but boost binary format for Mach-O is "mach-o"
|
# env in host triplet for Mach-O is "macho", but boost binary format for Mach-O is "mach-o"
|
||||||
"binary-format=${if stdenv.hostPlatform.parsed.kernel.execFormat == lib.systems.parse.execFormats.macho
|
"binary-format=${if stdenv.hostPlatform.isMacho then "mach-o"
|
||||||
then "mach-o"
|
|
||||||
else toString stdenv.hostPlatform.parsed.kernel.execFormat.name}"
|
else toString stdenv.hostPlatform.parsed.kernel.execFormat.name}"
|
||||||
"target-os=${toString stdenv.hostPlatform.parsed.kernel.name}"
|
"target-os=${toString stdenv.hostPlatform.parsed.kernel.name}"
|
||||||
|
|
||||||
|
|
|
@ -234,7 +234,7 @@ stdenv.mkDerivation rec {
|
||||||
'';
|
'';
|
||||||
|
|
||||||
doInstallCheck = (lib.elem "webp" selectedPlugins) && !stdenv.hostPlatform.isStatic &&
|
doInstallCheck = (lib.elem "webp" selectedPlugins) && !stdenv.hostPlatform.isStatic &&
|
||||||
stdenv.hostPlatform.parsed.kernel.execFormat == lib.systems.parse.execFormats.elf;
|
stdenv.hostPlatform.isElf;
|
||||||
installCheckPhase = ''
|
installCheckPhase = ''
|
||||||
runHook preInstallCheck
|
runHook preInstallCheck
|
||||||
readelf -a $out/lib/gstreamer-1.0/libgstrswebp.so | grep -F 'Shared library: [libwebpdemux.so'
|
readelf -a $out/lib/gstreamer-1.0/libgstrswebp.so | grep -F 'Shared library: [libwebpdemux.so'
|
||||||
|
|
|
@ -93,7 +93,7 @@ let
|
||||||
else if stdenv.hostPlatform.isBSD
|
else if stdenv.hostPlatform.isBSD
|
||||||
then if stdenv.hostPlatform.isx86_64 then "./Configure BSD-x86_64"
|
then if stdenv.hostPlatform.isx86_64 then "./Configure BSD-x86_64"
|
||||||
else if stdenv.hostPlatform.isx86_32
|
else if stdenv.hostPlatform.isx86_32
|
||||||
then "./Configure BSD-x86" + lib.optionalString (stdenv.hostPlatform.parsed.kernel.execFormat.name == "elf") "-elf"
|
then "./Configure BSD-x86" + lib.optionalString stdenv.hostPlatform.isElf "-elf"
|
||||||
else "./Configure BSD-generic${toString stdenv.hostPlatform.parsed.cpu.bits}"
|
else "./Configure BSD-generic${toString stdenv.hostPlatform.parsed.cpu.bits}"
|
||||||
else if stdenv.hostPlatform.isMinGW
|
else if stdenv.hostPlatform.isMinGW
|
||||||
then "./Configure mingw${lib.optionalString
|
then "./Configure mingw${lib.optionalString
|
||||||
|
|
|
@ -90,7 +90,7 @@ stdenv.mkDerivation (finalAttrs: {
|
||||||
else if stdenv.hostPlatform.isBSD && stdenv.hostPlatform.isx86_64
|
else if stdenv.hostPlatform.isBSD && stdenv.hostPlatform.isx86_64
|
||||||
then "./Configure BSD-x86_64"
|
then "./Configure BSD-x86_64"
|
||||||
else if stdenv.hostPlatform.isBSD && stdenv.hostPlatform.isx86_32
|
else if stdenv.hostPlatform.isBSD && stdenv.hostPlatform.isx86_32
|
||||||
then "./Configure BSD-x86" + lib.optionalString (stdenv.hostPlatform.parsed.kernel.execFormat.name == "elf") "-elf"
|
then "./Configure BSD-x86" + lib.optionalString stdenv.hostPlatform.isElf "-elf"
|
||||||
else if stdenv.hostPlatform.isBSD
|
else if stdenv.hostPlatform.isBSD
|
||||||
then "./Configure BSD-generic${toString stdenv.hostPlatform.parsed.cpu.bits}"
|
then "./Configure BSD-generic${toString stdenv.hostPlatform.parsed.cpu.bits}"
|
||||||
else if stdenv.hostPlatform.isMinGW
|
else if stdenv.hostPlatform.isMinGW
|
||||||
|
|
|
@ -66,7 +66,7 @@ buildPythonPackage rec {
|
||||||
"test_flipping_upload_enabled_respects_order_of_events"
|
"test_flipping_upload_enabled_respects_order_of_events"
|
||||||
];
|
];
|
||||||
|
|
||||||
postInstallCheck = lib.optionalString (stdenv.hostPlatform.parsed.kernel.execFormat == lib.systems.parse.execFormats.elf) ''
|
postInstallCheck = lib.optionalString stdenv.hostPlatform.isElf ''
|
||||||
readelf -a $out/${python.sitePackages}/glean/libglean_ffi.so | grep -F 'Shared library: [liblmdb.so'
|
readelf -a $out/${python.sitePackages}/glean/libglean_ffi.so | grep -F 'Shared library: [liblmdb.so'
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,3 @@
|
||||||
let
|
|
||||||
execFormatIsELF = platform: platform.parsed.kernel.execFormat.name == "elf";
|
|
||||||
in
|
|
||||||
|
|
||||||
{ stdenv
|
{ stdenv
|
||||||
, autoreconfHook
|
, autoreconfHook
|
||||||
, autoconf269, automake, libtool
|
, autoconf269, automake, libtool
|
||||||
|
@ -18,7 +14,7 @@ in
|
||||||
, texinfo
|
, texinfo
|
||||||
, zlib
|
, zlib
|
||||||
|
|
||||||
, enableGold ? execFormatIsELF stdenv.targetPlatform
|
, enableGold ? stdenv.targetPlatform.isElf
|
||||||
, enableShared ? !stdenv.hostPlatform.isStatic
|
, enableShared ? !stdenv.hostPlatform.isStatic
|
||||||
# WARN: Enabling all targets increases output size to a multiple.
|
# WARN: Enabling all targets increases output size to a multiple.
|
||||||
, withAllTargets ? false
|
, withAllTargets ? false
|
||||||
|
@ -26,7 +22,7 @@ in
|
||||||
|
|
||||||
# WARN: configure silently disables ld.gold if it's unsupported, so we need to
|
# WARN: configure silently disables ld.gold if it's unsupported, so we need to
|
||||||
# make sure that intent matches result ourselves.
|
# make sure that intent matches result ourselves.
|
||||||
assert enableGold -> execFormatIsELF stdenv.targetPlatform;
|
assert enableGold -> stdenv.targetPlatform.isElf;
|
||||||
|
|
||||||
|
|
||||||
let
|
let
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
let
|
let
|
||||||
withGold = platform: platform.parsed.kernel.execFormat.name == "elf" && !platform.isRiscV && !platform.isLoongArch64;
|
withGold = platform: platform.isElf && !platform.isRiscV && !platform.isLoongArch64;
|
||||||
in
|
in
|
||||||
|
|
||||||
{ stdenv
|
{ stdenv
|
||||||
|
|
|
@ -31,8 +31,7 @@ rustPlatform.buildRustPackage {
|
||||||
--fish <("$out/bin/catwalk" completion fish)
|
--fish <("$out/bin/catwalk" completion fish)
|
||||||
'';
|
'';
|
||||||
|
|
||||||
doInstallCheck = !stdenv.hostPlatform.isStatic &&
|
doInstallCheck = !stdenv.hostPlatform.isStatic && stdenv.hostPlatform.isElf;
|
||||||
stdenv.hostPlatform.parsed.kernel.execFormat == lib.systems.parse.execFormats.elf;
|
|
||||||
installCheckPhase = ''
|
installCheckPhase = ''
|
||||||
runHook preInstallCheck
|
runHook preInstallCheck
|
||||||
readelf -a $out/bin/catwalk | grep -F 'Shared library: [libwebp.so'
|
readelf -a $out/bin/catwalk | grep -F 'Shared library: [libwebp.so'
|
||||||
|
|
|
@ -109,7 +109,7 @@ let
|
||||||
# there (yet?) so it goes here until then.
|
# there (yet?) so it goes here until then.
|
||||||
preHook = preHook + lib.optionalString buildPlatform.isDarwin ''
|
preHook = preHook + lib.optionalString buildPlatform.isDarwin ''
|
||||||
export NIX_DONT_SET_RPATH_FOR_BUILD=1
|
export NIX_DONT_SET_RPATH_FOR_BUILD=1
|
||||||
'' + lib.optionalString (hostPlatform.isDarwin || (hostPlatform.parsed.kernel.execFormat != lib.systems.parse.execFormats.elf && hostPlatform.parsed.kernel.execFormat != lib.systems.parse.execFormats.macho)) ''
|
'' + lib.optionalString (hostPlatform.isDarwin || (!hostPlatform.isElf && !hostPlatform.isMacho)) ''
|
||||||
export NIX_DONT_SET_RPATH=1
|
export NIX_DONT_SET_RPATH=1
|
||||||
export NIX_NO_SELF_RPATH=1
|
export NIX_NO_SELF_RPATH=1
|
||||||
'' + lib.optionalString (hostPlatform.isDarwin && hostPlatform.isMacOS) ''
|
'' + lib.optionalString (hostPlatform.isDarwin && hostPlatform.isMacOS) ''
|
||||||
|
|
|
@ -21575,10 +21575,7 @@ with pkgs;
|
||||||
mtrace = callPackage ../development/libraries/glibc/mtrace.nix { };
|
mtrace = callPackage ../development/libraries/glibc/mtrace.nix { };
|
||||||
|
|
||||||
# Provided by libc on Operating Systems that use the Extensible Linker Format.
|
# Provided by libc on Operating Systems that use the Extensible Linker Format.
|
||||||
elf-header =
|
elf-header = if stdenv.hostPlatform.isElf then null else elf-header-real;
|
||||||
if stdenv.hostPlatform.parsed.kernel.execFormat.name == "elf"
|
|
||||||
then null
|
|
||||||
else elf-header-real;
|
|
||||||
|
|
||||||
elf-header-real = callPackage ../development/libraries/elf-header { };
|
elf-header-real = callPackage ../development/libraries/elf-header { };
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue