Skip to content

apple_sdk_11_0: make available for use on x86_64-darwin #176661

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jul 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions doc/stdenv/platform-notes.chapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
4 changes: 2 additions & 2 deletions pkgs/os-specific/darwin/apple-sdk-11.0/apple_sdk.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
33 changes: 32 additions & 1 deletion pkgs/os-specific/darwin/apple-sdk-11.0/default.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{ stdenvNoCC, fetchurl, newScope, pkgs
{ stdenvNoCC, fetchurl, newScope, lib, pkgs
, stdenv, overrideCC
, xar, cpio, python3, pbzx }:

let
Expand Down Expand Up @@ -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
2 changes: 1 addition & 1 deletion pkgs/top-level/darwin-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [];
Expand Down