Skip to content

Commit

Permalink
swiftpm: use darwinMinVersionHook to set the deployment target
Browse files Browse the repository at this point in the history
  • Loading branch information
reckenrode committed Oct 6, 2024
1 parent 59861bb commit 01991c1
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions pkgs/development/compilers/swift/swiftpm/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
, makeWrapper
, DarwinTools # sw_vers
, cctools # vtool
, darwinMinVersionHook
, xcbuild
, CryptoKit
, LocalAuthentication
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand All @@ -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
'';

Expand Down

0 comments on commit 01991c1

Please sign in to comment.