Skip to content
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

darwin: change the SDK pattern, update the SDKs, and update source releases #346043

Merged
merged 157 commits into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
157 commits
Select commit Hold shift + click to select a range
22369ef
maintainers/team-list.nix: add reckenrode to darwin
reckenrode Aug 11, 2024
08ad882
darwin: add bootstrapStdenv
reckenrode Aug 21, 2024
40d415f
darwin: add darwinMinVersionHook
reckenrode Sep 23, 2024
5721c4f
darwin: add libSystem
reckenrode Sep 30, 2024
1211498
darwin: add xcodeProjectCheckHook
reckenrode Sep 2, 2024
8f8e240
darwin.apple-source-releases: add mkAppleDerivation
reckenrode Sep 2, 2024
6a54c7f
darwin.apple-source-releases: add update-source-releases.sh
reckenrode Sep 22, 2024
639108e
darwin.libsbuf: init at 14.1
reckenrode Sep 21, 2024
5567902
apple-sdk: init at 10.12.2 and 11.3
reckenrode Sep 21, 2024
3fb982d
apple-sdk_10_13: init at 10.13.2
reckenrode Sep 21, 2024
a447cba
apple-sdk_10_14: init at 10.14.6
reckenrode Sep 21, 2024
d10c85b
apple-sdk_10_15: init at 10.15.6
reckenrode Sep 21, 2024
689e898
apple-sdk_12: init at 12.3
reckenrode Sep 21, 2024
4283b8f
apple-sdk_13: init at 13.3
reckenrode Sep 21, 2024
8fae285
apple-sdk_14: init at 14.4
reckenrode Sep 21, 2024
d1c2539
darwin: add mkStub for deprecating frameworks
reckenrode Sep 29, 2024
17aeace
darwin: prepare for adding stub packages
reckenrode Sep 21, 2024
fcd9dc8
darwin.apple_sdk_11_0: convert frameworks and libs to stubs
reckenrode Sep 26, 2024
4802277
darwin.apple_sdk_12_3: convert frameworks and libs to stubs
reckenrode Sep 27, 2024
0a3c487
darwin.apple_sdk: convert frameworks and libs to stubs
reckenrode Sep 26, 2024
9ecb69c
darwin.apple_sdk: drop gen-frameworks.py (replaced by new SDK pattern)
reckenrode Oct 6, 2024
c218ce1
darwin: replace framework chooser with stubs
reckenrode Sep 21, 2024
97d75cb
{bintools,cc}-wrapper: set up Darwin SDK paths
reckenrode Sep 29, 2024
51755b0
{bintools,cc}-wrapper: use a fallback SDK when `DEVELOPER_DIR` is not…
reckenrode Sep 29, 2024
826edbf
{bintools,cc}-wrapper: fix static builds on Darwin
reckenrode Sep 29, 2024
a556a81
atf: build with the bootstrap stdenv on Darwin
reckenrode Sep 8, 2024
54d591b
cmake: undo `/var/empty` workaround for Darwin SDK paths
reckenrode Aug 31, 2024
472d10b
cmake: do in fact use the Darwin SDK in the setup hook
reckenrode Aug 17, 2024
a79ed0d
gnutar: make sure libiconv is linked
reckenrode Aug 17, 2024
f1480a2
libpng: build with the bootstrap stdenv on Darwin
reckenrode Sep 8, 2024
1ebcfd5
libuv: Use darwin.libutil on Darwin
reckenrode Sep 29, 2024
5a60ff8
libxml2: build with the bootstrap stdenv on Darwin
reckenrode Sep 8, 2024
25c6fe1
llvmPackages.clang: backport __ENVIRONMENT_OS_VERSION_MIN_REQUIRED__
reckenrode Sep 24, 2024
4dc3227
llvmPackages.clang: use the system libunwind on Darwin
reckenrode Sep 24, 2024
d3114e0
llvmPackages.compiler-rt: align Darwin bootstrap with other platforms
reckenrode Sep 24, 2024
654e19f
llvmPackages.compiler-rt: always build sanitizers on Darwin
reckenrode Sep 24, 2024
7647c68
llvmPackages.compiler-rt: avoid propagating the SDK in static builds
reckenrode Sep 24, 2024
2fd9a1a
llvmPackages.compiler-rt: drop use of xcbuild
reckenrode Sep 24, 2024
e6a4c83
llvmPackages.compiler-rt: fix compiler-rt bootstrap on Darwin
reckenrode Sep 24, 2024
3e5acda
llvmPackages.compiler-rt: fix cross-compilation on Darwin
reckenrode Sep 24, 2024
18211ad
llvmPackages.libcxx: use a bootstrap stdenv on Darwin
reckenrode Sep 24, 2024
34ce30c
llvmPackages.libllvm: disable tests when built in the Darwin bootstrap
reckenrode Sep 24, 2024
bf45402
ncurses: build with the bootstrap stdenv on Darwin
reckenrode Sep 8, 2024
aef4614
xar: add xarMinimal
reckenrode Oct 2, 2024
45e65c1
xcbuild: move to pkgs/by-name
reckenrode Sep 22, 2024
f51c62a
xcbuild: format with nixfmt-rfc-style
reckenrode Oct 3, 2024
15ac657
xcbuild: refactor to support the new SDKs
reckenrode Sep 22, 2024
118a214
xcbuild: warn when someone tries to override `sdkVer`
reckenrode Oct 3, 2024
49834c3
xcbuild: suppress warning for now
reckenrode Oct 5, 2024
fee84be
xcbuild: suppress xcbuild passthru warning for now
reckenrode Oct 5, 2024
dd569d8
xcbuild: avoid `xcrun` invoking itself via `/usr/bin` stubs
reckenrode Sep 22, 2024
75bc428
xcbuild: 0.1.2-pre -> 0.1.1-unstable-2019-11-20
reckenrode Sep 22, 2024
1fd1796
zlib: build with the bootstrap stdenv on Darwin
reckenrode Sep 8, 2024
76a5ef6
darwin.stdenv: rework for the new SDK
reckenrode Sep 25, 2024
9c004ef
darwin.stdenv: use xarMinimal
reckenrode Oct 2, 2024
b7442b9
darwin.stdenv: provide an SDK when cross-compiling
reckenrode Aug 21, 2024
4624bd7
darwin.adv_cmds: convert to Meson and use mkAppleDerivation
reckenrode Sep 21, 2024
78076b3
darwin.AvailabilityVersions: use mkAppleDerivation
reckenrode Sep 2, 2024
129a959
darwin.AvailabilityVersions: also generate _symbol_aliasing.h
reckenrode Sep 21, 2024
8e7056c
darwin.AvailabilityVersions: remove workaround
reckenrode Oct 5, 2024
94b1474
darwin.basic_cmds: convert to Meson and use mkAppleDerivation
reckenrode Sep 21, 2024
c5c276b
darwin.bootstrap_cmds: convert to Meson and use mkAppleDerivation
reckenrode Sep 22, 2024
b878c44
darwin.bsdmake: add to darwin-aliases.nix
reckenrode Sep 22, 2024
8574626
darwin.copyfile: convert to Meson and use mkAppleDerivation
reckenrode Sep 22, 2024
b8dbc16
darwin.Csu: use mkAppleDerivation
reckenrode Sep 22, 2024
83807dc
darwin.developer_cmds: convert to Meson and use mkAppleDerivation
reckenrode Sep 22, 2024
97454b4
darwin.diskdev_cmds: convert to Meson and use mkAppleDerivation
reckenrode Sep 22, 2024
eed715a
darwin.file_cmds: convert to Meson and use mkAppleDerivation
reckenrode Sep 22, 2024
0335ce0
darwin.ICU: convert to upstream build system and use mkAppleDerivation
reckenrode Sep 22, 2024
ca4dd24
darwin.libiconv: move back to darwin attrset and use mkAppleDerivation
reckenrode Sep 22, 2024
b0884d5
darwin.libiconv: use finalPackage when referencing doInstallCheck
reckenrode Oct 5, 2024
9af3511
darwin.libiconv: use `EOF` instead of `-header` for the herdoc
reckenrode Oct 5, 2024
375057b
darwin.libresolv: convert to Meson and use mkAppleDerivation
reckenrode Sep 22, 2024
dac3f1f
macfuse-stubs: use top-level libtapi
reckenrode Sep 25, 2024
b8be4c4
darwin.libtapi: add to darwin-aliases.nix
reckenrode Sep 22, 2024
4b4270c
darwin.libutil: convert to Meson and use mkAppleDerivation
reckenrode Sep 22, 2024
822a865
darwin.network_cmds: convert to Meson and use mkAppleDerivation
reckenrode Sep 22, 2024
6fca3b4
darwin.PowerManagement: convert to Meson and use mkAppleDerivation
reckenrode Sep 22, 2024
149eb5a
darwin.removefile: convert to Meson and use mkAppleDerivation
reckenrode Sep 22, 2024
a19b0a7
darwin.shell_cmds: convert to Meson and use mkAppleDerivation
reckenrode Sep 22, 2024
9ea9221
darwin.system_cmds: use mkAppleDerivation
reckenrode Sep 22, 2024
97da1bd
darwin.text_cmds: convert to Meson and use mkAppleDerivation
reckenrode Sep 22, 2024
29a87d6
darwin.top: convert to Meson and use mkAppleDerivation
reckenrode Sep 22, 2024
9d376e2
cctools: drop darwin.objc4 from build inputs
reckenrode Aug 17, 2024
3904162
cctools: move libtool to its own output
reckenrode Aug 24, 2024
2bf9c22
ld64: ensure ld64 checks pass with the new SDK
reckenrode Sep 23, 2024
1c17748
ld64: drop libunwind as a dependency
reckenrode Sep 23, 2024
f90d4d5
ld64: adopt source release private headers pattern
reckenrode Sep 23, 2024
84f8fcf
libcCross: use darwin.libSystem unconditionally
reckenrode Sep 25, 2024
6986cab
libunwind: add a comment explaining the package situation
reckenrode Sep 25, 2024
8a0d884
libxo: init at 1.7.5
reckenrode Sep 23, 2024
66fcbb9
makeStaticDarwin: drop darwin-portable-libSystem-hook
reckenrode Sep 25, 2024
1c26a2f
makeStaticDarwin: handle when `env.NIX_CFLAGS_LINK` is set
reckenrode Sep 1, 2024
0e61488
overrideSDK: update for the new SDK
reckenrode Sep 25, 2024
b62e262
python27: drop configd
reckenrode Aug 29, 2024
3e5316c
python3: drop configd
reckenrode Sep 29, 2024
092b50a
python3: fix stdenv bootstrap on x86_64-darwin
reckenrode Oct 3, 2024
7a8e3bf
darwin.CF: remove and replace with stubs
reckenrode Sep 21, 2024
2ed29e2
darwin.CarbonHeaders: remove and replace with stubs
reckenrode Sep 2, 2024
4fbe414
darwin.CommonCrypto: remove and replace with stubs
reckenrode Sep 2, 2024
390e8e7
darwin.CoreSymbolication: remove and replace with stubs
reckenrode Oct 2, 2024
65650be
darwin.IOKit: remove and replace with stubs
reckenrode Sep 2, 2024
2e1f901
darwin.Libc: remove and replace with stubs
reckenrode Sep 2, 2024
0d76542
darwin.Libinfo: remove and replace with stubs
reckenrode Sep 2, 2024
67271ab
darwin.Libm: remove and replace with stubs
reckenrode Sep 2, 2024
b47afcc
darwin.Libnotify: remove and replace with stubs
reckenrode Sep 2, 2024
fe9623e
darwin.Librpcsvc: remove and replace with stubs
reckenrode Sep 2, 2024
db40aca
darwin.Libsystem: remove and replace with stubs
reckenrode Sep 2, 2024
07272a0
darwin.Security: remove and replace with stubs
reckenrode Sep 2, 2024
fd2ae22
darwin.architecture: remove and replace with stubs
reckenrode Sep 2, 2024
ac79109
darwin.configd: remove and replace with stubs (including configdHeaders)
reckenrode Sep 2, 2024
d78b641
darwin.darwin-stubs: remove and replace with stubs
reckenrode Sep 21, 2024
ae78385
darwin.dtrace: remove and replace with stubs
reckenrode Sep 2, 2024
8a59383
darwin.dyld: remove and replace with stubs
reckenrode Sep 2, 2024
cce88cf
darwin.eap8021x: remove and replace with stubs
reckenrode Sep 2, 2024
2ade0ae
darwin.hfs: remove and replace with stubs (including hfsHeaders)
reckenrode Sep 2, 2024
1c2dde0
darwin.launchd: remove and replace with stubs
reckenrode Sep 2, 2024
eb7c5f8
darwin.libclosure: remove and replace with stubs
reckenrode Sep 2, 2024
b9005e1
darwin.libdispatch: remove and replace with stubs
reckenrode Sep 2, 2024
1afb8b5
darwin.libmalloc: remove and replace with stubs
reckenrode Sep 2, 2024
29f65b3
darwin.libplatform: remove and replace with stubs
reckenrode Sep 2, 2024
7b23be1
darwin.libpthread: remove and replace with stubs
reckenrode Sep 2, 2024
ec40b04
darwin.libunwind: improve compatibility with libunwind
reckenrode Sep 2, 2024
259c350
darwin.libunwind: remove source release
reckenrode Sep 2, 2024
4c77578
darwin.mDNSResponder: remove and replace with stubs
reckenrode Sep 2, 2024
7be27dc
darwin.objc4: remove and replace with stubs
reckenrode Sep 2, 2024
03e585a
darwin.ppp: remove and replace with stubs
reckenrode Sep 2, 2024
6b6277e
darwin.xnu: remove and replace with stubs
reckenrode Sep 2, 2024
6c6b7b0
darwin.apple-source-releases: switch to new source release pattern
reckenrode Sep 2, 2024
bdf3046
darwin.adv_cmds: 163 -> 231
reckenrode Sep 21, 2024
4854f28
darwin.AvailabilityVersions: 140.1 -> 143.3
reckenrode Sep 21, 2024
ab006b0
darwin.basic_cmds: 55 -> 70
reckenrode Sep 22, 2024
4d328d0
darwin.bootstrap_cmds: 121 -> 136
reckenrode Sep 22, 2024
d5f4ae4
darwin.copyfile: 138 -> 213
reckenrode Sep 22, 2024
82a2469
darwin.developer_cmds: 62 -> 79
reckenrode Sep 22, 2024
e0cf96b
darwin.diskdev_cmds: 593 -> 735
reckenrode Sep 22, 2024
c640ed8
darwin.doc_cmds: init at 66
reckenrode Sep 22, 2024
32f5feb
darwin.file_cmds: 264.1.1 -> 448.0.3
reckenrode Sep 22, 2024
47df058
darwin.ICU: 66108 -> 74221
reckenrode Sep 22, 2024
d3ca461
darwin.IOKitTools: init at 125
reckenrode Sep 28, 2024
1d8c6e7
darwin.libiconv: 99 -> 107
reckenrode Sep 22, 2024
9c31a3e
darwin.libpcap: init at 135
reckenrode Sep 22, 2024
fc97344
darwin.libresolv: 64 -> 83
reckenrode Sep 22, 2024
edb2497
darwin.libutil: 47.30.1 -> 72
reckenrode Sep 22, 2024
44f1fa4
darwin.mail_cmds: init at 38.0.1
reckenrode Sep 22, 2024
42daeac
darwin.misc_cmds: init at 44
reckenrode Sep 22, 2024
d293dd1
darwin.network_cmds: 606.40.2 -> 696
reckenrode Sep 22, 2024
01d1005
darwin.patch_cmds: init at 62
reckenrode Sep 22, 2024
6d0bc8c
darwin.PowerManagement: 572.50.1 -> 1740.0.7
reckenrode Sep 22, 2024
f493fb8
darwin.remote_cmds: init at 303.0.2
reckenrode Sep 22, 2024
a32fcaa
darwin.removefile: 45 -> 75
reckenrode Sep 22, 2024
7b84d89
darwin.shell_cmds: 187 -> 319.0.1
reckenrode Sep 22, 2024
72f19ad
darwin.system_cmds: 970.0.4 -> 1012
reckenrode Sep 22, 2024
63bfe3c
darwin.text_cmds: 99 -> 190.0.1
reckenrode Sep 22, 2024
7e4956a
darwin.top: 108 -> 139
reckenrode Sep 22, 2024
bafc6ff
darwin.xattr: replace with xattr from file_cmds
reckenrode Sep 7, 2024
e3f2829
xar: 498 -> 501
reckenrode Oct 2, 2024
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: 4 additions & 1 deletion maintainers/team-list.nix
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,10 @@ with lib.maintainers;
};

