From f4af7eacc4e7dc7f969d09f43f62a9c1910c7cca Mon Sep 17 00:00:00 2001 From: Randy Eckenrode Date: Wed, 25 Sep 2024 21:47:47 -0400 Subject: [PATCH] swiftpm: use darwinMinVersionHook to set the deployment target --- .../compilers/swift/swiftpm/default.nix | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/pkgs/development/compilers/swift/swiftpm/default.nix b/pkgs/development/compilers/swift/swiftpm/default.nix index b8d8d2fe7bba3..48718527965c9 100644 --- a/pkgs/development/compilers/swift/swiftpm/default.nix +++ b/pkgs/development/compilers/swift/swiftpm/default.nix @@ -17,6 +17,7 @@ , makeWrapper , DarwinTools # sw_vers , cctools # vtool +, darwinMinVersionHook , xcbuild , CryptoKit , LocalAuthentication @@ -113,13 +114,6 @@ let fi ''; - preConfigure = (attrs.preConfigure or "") - + '' - # Builds often don't set a target, and our default minimum macOS deployment - # target on x86_64-darwin is too low. Harmless on non-Darwin. - export MACOSX_DEPLOYMENT_TARGET=10.15.4 - ''; - postInstall = (attrs.postInstall or "") + lib.optionalString stdenv.hostPlatform.isDarwin '' # The install name of libraries is incorrectly set to lib/ (via our @@ -362,7 +356,7 @@ let swift-driver swift-system swift-tools-support-core - ]; + ] ++ lib.optionals stdenv.isDarwin [ (darwinMinVersionHook "10.15.4") ]; cmakeFlags = [ "-DUSE_CMAKE_INSTALL=ON" @@ -392,7 +386,7 @@ in stdenv.mkDerivation (commonAttrs // { ++ lib.optionals stdenv.hostPlatform.isDarwin [ CryptoKit LocalAuthentication - ]; + ] ++ lib.optionals stdenv.isDarwin [ (darwinMinVersionHook "10.15.4") ]; configurePhase = generated.configure + '' # Functionality provided by Xcode XCTest, but not available in @@ -411,9 +405,6 @@ in stdenv.mkDerivation (commonAttrs // { ''; buildPhase = '' - # Required to link with swift-corelibs-xctest on Darwin. - export SWIFTTSC_MACOS_DEPLOYMENT_TARGET=10.12 - TERM=dumb swift-build -c release '';