Merge pull request #176661 from reckenrode/apple-sdk-11-x86_64

apple_sdk_11_0: make available for use on x86_64-darwin
This commit is contained in:
toonn 2022-07-08 12:28:51 +02:00 committed by GitHub
commit 80ffac4097
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 40 additions and 4 deletions

View File

@ -60,3 +60,8 @@ Some common issues when packaging software for Darwin:
```
The package `xcbuild` can be used to build projects that really depend on Xcode. However, this replacement is not 100% compatible with Xcode and can occasionally cause issues.
- x86_64-darwin uses the 10.12 SDK by default, but some software is not compatible with that version of the SDK. In that case,
the 11.0 SDK used by aarch64-darwin is available for use on x86_64-darwin. To use it, reference `apple_sdk_11_0` instead of
`apple_sdk` in your derivation and use `pkgs.darwin.apple_sdk_11_0.callPackage` instead of `pkgs.callPackage`. On Linux, this will
have the same effect as `pkgs.callPackage`, so you can use `pkgs.darwin.apple_sdk_11_0.callPackage` regardless of platform.

View File

@ -168,8 +168,8 @@ in rec {
bareFrameworks = (
lib.mapAttrs framework (import ./frameworks.nix {
inherit frameworks libs;
inherit (pkgs.darwin) libobjc Libsystem;
inherit (pkgs.darwin.apple_sdk) libnetwork;
inherit (pkgs.darwin.apple_sdk_11_0) libnetwork Libsystem;
libobjc = pkgs.darwin.apple_sdk_11_0.objc4;
})
) // (
lib.mapAttrs privateFramework (import ./private-frameworks.nix {

View File

@ -1,4 +1,5 @@
{ stdenvNoCC, fetchurl, newScope, pkgs
{ stdenvNoCC, fetchurl, newScope, lib, pkgs
, stdenv, overrideCC
, xar, cpio, python3, pbzx }:
let
@ -54,5 +55,35 @@ let
# questionable aliases
configd = pkgs.darwin.apple_sdk.frameworks.SystemConfiguration;
IOKit = pkgs.darwin.apple_sdk.frameworks.IOKit;
callPackage = newScope (lib.optionalAttrs stdenv.isDarwin rec {
inherit (pkgs.darwin.apple_sdk_11_0) stdenv;
darwin = pkgs.darwin.overrideScope (_: prev: {
inherit (prev.darwin.apple_sdk_11_0) Libsystem LibsystemCross libcharset libunwind objc4 configd IOKit Security;
apple_sdk = prev.darwin.apple_sdk_11_0;
CF = prev.darwin.apple_sdk_11_0.CoreFoundation;
});
xcodebuild = pkgs.xcbuild.override {
inherit (pkgs.darwin.apple_sdk_11_0.frameworks) CoreServices CoreGraphics ImageIO;
inherit stdenv;
};
xcbuild = xcodebuild;
});
stdenv =
let
clang = stdenv.cc.override {
bintools = stdenv.cc.bintools.override { libc = packages.Libsystem; };
libc = packages.Libsystem;
};
in
if stdenv.isAarch64 then stdenv
else
(overrideCC stdenv clang).override {
targetPlatform = stdenv.targetPlatform // {
darwinMinVersion = "10.12";
darwinSdkVersion = "11.0";
};
};
};
in packages

View File

@ -70,7 +70,7 @@ in
impure-cmds // appleSourcePackages // chooseLibs // {
inherit apple_sdk;
inherit apple_sdk apple_sdk_10_12 apple_sdk_11_0;
stdenvNoCF = stdenv.override {
extraBuildInputs = [];