darwin = {
members = [ toonn ];
members = [
reckenrode
toonn
];
githubTeams = [ "darwin-maintainers" ];
scope = "Maintain Darwin compatibility of packages and Darwin-only packages.";
shortName = "Darwin";
Expand Down
10 changes: 10 additions & 0 deletions pkgs/build-support/bintools-wrapper/add-darwin-ldflags-before.sh
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,13 @@ if [ ! "$havePlatformVersionFlag" ]; then
extraBefore+=(-@darwinPlatform@_version_min "${@darwinMinVersionVariable@_@suffixSalt@:-@darwinMinVersion@}")
fi
fi

mangleVarSingle DEVELOPER_DIR ${role_suffixes[@]+"${role_suffixes[@]}"}

# Allow wrapped bintools to do something useful when no `DEVELOPER_DIR` is set, which can happen when
# the compiler is run outside of a stdenv or intentionally in an environment with no environment variables set.
DEVELOPER_DIR=${DEVELOPER_DIR_@suffixSalt@:-@fallback_sdk@}
reckenrode marked this conversation as resolved.
Show resolved Hide resolved

# Darwin looks for frameworks in the SDK located at `DEVELOPER_DIR`.
extraBefore+=("-F$DEVELOPER_DIR/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks")
extraBefore+=("-L$DEVELOPER_DIR/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib")
7 changes: 6 additions & 1 deletion pkgs/build-support/bintools-wrapper/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
, stdenvNoCC
, runtimeShell
, bintools ? null, libc ? null, coreutils ? null, gnugrep ? null
, apple-sdk ? null
, netbsd ? null
, sharedLibraryLoader ?
if libc == null then
Expand Down Expand Up @@ -107,7 +108,8 @@ let
coreutils_bin = optionalString (!nativeTools) (getBin coreutils);

# See description in cc-wrapper.
suffixSalt = replaceStrings ["-" "."] ["_" "_"] targetPlatform.config;
suffixSalt = replaceStrings ["-" "."] ["_" "_"] targetPlatform.config
+ lib.optionalString (targetPlatform.isDarwin && targetPlatform.isStatic) "_static";
emilazy marked this conversation as resolved.
Show resolved Hide resolved

# The dynamic linker has different names on different platforms. This is a
# shell glob that ought to match it.
Expand Down Expand Up @@ -412,6 +414,9 @@ stdenvNoCC.mkDerivation {
inherit dynamicLinker targetPrefix suffixSalt coreutils_bin;
inherit bintools_bin libc_bin libc_dev libc_lib;
default_hardening_flags_str = builtins.toString defaultHardeningFlags;
} // lib.optionalAttrs (apple-sdk != null && stdenvNoCC.targetPlatform.isDarwin) {
# Wrapped compilers should do something useful even when no SDK is provided at `DEVELOPER_DIR`.
fallback_sdk = apple-sdk.__spliced.buildTarget or apple-sdk;
};

