lol

binutils: fix build on Darwin

- Update Darwin version check patch; and
- Use CoreServices when building on Darwin.

+22 -38
+14 -37
pkgs/development/tools/misc/binutils/0001-libtool.m4-update-macos-version-detection-block.patch
··· 1 - From 33a8dc728eb5da3e1d3439c96810d1f6b2660b89 Mon Sep 17 00:00:00 2001 2 - From: Andrew Childs <andrew.childs@bibo.com.ph> 3 - Date: Tue, 22 Feb 2022 12:24:46 +0900 1 + From 368f26bfece3899a8c992cfec66427266918ab80 Mon Sep 17 00:00:00 2001 2 + From: Randy Eckenrode <randy@largeandhighquality.com> 3 + Date: Thu, 4 Jul 2024 12:20:34 -0400 4 4 Subject: [PATCH] libtool.m4: update macos version detection block 5 5 6 - Includes upstream change 7 - 9e8c882517082fe5755f2524d23efb02f1522490 8 6 --- 9 - libtool.m4 | 21 ++++++++------------- 10 - 1 file changed, 8 insertions(+), 13 deletions(-) 7 + libtool.m4 | 1 + 8 + 1 file changed, 1 insertion(+) 11 9 12 10 diff --git a/libtool.m4 b/libtool.m4 13 - index 7a711249304..f452efb4300 100644 11 + index e36fdd3c0e2..dd4725f8cd1 100644 14 12 --- a/libtool.m4 15 13 +++ b/libtool.m4 16 - @@ -996,20 +996,15 @@ _LT_EOF 17 - ]) 18 - case $host_os in 19 - rhapsody* | darwin1.[[012]]) 20 - - _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; 21 - + _lt_dar_allow_undefined='$wl-undefined ${wl}suppress' ;; 22 - darwin1.*) 23 - - _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; 24 - - darwin*) # darwin 5.x on 25 - - # if running on 10.5 or later, the deployment target defaults 26 - - # to the OS version, if on x86, and 10.4, the deployment 27 - - # target defaults to 10.4. Don't you love it? 28 - - case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in 29 - - 10.0,*86*-darwin8*|10.0,*-darwin[[91]]*) 30 - - _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; 31 - - 10.[[012]][[,.]]*) 32 - - _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; 33 - - 10.*) 34 - - _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; 35 - + _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; 36 - + darwin*) 37 - + case $MACOSX_DEPLOYMENT_TARGET,$host in 38 - + 10.[[012]],*|,*powerpc*-darwin[[5-8]]*) 39 - + _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; 40 - + *) 41 - + _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; 42 - esac 14 + @@ -1011,6 +1011,7 @@ _LT_EOF 15 + _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' 16 + ;; 17 + *) 18 + + _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}dynamic_lookup' 19 + ;; 20 + esac 43 21 ;; 44 - esac 45 22 -- 46 - 2.34.1 23 + 2.45.1 47 24
+6 -1
pkgs/development/tools/misc/binutils/default.nix
··· 16 16 , perl 17 17 , substitute 18 18 , zlib 19 + , CoreServices 19 20 20 21 , enableGold ? withGold stdenv.targetPlatform 21 22 , enableGoldDefault ? false ··· 87 88 # not need to know binutils' BINDIR at all. It's an absolute path 88 89 # where libraries are stored. 89 90 ./plugins-no-BINDIR.patch 91 + 92 + # ld64 needs `-undefined dynamic_lookup` to link `libctf-nobfd.dylib`, but the Darwin 93 + # version detection in `libtool.m4` fails to detect the Darwin version correctly. 94 + ./0001-libtool.m4-update-macos-version-detection-block.patch 90 95 ] 91 96 ++ lib.optional targetPlatform.isiOS ./support-ios.patch 92 97 # Adds AVR-specific options to "size" for compatibility with Atmel's downstream distribution ··· 120 125 ++ lib.optionals targetPlatform.isVc4 [ flex ] 121 126 ; 122 127 123 - buildInputs = [ zlib gettext ]; 128 + buildInputs = [ zlib gettext ] ++ lib.optionals buildPlatform.isDarwin [ CoreServices ]; 124 129 125 130 inherit noSysDirs; 126 131
+2
pkgs/top-level/all-packages.nix
··· 17968 17968 17969 17969 binutils-unwrapped = callPackage ../development/tools/misc/binutils { 17970 17970 autoreconfHook = autoreconfHook269; 17971 + inherit (darwin.apple_sdk.frameworks) CoreServices; 17971 17972 # FHS sys dirs presumably only have stuff for the build platform 17972 17973 noSysDirs = (stdenv.targetPlatform != stdenv.hostPlatform) || noSysDirs; 17973 17974 }; 17974 17975 binutils-unwrapped-all-targets = callPackage ../development/tools/misc/binutils { 17975 17976 autoreconfHook = if targetPlatform.isiOS then autoreconfHook269 else autoreconfHook; 17977 + inherit (darwin.apple_sdk.frameworks) CoreServices; 17976 17978 # FHS sys dirs presumably only have stuff for the build platform 17977 17979 noSysDirs = (stdenv.targetPlatform != stdenv.hostPlatform) || noSysDirs; 17978 17980 withAllTargets = true;