From 8b59d52ca3b6157f4cac333e6576c76f1fa546e8 Mon Sep 17 00:00:00 2001 From: Andrew Childs Date: Fri, 5 Mar 2021 17:34:46 +0900 Subject: [PATCH] cc-wrapper: use legacy -mmacosx-version-min for gcc See https://github.com/NixOS/nixpkgs/pull/105026#discussion_r587169144 --- pkgs/build-support/cc-wrapper/default.nix | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/pkgs/build-support/cc-wrapper/default.nix b/pkgs/build-support/cc-wrapper/default.nix index 91d83424901..3d2a142c36d 100644 --- a/pkgs/build-support/cc-wrapper/default.nix +++ b/pkgs/build-support/cc-wrapper/default.nix @@ -485,10 +485,15 @@ stdenv.mkDerivation { substituteAll ${../wrapper-common/utils.bash} $out/nix-support/utils.bash '' - + optionalString stdenv.targetPlatform.isDarwin '' - echo "-arch ${targetPlatform.darwinArch}" >> $out/nix-support/cc-cflags - echo "-m${targetPlatform.darwinPlatform}-version-min=${targetPlatform.darwinMinVersion}" >> $out/nix-support/cc-cflags-before - '' + + optionalString stdenv.targetPlatform.isDarwin ( + let darwinPlatformForCC = + if (targetPlatform.darwinPlatform == "macos" && isGNU) then "macosx" + else targetPlatform.darwinPlatform; + in '' + echo "-arch ${targetPlatform.darwinArch}" >> $out/nix-support/cc-cflags + echo "-m${darwinPlatformForCC}-version-min=${targetPlatform.darwinMinVersion}" >> $out/nix-support/cc-cflags-before + '' + ) ## ## Extra custom steps