meta =
Expand Down
18 changes: 17 additions & 1 deletion pkgs/build-support/cc-wrapper/add-flags.sh
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,28 @@ if [ -e @out@/nix-support/cc-cflags-before ]; then
NIX_CFLAGS_COMPILE_BEFORE_@suffixSalt@="$(< @out@/nix-support/cc-cflags-before) $NIX_CFLAGS_COMPILE_BEFORE_@suffixSalt@"
fi

# Only add darwin min version flag if a default darwin min version is set,
# Only add darwin min version flag and set up `DEVELOPER_DIR` if a default darwin min version is set,
# which is a signal that we're targetting darwin.
if [ "@darwinMinVersion@" ]; then
mangleVarSingle @darwinMinVersionVariable@ ${role_suffixes[@]+"${role_suffixes[@]}"}

NIX_CFLAGS_COMPILE_BEFORE_@suffixSalt@="-m@darwinPlatformForCC@-version-min=${@darwinMinVersionVariable@_@suffixSalt@:-@darwinMinVersion@} $NIX_CFLAGS_COMPILE_BEFORE_@suffixSalt@"

# `DEVELOPER_DIR` is used to dynamically locate libSystem (and the SDK frameworks) based on the SDK at that path.
mangleVarSingle DEVELOPER_DIR ${role_suffixes[@]+"${role_suffixes[@]}"}

