treewide: simplify exec format conditionals

+16 -26
+2 -2
pkgs/build-support/alternatives/blas/default.nix
··· 80 cp -L "$libblas" $out/lib/libblas${canonicalExtension} 81 chmod +w $out/lib/libblas${canonicalExtension} 82 83 - '' + (if stdenv.hostPlatform.parsed.kernel.execFormat.name == "elf" then '' 84 patchelf --set-soname libblas${canonicalExtension} $out/lib/libblas${canonicalExtension} 85 patchelf --set-rpath "$(patchelf --print-rpath $out/lib/libblas${canonicalExtension}):${lib.getLib blasProvider'}/lib" $out/lib/libblas${canonicalExtension} 86 '' else lib.optionalString (stdenv.hostPlatform.isDarwin) '' ··· 112 cp -L "$libcblas" $out/lib/libcblas${canonicalExtension} 113 chmod +w $out/lib/libcblas${canonicalExtension} 114 115 - '' + (if stdenv.hostPlatform.parsed.kernel.execFormat.name == "elf" then '' 116 patchelf --set-soname libcblas${canonicalExtension} $out/lib/libcblas${canonicalExtension} 117 patchelf --set-rpath "$(patchelf --print-rpath $out/lib/libcblas${canonicalExtension}):${lib.getLib blasProvider'}/lib" $out/lib/libcblas${canonicalExtension} 118 '' else lib.optionalString stdenv.hostPlatform.isDarwin ''
··· 80 cp -L "$libblas" $out/lib/libblas${canonicalExtension} 81 chmod +w $out/lib/libblas${canonicalExtension} 82 83 + '' + (if stdenv.hostPlatform.isElf then '' 84 patchelf --set-soname libblas${canonicalExtension} $out/lib/libblas${canonicalExtension} 85 patchelf --set-rpath "$(patchelf --print-rpath $out/lib/libblas${canonicalExtension}):${lib.getLib blasProvider'}/lib" $out/lib/libblas${canonicalExtension} 86 '' else lib.optionalString (stdenv.hostPlatform.isDarwin) '' ··· 112 cp -L "$libcblas" $out/lib/libcblas${canonicalExtension} 113 chmod +w $out/lib/libcblas${canonicalExtension} 114 115 + '' + (if stdenv.hostPlatform.isElf then '' 116 patchelf --set-soname libcblas${canonicalExtension} $out/lib/libcblas${canonicalExtension} 117 patchelf --set-rpath "$(patchelf --print-rpath $out/lib/libcblas${canonicalExtension}):${lib.getLib blasProvider'}/lib" $out/lib/libcblas${canonicalExtension} 118 '' else lib.optionalString stdenv.hostPlatform.isDarwin ''
+2 -2
pkgs/build-support/alternatives/lapack/default.nix
··· 57 cp -L "$liblapack" $out/lib/liblapack${canonicalExtension} 58 chmod +w $out/lib/liblapack${canonicalExtension} 59 60 - '' + (lib.optionalString (stdenv.hostPlatform.parsed.kernel.execFormat.name == "elf") '' 61 patchelf --set-soname liblapack${canonicalExtension} $out/lib/liblapack${canonicalExtension} 62 patchelf --set-rpath "$(patchelf --print-rpath $out/lib/liblapack${canonicalExtension}):${lapackProvider'}/lib" $out/lib/liblapack${canonicalExtension} 63 '') + '' ··· 86 cp -L "$liblapacke" $out/lib/liblapacke${canonicalExtension} 87 chmod +w $out/lib/liblapacke${canonicalExtension} 88 89 - '' + (lib.optionalString (stdenv.hostPlatform.parsed.kernel.execFormat.name == "elf") '' 90 patchelf --set-soname liblapacke${canonicalExtension} $out/lib/liblapacke${canonicalExtension} 91 patchelf --set-rpath "$(patchelf --print-rpath $out/lib/liblapacke${canonicalExtension}):${lib.getLib lapackProvider'}/lib" $out/lib/liblapacke${canonicalExtension} 92 '') + ''
··· 57 cp -L "$liblapack" $out/lib/liblapack${canonicalExtension} 58 chmod +w $out/lib/liblapack${canonicalExtension} 59 60 + '' + (lib.optionalString stdenv.hostPlatform.isElf '' 61 patchelf --set-soname liblapack${canonicalExtension} $out/lib/liblapack${canonicalExtension} 62 patchelf --set-rpath "$(patchelf --print-rpath $out/lib/liblapack${canonicalExtension}):${lapackProvider'}/lib" $out/lib/liblapack${canonicalExtension} 63 '') + '' ··· 86 cp -L "$liblapacke" $out/lib/liblapacke${canonicalExtension} 87 chmod +w $out/lib/liblapacke${canonicalExtension} 88 89 + '' + (lib.optionalString stdenv.hostPlatform.isElf '' 90 patchelf --set-soname liblapacke${canonicalExtension} $out/lib/liblapacke${canonicalExtension} 91 patchelf --set-rpath "$(patchelf --print-rpath $out/lib/liblapacke${canonicalExtension}):${lib.getLib lapackProvider'}/lib" $out/lib/liblapacke${canonicalExtension} 92 '') + ''
+1 -2
pkgs/development/compilers/rust/cargo.nix
··· 98 # Disable check phase as there are failures (4 tests fail) 99 doCheck = false; 100 101 - doInstallCheck = !stdenv.hostPlatform.isStatic && 102 - stdenv.hostPlatform.parsed.kernel.execFormat == lib.systems.parse.execFormats.elf; 103 installCheckPhase = '' 104 runHook preInstallCheck 105 readelf -a $out/bin/.cargo-wrapped | grep -F 'Shared library: [libcurl.so'
··· 98 # Disable check phase as there are failures (4 tests fail) 99 doCheck = false; 100 101 + doInstallCheck = !stdenv.hostPlatform.isStatic && stdenv.hostPlatform.isElf; 102 installCheckPhase = '' 103 runHook preInstallCheck 104 readelf -a $out/bin/.cargo-wrapped | grep -F 'Shared library: [libcurl.so'
+1 -2
pkgs/development/libraries/boost/generic.nix
··· 73 else if stdenv.hostPlatform.parsed.cpu.name == "s390x" then "s390x" 74 else toString stdenv.hostPlatform.parsed.cpu.family}" 75 # env in host triplet for Mach-O is "macho", but boost binary format for Mach-O is "mach-o" 76 - "binary-format=${if stdenv.hostPlatform.parsed.kernel.execFormat == lib.systems.parse.execFormats.macho 77 - then "mach-o" 78 else toString stdenv.hostPlatform.parsed.kernel.execFormat.name}" 79 "target-os=${toString stdenv.hostPlatform.parsed.kernel.name}" 80
··· 73 else if stdenv.hostPlatform.parsed.cpu.name == "s390x" then "s390x" 74 else toString stdenv.hostPlatform.parsed.cpu.family}" 75 # env in host triplet for Mach-O is "macho", but boost binary format for Mach-O is "mach-o" 76 + "binary-format=${if stdenv.hostPlatform.isMacho then "mach-o" 77 else toString stdenv.hostPlatform.parsed.kernel.execFormat.name}" 78 "target-os=${toString stdenv.hostPlatform.parsed.kernel.name}" 79
+1 -1
pkgs/development/libraries/gstreamer/rs/default.nix
··· 234 ''; 235 236 doInstallCheck = (lib.elem "webp" selectedPlugins) && !stdenv.hostPlatform.isStatic && 237 - stdenv.hostPlatform.parsed.kernel.execFormat == lib.systems.parse.execFormats.elf; 238 installCheckPhase = '' 239 runHook preInstallCheck 240 readelf -a $out/lib/gstreamer-1.0/libgstrswebp.so | grep -F 'Shared library: [libwebpdemux.so'
··· 234 ''; 235 236 doInstallCheck = (lib.elem "webp" selectedPlugins) && !stdenv.hostPlatform.isStatic && 237 + stdenv.hostPlatform.isElf; 238 installCheckPhase = '' 239 runHook preInstallCheck 240 readelf -a $out/lib/gstreamer-1.0/libgstrswebp.so | grep -F 'Shared library: [libwebpdemux.so'
+1 -1
pkgs/development/libraries/openssl/default.nix
··· 93 else if stdenv.hostPlatform.isBSD 94 then if stdenv.hostPlatform.isx86_64 then "./Configure BSD-x86_64" 95 else if stdenv.hostPlatform.isx86_32 96 - then "./Configure BSD-x86" + lib.optionalString (stdenv.hostPlatform.parsed.kernel.execFormat.name == "elf") "-elf" 97 else "./Configure BSD-generic${toString stdenv.hostPlatform.parsed.cpu.bits}" 98 else if stdenv.hostPlatform.isMinGW 99 then "./Configure mingw${lib.optionalString
··· 93 else if stdenv.hostPlatform.isBSD 94 then if stdenv.hostPlatform.isx86_64 then "./Configure BSD-x86_64" 95 else if stdenv.hostPlatform.isx86_32 96 + then "./Configure BSD-x86" + lib.optionalString stdenv.hostPlatform.isElf "-elf" 97 else "./Configure BSD-generic${toString stdenv.hostPlatform.parsed.cpu.bits}" 98 else if stdenv.hostPlatform.isMinGW 99 then "./Configure mingw${lib.optionalString
+1 -1
pkgs/development/libraries/quictls/default.nix
··· 90 else if stdenv.hostPlatform.isBSD && stdenv.hostPlatform.isx86_64 91 then "./Configure BSD-x86_64" 92 else if stdenv.hostPlatform.isBSD && stdenv.hostPlatform.isx86_32 93 - then "./Configure BSD-x86" + lib.optionalString (stdenv.hostPlatform.parsed.kernel.execFormat.name == "elf") "-elf" 94 else if stdenv.hostPlatform.isBSD 95 then "./Configure BSD-generic${toString stdenv.hostPlatform.parsed.cpu.bits}" 96 else if stdenv.hostPlatform.isMinGW
··· 90 else if stdenv.hostPlatform.isBSD && stdenv.hostPlatform.isx86_64 91 then "./Configure BSD-x86_64" 92 else if stdenv.hostPlatform.isBSD && stdenv.hostPlatform.isx86_32 93 + then "./Configure BSD-x86" + lib.optionalString stdenv.hostPlatform.isElf "-elf" 94 else if stdenv.hostPlatform.isBSD 95 then "./Configure BSD-generic${toString stdenv.hostPlatform.parsed.cpu.bits}" 96 else if stdenv.hostPlatform.isMinGW
+1 -1
pkgs/development/python-modules/glean-sdk/default.nix
··· 66 "test_flipping_upload_enabled_respects_order_of_events" 67 ]; 68 69 - postInstallCheck = lib.optionalString (stdenv.hostPlatform.parsed.kernel.execFormat == lib.systems.parse.execFormats.elf) '' 70 readelf -a $out/${python.sitePackages}/glean/libglean_ffi.so | grep -F 'Shared library: [liblmdb.so' 71 ''; 72
··· 66 "test_flipping_upload_enabled_respects_order_of_events" 67 ]; 68 69 + postInstallCheck = lib.optionalString stdenv.hostPlatform.isElf '' 70 readelf -a $out/${python.sitePackages}/glean/libglean_ffi.so | grep -F 'Shared library: [liblmdb.so' 71 ''; 72
+2 -6
pkgs/development/tools/misc/binutils/2.38/default.nix
··· 1 - let 2 - execFormatIsELF = platform: platform.parsed.kernel.execFormat.name == "elf"; 3 - in 4 - 5 { stdenv 6 , autoreconfHook 7 , autoconf269, automake, libtool ··· 18 , texinfo 19 , zlib 20 21 - , enableGold ? execFormatIsELF stdenv.targetPlatform 22 , enableShared ? !stdenv.hostPlatform.isStatic 23 # WARN: Enabling all targets increases output size to a multiple. 24 , withAllTargets ? false ··· 26 27 # WARN: configure silently disables ld.gold if it's unsupported, so we need to 28 # make sure that intent matches result ourselves. 29 - assert enableGold -> execFormatIsELF stdenv.targetPlatform; 30 31 32 let
··· 1 { stdenv 2 , autoreconfHook 3 , autoconf269, automake, libtool ··· 14 , texinfo 15 , zlib 16 17 + , enableGold ? stdenv.targetPlatform.isElf 18 , enableShared ? !stdenv.hostPlatform.isStatic 19 # WARN: Enabling all targets increases output size to a multiple. 20 , withAllTargets ? false ··· 22 23 # WARN: configure silently disables ld.gold if it's unsupported, so we need to 24 # make sure that intent matches result ourselves. 25 + assert enableGold -> stdenv.targetPlatform.isElf; 26 27 28 let
+1 -1
pkgs/development/tools/misc/binutils/default.nix
··· 1 let 2 - withGold = platform: platform.parsed.kernel.execFormat.name == "elf" && !platform.isRiscV && !platform.isLoongArch64; 3 in 4 5 { stdenv
··· 1 let 2 + withGold = platform: platform.isElf && !platform.isRiscV && !platform.isLoongArch64; 3 in 4 5 { stdenv
+1 -2
pkgs/development/tools/misc/catppuccin-catwalk/default.nix
··· 31 --fish <("$out/bin/catwalk" completion fish) 32 ''; 33 34 - doInstallCheck = !stdenv.hostPlatform.isStatic && 35 - stdenv.hostPlatform.parsed.kernel.execFormat == lib.systems.parse.execFormats.elf; 36 installCheckPhase = '' 37 runHook preInstallCheck 38 readelf -a $out/bin/catwalk | grep -F 'Shared library: [libwebp.so'
··· 31 --fish <("$out/bin/catwalk" completion fish) 32 ''; 33 34 + doInstallCheck = !stdenv.hostPlatform.isStatic && stdenv.hostPlatform.isElf; 35 installCheckPhase = '' 36 runHook preInstallCheck 37 readelf -a $out/bin/catwalk | grep -F 'Shared library: [libwebp.so'
+1 -1
pkgs/stdenv/generic/default.nix
··· 109 # there (yet?) so it goes here until then. 110 preHook = preHook + lib.optionalString buildPlatform.isDarwin '' 111 export NIX_DONT_SET_RPATH_FOR_BUILD=1 112 - '' + lib.optionalString (hostPlatform.isDarwin || (hostPlatform.parsed.kernel.execFormat != lib.systems.parse.execFormats.elf && hostPlatform.parsed.kernel.execFormat != lib.systems.parse.execFormats.macho)) '' 113 export NIX_DONT_SET_RPATH=1 114 export NIX_NO_SELF_RPATH=1 115 '' + lib.optionalString (hostPlatform.isDarwin && hostPlatform.isMacOS) ''
··· 109 # there (yet?) so it goes here until then. 110 preHook = preHook + lib.optionalString buildPlatform.isDarwin '' 111 export NIX_DONT_SET_RPATH_FOR_BUILD=1 112 + '' + lib.optionalString (hostPlatform.isDarwin || (!hostPlatform.isElf && !hostPlatform.isMacho)) '' 113 export NIX_DONT_SET_RPATH=1 114 export NIX_NO_SELF_RPATH=1 115 '' + lib.optionalString (hostPlatform.isDarwin && hostPlatform.isMacOS) ''
+1 -4
pkgs/top-level/all-packages.nix
··· 21575 mtrace = callPackage ../development/libraries/glibc/mtrace.nix { }; 21576 21577 # Provided by libc on Operating Systems that use the Extensible Linker Format. 21578 - elf-header = 21579 - if stdenv.hostPlatform.parsed.kernel.execFormat.name == "elf" 21580 - then null 21581 - else elf-header-real; 21582 21583 elf-header-real = callPackage ../development/libraries/elf-header { }; 21584
··· 21575 mtrace = callPackage ../development/libraries/glibc/mtrace.nix { }; 21576 21577 # Provided by libc on Operating Systems that use the Extensible Linker Format. 21578 + elf-header = if stdenv.hostPlatform.isElf then null else elf-header-real; 21579 21580 elf-header-real = callPackage ../development/libraries/elf-header { }; 21581