Loading pkgs/build-support/cc-wrapper/default.nix +2 −6 Original line number Diff line number Diff line Loading @@ -53,10 +53,6 @@ , gccForLibs ? if useCcForLibs then cc else null , fortify-headers ? null , includeFortifyHeaders ? null # https://github.com/NixOS/nixpkgs/issues/295322 # should -march flag be used , disableMarch ? false }: assert nativeTools -> !propagateDoc && nativePrefix != ""; Loading Loading @@ -633,7 +629,7 @@ stdenv.mkDerivation { # TODO: aarch64-darwin has mcpu incompatible with gcc + optionalString ((targetPlatform ? gcc.arch) && !isClang && !(stdenv.isDarwin && stdenv.isAarch64) && isGccArchSupported targetPlatform.gcc.arch && !disableMarch) '' isGccArchSupported targetPlatform.gcc.arch) '' echo "-march=${targetPlatform.gcc.arch}" >> $out/nix-support/cc-cflags-before '' Loading Loading @@ -729,7 +725,7 @@ stdenv.mkDerivation { + optionalString isClang '' # Escape twice: once for this script, once for the one it gets substituted into. export march=${escapeShellArg (optionalString (targetPlatform ? gcc.arch && !disableMarch) (optionalString (targetPlatform ? gcc.arch) (escapeShellArg "-march=${targetPlatform.gcc.arch}"))} export defaultTarget=${targetPlatform.config} substituteAll ${./add-clang-cc-cflags-before.sh} $out/nix-support/add-local-cc-cflags-before.sh Loading pkgs/development/compilers/swift/default.nix +3 −7 Original line number Diff line number Diff line Loading @@ -25,13 +25,9 @@ let # # The following selects the correct Clang version, matching the version # used in Swift, and applies the same libc overrides as `apple_sdk.stdenv`. clang = let # https://github.com/NixOS/nixpkgs/issues/295322 clangNoMarch = swiftLlvmPackages.clang.override { disableMarch = true; }; in if pkgs.stdenv.isDarwin clang = if pkgs.stdenv.isDarwin then clangNoMarch.override rec { swiftLlvmPackages.clang.override rec { libc = apple_sdk.Libsystem; bintools = pkgs.bintools.override { inherit libc; }; # Ensure that Swift’s internal clang uses the same libc++ and libc++abi as the Loading @@ -41,7 +37,7 @@ let inherit (llvmPackages) libcxx; } else clangNoMarch; swiftLlvmPackages.clang; # Overrides that create a useful environment for swift packages, allowing # packaging with `swiftPackages.callPackage`. These are similar to Loading pkgs/development/compilers/swift/wrapper/wrapper.sh +14 −5 Original line number Diff line number Diff line Loading @@ -242,17 +242,26 @@ if [[ -e $cc_wrapper/nix-support/add-local-cc-cflags-before.sh ]]; then source $cc_wrapper/nix-support/add-local-cc-cflags-before.sh fi # May need to transform the triple injected by the above. for ((i = 1; i < ${#extraBefore[@]}; i++)); do if [[ "${extraBefore[i]}" = -target ]]; then for ((i=0; i < ${#extraBefore[@]}; i++));do case "${extraBefore[i]}" in -target) i=$((i + 1)) # On Darwin only, need to change 'aarch64' to 'arm64'. extraBefore[i]="${extraBefore[i]/aarch64-apple-/arm64-apple-}" # On Darwin, Swift requires the triple to be annotated with a version. # TODO: Assumes macOS. extraBefore[i]="${extraBefore[i]/-apple-darwin/-apple-macosx${MACOSX_DEPLOYMENT_TARGET:-11.0}}" break fi ;; -march=*) [[ i -gt 0 && ${extraBefore[i-1]} == -Xcc ]] && continue extraBefore=( "${extraBefore[@]:0:i}" -Xcc "${extraBefore[@]:i:${#extraBefore[@]}}" ) i=$((i + 1)) ;; esac done # As a very special hack, if the arguments are just `-v', then don't Loading Loading
pkgs/build-support/cc-wrapper/default.nix +2 −6 Original line number Diff line number Diff line Loading @@ -53,10 +53,6 @@ , gccForLibs ? if useCcForLibs then cc else null , fortify-headers ? null , includeFortifyHeaders ? null # https://github.com/NixOS/nixpkgs/issues/295322 # should -march flag be used , disableMarch ? false }: assert nativeTools -> !propagateDoc && nativePrefix != ""; Loading Loading @@ -633,7 +629,7 @@ stdenv.mkDerivation { # TODO: aarch64-darwin has mcpu incompatible with gcc + optionalString ((targetPlatform ? gcc.arch) && !isClang && !(stdenv.isDarwin && stdenv.isAarch64) && isGccArchSupported targetPlatform.gcc.arch && !disableMarch) '' isGccArchSupported targetPlatform.gcc.arch) '' echo "-march=${targetPlatform.gcc.arch}" >> $out/nix-support/cc-cflags-before '' Loading Loading @@ -729,7 +725,7 @@ stdenv.mkDerivation { + optionalString isClang '' # Escape twice: once for this script, once for the one it gets substituted into. export march=${escapeShellArg (optionalString (targetPlatform ? gcc.arch && !disableMarch) (optionalString (targetPlatform ? gcc.arch) (escapeShellArg "-march=${targetPlatform.gcc.arch}"))} export defaultTarget=${targetPlatform.config} substituteAll ${./add-clang-cc-cflags-before.sh} $out/nix-support/add-local-cc-cflags-before.sh Loading
pkgs/development/compilers/swift/default.nix +3 −7 Original line number Diff line number Diff line Loading @@ -25,13 +25,9 @@ let # # The following selects the correct Clang version, matching the version # used in Swift, and applies the same libc overrides as `apple_sdk.stdenv`. clang = let # https://github.com/NixOS/nixpkgs/issues/295322 clangNoMarch = swiftLlvmPackages.clang.override { disableMarch = true; }; in if pkgs.stdenv.isDarwin clang = if pkgs.stdenv.isDarwin then clangNoMarch.override rec { swiftLlvmPackages.clang.override rec { libc = apple_sdk.Libsystem; bintools = pkgs.bintools.override { inherit libc; }; # Ensure that Swift’s internal clang uses the same libc++ and libc++abi as the Loading @@ -41,7 +37,7 @@ let inherit (llvmPackages) libcxx; } else clangNoMarch; swiftLlvmPackages.clang; # Overrides that create a useful environment for swift packages, allowing # packaging with `swiftPackages.callPackage`. These are similar to Loading
pkgs/development/compilers/swift/wrapper/wrapper.sh +14 −5 Original line number Diff line number Diff line Loading @@ -242,17 +242,26 @@ if [[ -e $cc_wrapper/nix-support/add-local-cc-cflags-before.sh ]]; then source $cc_wrapper/nix-support/add-local-cc-cflags-before.sh fi # May need to transform the triple injected by the above. for ((i = 1; i < ${#extraBefore[@]}; i++)); do if [[ "${extraBefore[i]}" = -target ]]; then for ((i=0; i < ${#extraBefore[@]}; i++));do case "${extraBefore[i]}" in -target) i=$((i + 1)) # On Darwin only, need to change 'aarch64' to 'arm64'. extraBefore[i]="${extraBefore[i]/aarch64-apple-/arm64-apple-}" # On Darwin, Swift requires the triple to be annotated with a version. # TODO: Assumes macOS. extraBefore[i]="${extraBefore[i]/-apple-darwin/-apple-macosx${MACOSX_DEPLOYMENT_TARGET:-11.0}}" break fi ;; -march=*) [[ i -gt 0 && ${extraBefore[i-1]} == -Xcc ]] && continue extraBefore=( "${extraBefore[@]:0:i}" -Xcc "${extraBefore[@]:i:${#extraBefore[@]}}" ) i=$((i + 1)) ;; esac done # As a very special hack, if the arguments are just `-v', then don't Loading