# Allow wrapped compilers to do something useful when no `DEVELOPER_DIR` is set, which can happen when
# the compiler is run outside of a stdenv or intentionally in an environment with no environment variables set.
DEVELOPER_DIR=${DEVELOPER_DIR_@suffixSalt@:-@fallback_sdk@}

# xcbuild needs `SDKROOT` to be the name of the SDK, which it sets in its own wrapper,
# but compilers expect it to point to the absolute path.
SDKROOT="$DEVELOPER_DIR/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk"

# Set up various library paths since compilers may not support (or may have disabled) finding them in the sysroot.
NIX_CFLAGS_COMPILE_BEFORE_@suffixSalt@+=" -isysroot $SDKROOT"
NIX_CFLAGS_COMPILE_@suffixSalt@+=" -idirafter $SDKROOT/usr/include"
NIX_CFLAGS_COMPILE_@suffixSalt@+=" -iframework $SDKROOT/System/Library/Frameworks"
fi

# That way forked processes will not extend these environment variables again.
Expand Down
7 changes: 6 additions & 1 deletion pkgs/build-support/cc-wrapper/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
, stdenvNoCC
, runtimeShell
, cc ? null, libc ? null, bintools, coreutils ? null
, apple-sdk ? null
, zlib ? null
, nativeTools, noLibc ? false, nativeLibc, nativePrefix ? ""
, propagateDoc ? cc != null && cc ? man
Expand Down Expand Up @@ -114,7 +115,8 @@ let
# without interfering. For the moment, it is defined as the target triple,
# adjusted to be a valid bash identifier. This should be considered an
# unstable implementation detail, however.
suffixSalt = replaceStrings ["-" "."] ["_" "_"] targetPlatform.config;
suffixSalt = replaceStrings ["-" "."] ["_" "_"] targetPlatform.config
+ lib.optionalString (targetPlatform.isDarwin && targetPlatform.isStatic) "_static";

