build2: use lld from llvm 16 to link on darwin

+26
+10
pkgs/development/tools/build-managers/build2/bootstrap.nix
··· 1 1 { lib, stdenv 2 2 , fetchurl 3 3 , pkgs 4 + , buildPackages 4 5 , fixDarwinDylibNames 5 6 }: 6 7 stdenv.mkDerivation rec { ··· 25 26 26 27 propagatedBuildInputs = lib.optionals stdenv.targetPlatform.isDarwin [ 27 28 fixDarwinDylibNames 29 + 30 + # Build2 needs to use lld on Darwin because it creates thin archives when it detects `llvm-ar`, 31 + # which ld64 does not support. 32 + (lib.getBin buildPackages.llvmPackages_16.lld) 28 33 ]; 29 34 30 35 doCheck = true; ··· 38 43 runHook preInstall 39 44 install -D build2/b-boot $out/bin/b 40 45 runHook postInstall 46 + ''; 47 + 48 + postFixup = '' 49 + substituteInPlace $out/nix-support/setup-hook \ 50 + --subst-var-by isTargetDarwin '${toString stdenv.targetPlatform.isDarwin}' 41 51 ''; 42 52 43 53 inherit (pkgs.build2) passthru;
+10
pkgs/development/tools/build-managers/build2/default.nix
··· 4 4 , fixDarwinDylibNames 5 5 , libbutl 6 6 , libpkgconf 7 + , buildPackages 7 8 , enableShared ? !stdenv.hostPlatform.isStatic 8 9 , enableStatic ? !enableShared 9 10 }: ··· 57 58 # LC_LOAD_DYLIB entries containing @rpath, requiring manual fixup 58 59 propagatedBuildInputs = lib.optionals stdenv.targetPlatform.isDarwin [ 59 60 fixDarwinDylibNames 61 + 62 + # Build2 needs to use lld on Darwin because it creates thin archives when it detects `llvm-ar`, 63 + # which ld64 does not support. 64 + (lib.getBin buildPackages.llvmPackages_16.lld) 60 65 ]; 61 66 62 67 postPatch = '' ··· 71 76 72 77 postInstall = lib.optionalString stdenv.isDarwin '' 73 78 install_name_tool -add_rpath "''${!outputLib}/lib" "''${!outputBin}/bin/b" 79 + ''; 80 + 81 + postFixup = '' 82 + substituteInPlace $dev/nix-support/setup-hook \ 83 + --subst-var-by isTargetDarwin '${toString stdenv.targetPlatform.isDarwin}' 74 84 ''; 75 85 76 86 passthru = {
+6
pkgs/development/tools/build-managers/build2/setup-hook.sh
··· 19 19 $build2ConfigureFlags "${build2ConfigureFlagsArray[@]}" 20 20 ) 21 21 22 + if [ -n "@isTargetDarwin@" ]; then 23 + flagsArray+=("config.bin.ld=ld64-lld") 24 + flagsArray+=("config.cc.loptions+=-fuse-ld=lld") 25 + flagsArray+=("config.cc.loptions+=-headerpad_max_install_names") 26 + fi 27 + 22 28 echo 'configure flags' "${flagsArray[@]}" 23 29 24 30 b configure "${flagsArray[@]}"