useGccForLibs = useCcForLibs
&& libcxx == null
Expand Down Expand Up @@ -749,6 +751,9 @@ stdenvNoCC.mkDerivation {
inherit libc_bin libc_dev libc_lib;
inherit darwinPlatformForCC darwinMinVersion darwinMinVersionVariable;
default_hardening_flags_str = builtins.toString defaultHardeningFlags;
} // lib.optionalAttrs (apple-sdk != null && stdenvNoCC.targetPlatform.isDarwin) {
# Wrapped compilers should do something useful even when no SDK is provided at `DEVELOPER_DIR`.
fallback_sdk = apple-sdk.__spliced.buildTarget or apple-sdk;
};

meta =
Expand Down
Empty file.
51 changes: 51 additions & 0 deletions pkgs/by-name/ap/apple-sdk/common/add-core-symbolication.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
lib,
fetchFromGitHub,
stdenvNoCC,
}:

let
CoreSymbolication = stdenvNoCC.mkDerivation (finalAttrs: {
pname = "CoreSymbolication";
version = "0-unstable-2018-06-17";

src = fetchFromGitHub {
repo = "CoreSymbolication";
owner = "matthewbauer";
rev = "24c87c23664b3ee05dc7a5a87d647ae476a680e4";
hash = "sha256-PzvLq94eNhP0+rLwGMKcMzxuD6MlrNI7iT/eV0obtSE=";
};
emilazy marked this conversation as resolved.
Show resolved Hide resolved

patches = [
# Add missing symbol definitions needed to build `zlog` in system_cmds.
# https://github.com/matthewbauer/CoreSymbolication/pull/2
../patches/0001-Add-function-definitions-needed-to-build-zlog-in-sys.patch
../patches/0002-Add-CF_EXPORT-To-const-symbols.patch
emilazy marked this conversation as resolved.
Show resolved Hide resolved
];

dontBuild = true;

installPhase = ''
mkdir -p "$out/include"
cp *.h "$out/include"
'';

meta = {
description = "Reverse engineered headers for Apple's CoreSymbolication framework";
homepage = "https://github.com/matthewbauer/CoreSymbolication";
license = lib.licenses.mit;
maintainers = lib.teams.darwin.members;
platforms = lib.platforms.darwin;
};
});
in
self: super: {
buildPhase =
super.buildPhase or ""
+ ''
mkdir -p System/Library/PrivateFrameworks/CoreSymbolication.framework/Versions/A/Headers
ln -s A System/Library/PrivateFrameworks/CoreSymbolication.framework/Versions/Current
ln -s Versions/Current/Headers System/Library/PrivateFrameworks/CoreSymbolication.framework/Headers
cp '${CoreSymbolication}/include/'*.h System/Library/PrivateFrameworks/CoreSymbolication.framework/Versions/A/Headers
'';
}
17 changes: 17 additions & 0 deletions pkgs/by-name/ap/apple-sdk/common/derivation-options.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{ lib, config }:

self: super: {
preBuild =
super.preBuild or ""
+ ''
platformPath=$out/Platforms/MacOSX.platform
sdkpath=$platformPath/Developer/SDKs
'';

preInstall =
super.preInstall or ""
+ ''
platformPath=$out/Platforms/MacOSX.platform
sdkpath=$platformPath/Developer/SDKs
'';
}
42 changes: 42 additions & 0 deletions pkgs/by-name/ap/apple-sdk/common/fetch-sdk.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
lib,
fetchurl,
cpio,
pbzx,
}:

{
url,
version,
hash,
}:

fetchurl {
pname = "macOS-SDK";
inherit version url hash;

recursiveHash = true;

nativeBuildInputs = [
cpio
pbzx
];

postFetch = ''
renamed=$(mktemp -d)/sdk.xar
mv "$downloadedFile" "$renamed"
pbzx "$renamed" | cpio -idm
reckenrode marked this conversation as resolved.
Show resolved Hide resolved

# SDKs are inconsistent about whether MacOSX.sdk or MacOSX<version>.sdk is a symlink.
src=Library/Developer/CommandLineTools/SDKs/MacOSX${lib.versions.majorMinor version}.sdk
if [ ! -d $src ]; then
src=Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
fi

# Remove unwanted binaries, man pages, and folders from the SDK.
rm -rf $src/usr/bin $src/usr/share $src/System/Library/Perl

mkdir -p "$out"
cp -rd $src/* "$out"
'';
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{ makeSetupHook, sdkVersion }:

self: super: {
passthru = super.passthru or { } // {
privateFrameworksHook = makeSetupHook {
name = "apple-sdk-private-frameworks-hook";
} ../setup-hooks/add-private-frameworks.sh;
};
}
37 changes: 37 additions & 0 deletions pkgs/by-name/ap/apple-sdk/common/passthru-source-release-files.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
let
lockfile = builtins.fromJSON (builtins.readFile ../metadata/apple-oss-lockfile.json);
in

{
lib,
fetchFromGitHub,
stdenvNoCC,
sdkVersion,
}:

let
sdkinfo = lockfile.${sdkVersion};
in
self: super: {
passthru = super.passthru or { } // {
# Returns the raw source from apple-oss-distributions repo.
# This is mostly useful for copying private headers needed to build other source releases.
#
# Note: The source releases are mostly not used to build the SDK. Unless they can be used to build binaries,
# they’re not used.
sourceRelease =
name:
let
lockinfo = sdkinfo.${name};
in
fetchFromGitHub {
owner = "apple-oss-distributions";
repo = name;
rev = lockinfo.rev or "${name}-${lockinfo.version}";
inherit (lockinfo) hash;
}
// {
inherit (lockinfo) version;
};
emilazy marked this conversation as resolved.
Show resolved Hide resolved
};
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
{ stdenv, runCommand, lib, sdks, xcodePlatform, writeText }:
{
lib,
stdenvNoCC,
xcodePlatform,
}:

let

inherit (lib.generators) toPlist;

Info = {
Expand All @@ -10,11 +13,7 @@ let
Name = lib.toLower xcodePlatform;
};

Version = {
ProjectName = "OSXPlatformSupport";
};

# These files are all based off of Xcode spec fies found in
# These files are all based off of Xcode spec files found in
# /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Xcode/PrivatePlugIns/IDEOSXSupportCore.ideplugin/Contents/Resources.

# Based off of the "MacOSX Architectures.xcspec" file. All i386 stuff
Expand All @@ -24,14 +23,20 @@ let
Identifier = "Standard";
Type = "Architecture";
Name = "Standard Architectures (Apple Silicon, 64-bit Intel)";
RealArchitectures = [ "arm64" "x86_64" ];
RealArchitectures = [
"arm64"
"x86_64"
emilazy marked this conversation as resolved.
Show resolved Hide resolved
];
ArchitectureSetting = "ARCHS_STANDARD";
}
{
Identifier = "Universal";
Type = "Architecture";
Name = "Universal (Apple Silicon, 64-bit Intel)";
RealArchitectures = [ "arm64" "x86_64" ];
RealArchitectures = [
"arm64"
"x86_64"
];
ArchitectureSetting = "ARCHS_STANDARD_32_64_BIT";
}
{
Expand All @@ -44,19 +49,25 @@ let
Identifier = "Standard64bit";
Type = "Architecture";
Name = "Apple Silicon, 64-bit Intel";
RealArchitectures = [ "arm64" "x86_64" ];
RealArchitectures = [
"arm64"
"x86_64"
];
ArchitectureSetting = "ARCHS_STANDARD_64_BIT";
}
{
Identifier = if stdenv.hostPlatform.isAarch64 then "arm64" else "x86_64";
Identifier = stdenvNoCC.hostPlatform.darwinArch;
Type = "Architecture";
Name = "Apple Silicon or Intel 64-bit";
}
{
Identifier = "Standard_Including_64_bit";
Type = "Architecture";
Name = "Standard Architectures (including 64-bit)";
RealArchitectures = [ "arm64" "x86_64" ];
RealArchitectures = [
"arm64"
"x86_64"
];
ArchitectureSetting = "ARCHS_STANDARD_INCLUDING_64_BIT";
}
];
Expand Down Expand Up @@ -283,19 +294,14 @@ let
}
];

ToolchainInfo = {
Identifier = "com.apple.dt.toolchain.XcodeDefault";
};
in

runCommand "Platforms" {} ''
platform=$out/${xcodePlatform}.platform

install -D ${writeText "Info.plist" (toPlist {} Info)} $platform/Info.plist
install -D ${writeText "version.plist" (toPlist {} Version)} $platform/version.plist
install -D ${writeText "Architectures.xcspec" (toPlist {} Architectures)} $platform/Developer/Library/Xcode/Specifications/Architectures.xcspec
install -D ${writeText "PackageTypes.xcspec" (toPlist {} PackageTypes)} $platform/Developer/Library/Xcode/Specifications/PackageTypes.xcspec
install -D ${writeText "ProductTypes.xcspec" (toPlist {} ProductTypes)} $platform/Developer/Library/Xcode/Specifications/ProductTypes.xcspec

ln -s $platform $platform/usr

mkdir -p $platform/Developer
ln -s ${sdks} $platform/Developer/SDKs
''
{
"Info.plist" = builtins.toFile "Info.plist" (toPlist { } Info);
"ToolchainInfo.plist" = builtins.toFile "ToolchainInfo.plist" (toPlist { } ToolchainInfo);
"Architectures.xcspec" = builtins.toFile "Architectures.xcspec" (toPlist { } Architectures);
"PackageTypes.xcspec" = builtins.toFile "PackageTypes.xcspec" (toPlist { } PackageTypes);
"ProductTypes.xcspec" = builtins.toFile "ProductTypes.xcspec" (toPlist { } ProductTypes);
}
Loading
Loading