darwin.apple_sdk: convert frameworks and libs to stubs

This commit is contained in:
Randy Eckenrode 2024-09-25 22:16:56 -04:00
parent 480227777b
commit 0a3c487571
No known key found for this signature in database
GPG Key ID: 64C1CD4EC2A600D9
8 changed files with 259 additions and 834 deletions

View File

@ -1,9 +0,0 @@
linkSystemCoreFoundationFramework() {
NIX_CFLAGS_COMPILE="-F@out@/Library/Frameworks${NIX_CFLAGS_COMPILE:+ }${NIX_CFLAGS_COMPILE-}"
# gross! many symbols (such as _OBJC_CLASS_$_NSArray) are defined in system CF, but not
# in the opensource release
# if the package needs private headers, we assume they also want to link with system CF
NIX_LDFLAGS+=" @out@/Library/Frameworks/CoreFoundation.framework/CoreFoundation.tbd"
}
preConfigureHooks+=(linkSystemCoreFoundationFramework)

View File

@ -1,360 +1,272 @@
{ stdenv, stdenvNoCC, fetchurl, cpio, pbzx, pkgs, lib, darwin-stubs, print-reexports }:
# Compatibility stubs for packages that used the old SDK frameworks.
# TODO(@reckenrode) Make these stubs warn after framework usage has been cleaned up in nixpkgs.
{ lib, callPackage }:
let
# sadly needs to be exported because security_tool needs it
sdk = stdenv.mkDerivation rec {
pname = "MacOS_SDK";
version = "10.12";
mkStub = callPackage ./mk-stub.nix { } "10.12";
# This URL comes from https://swscan.apple.com/content/catalogs/others/index-10.12.merged-1.sucatalog, which we found by:
# 1. Google: site:swscan.apple.com and look for a name that seems appropriate for your version
# 2. In the resulting file, search for a file called DevSDK ending in .pkg
# 3. ???
# 4. Profit
src = fetchurl {
url = "http://swcdn.apple.com/content/downloads/33/36/041-90419-A_7JJ4H9ZHO2/xs88ob5wjz6riz7g6764twblnvksusg4ps/DevSDK_OSX1012.pkg";
sha256 = "13xq34sb7383b37hwy076gnhf96prpk1b4087p87xnwswxbrisih";
};
nativeBuildInputs = [ cpio pbzx ];
outputs = [ "out" "dev" "man" ];
unpackPhase = ''
pbzx $src | cpio -idm
'';
sourceRoot = ".";
installPhase = ''
mkdir -p $out
cp -R System/Library $out
cp -R usr/* $out
pushd $out/lib
cp ${darwin-stubs}/usr/lib/libcups*.tbd .
ln -s libcups.2.tbd libcups.tbd
ln -s libcupscgi.1.tbd libcupscgi.tbd
ln -s libcupsimage.2.tbd libcupsimage.tbd
ln -s libcupsmime.1.tbd libcupsmime.tbd
ln -s libcupsppdc.1.tbd libcupsppdc.tbd
popd
'';
meta = with lib; {
description = "Apple SDK ${version}";
maintainers = with maintainers; [ copumpkin ];
platforms = platforms.darwin;
};
};
mkFrameworkSubs = name: deps:
let
deps' = deps // { "${name}" = placeholder "out"; };
substArgs = lib.concatMap (x: [ "--subst-var-by" x deps'."${x}" ]) (lib.attrNames deps');
in lib.escapeShellArgs substArgs;
framework = name: deps: stdenv.mkDerivation {
name = "apple-framework-${name}";
dontUnpack = true;
# because we copy files from the system
preferLocalBuild = true;
disallowedRequisites = [ sdk ];
nativeBuildInputs = [ print-reexports ];
extraTBDFiles = [];
installPhase = ''
linkFramework() {
local path="$1"
local nested_path="$1"
if [ "$path" == "JavaNativeFoundation.framework" ]; then
local nested_path="JavaVM.framework/Versions/A/Frameworks/JavaNativeFoundation.framework"
fi
if [ "$path" == "JavaRuntimeSupport.framework" ]; then
local nested_path="JavaVM.framework/Versions/A/Frameworks/JavaRuntimeSupport.framework"
fi
local name="$(basename "$path" .framework)"
local current="$(readlink "/System/Library/Frameworks/$nested_path/Versions/Current")"
if [ -z "$current" ]; then
current=A
fi
local dest="$out/Library/Frameworks/$path"
mkdir -p "$dest/Versions/$current"
pushd "$dest/Versions/$current" >/dev/null
if [ -d "${sdk.out}/Library/Frameworks/$nested_path/Versions/$current/Headers" ]; then
cp -R "${sdk.out}/Library/Frameworks/$nested_path/Versions/$current/Headers" .
elif [ -d "${sdk.out}/Library/Frameworks/$name.framework/Versions/$current/Headers" ]; then
current="$(readlink "/System/Library/Frameworks/$name.framework/Versions/Current")"
cp -R "${sdk.out}/Library/Frameworks/$name.framework/Versions/$current/Headers" .
fi
local tbd_source=${darwin-stubs}/System/Library/Frameworks/$nested_path/Versions/$current
if [ "${name}" != "Kernel" ]; then
# The Kernel.framework has headers but no actual library component.
cp -v $tbd_source/*.tbd .
fi
if [ -d "$tbd_source/Libraries" ]; then
mkdir Libraries
cp -v $tbd_source/Libraries/*.tbd Libraries/
fi
ln -s -L "/System/Library/Frameworks/$nested_path/Versions/$current/Resources"
if [ -f "/System/Library/Frameworks/$nested_path/module.map" ]; then
ln -s "/System/Library/Frameworks/$nested_path/module.map"
fi
pushd "${sdk.out}/Library/Frameworks/$nested_path/Versions/$current" >/dev/null
local children=$(echo Frameworks/*.framework)
popd >/dev/null
for child in $children; do
childpath="$path/Versions/$current/$child"
linkFramework "$childpath"
done
pushd ../.. >/dev/null
ln -s "$current" Versions/Current
ln -s Versions/Current/* .
popd >/dev/null
popd >/dev/null
}
linkFramework "${name}.framework"
# linkFramework is recursive, the rest of the processing is not.
local tbd_source=${darwin-stubs}/System/Library/Frameworks/${name}.framework
for tbd in $extraTBDFiles; do
local tbd_dest_dir=$out/Library/Frameworks/${name}.framework/$(dirname "$tbd")
mkdir -p "$tbd_dest_dir"
cp -v "$tbd_source/$tbd" "$tbd_dest_dir"
done
# Fix and check tbd re-export references
find $out -name '*.tbd' | while read tbd; do
echo "Fixing re-exports in $tbd"
substituteInPlace "$tbd" ${mkFrameworkSubs name deps}
echo "Checking re-exports in $tbd"
print-reexports "$tbd" | while read target; do
local expected="''${target%.dylib}.tbd"
if ! [ -e "$expected" ]; then
echo -e "Re-export missing:\n\t$target\n\t(expected $expected)"
echo -e "While processing\n\t$tbd"
exit 1
else
echo "Re-exported target $target ok"
fi
done
done
'';
propagatedBuildInputs = builtins.attrValues deps;
meta = with lib; {
description = "Apple SDK framework ${name}";
maintainers = with maintainers; [ copumpkin ];
platforms = platforms.darwin;
};
};
tbdOnlyFramework = name: { private ? true }: stdenv.mkDerivation {
name = "apple-framework-${name}";
dontUnpack = true;
installPhase = ''
mkdir -p $out/Library/Frameworks/
cp -r ${darwin-stubs}/System/Library/${lib.optionalString private "Private"}Frameworks/${name}.framework \
$out/Library/Frameworks
cd $out/Library/Frameworks/${name}.framework
versions=(./Versions/*)
if [ "''${#versions[@]}" != 1 ]; then
echo "Unable to determine current version of framework ${name}"
exit 1
fi
current=$(basename ''${versions[0]})
chmod u+w -R .
ln -s "$current" Versions/Current
ln -s Versions/Current/* .
# NOTE there's no re-export checking here, this is probably wrong
'';
};
in rec {
libs = {
xpc = stdenv.mkDerivation {
name = "apple-lib-xpc";
dontUnpack = true;
installPhase = ''
mkdir -p $out/include
pushd $out/include >/dev/null
cp -r "${lib.getDev sdk}/include/xpc" $out/include/xpc
cp "${lib.getDev sdk}/include/launch.h" $out/include/launch.h
popd >/dev/null
'';
};
Xplugin = stdenv.mkDerivation {
name = "apple-lib-Xplugin";
dontUnpack = true;
# Not enough
__propagatedImpureHostDeps = [ "/usr/lib/libXplugin.1.dylib" ];
propagatedBuildInputs = with frameworks; [
OpenGL ApplicationServices Carbon IOKit CoreGraphics CoreServices CoreText
];
installPhase = ''
mkdir -p $out/include $out/lib
ln -s "${lib.getDev sdk}/include/Xplugin.h" $out/include/Xplugin.h
cp ${darwin-stubs}/usr/lib/libXplugin.1.tbd $out/lib
ln -s libXplugin.1.tbd $out/lib/libXplugin.tbd
'';
};
utmp = stdenv.mkDerivation {
name = "apple-lib-utmp";
dontUnpack = true;
installPhase = ''
mkdir -p $out/include
pushd $out/include >/dev/null
ln -s "${lib.getDev sdk}/include/utmp.h"
ln -s "${lib.getDev sdk}/include/utmpx.h"
popd >/dev/null
'';
};
sandbox = stdenv.mkDerivation {
name = "apple-lib-sandbox";
dontUnpack = true;
installPhase = ''
mkdir -p $out/include $out/lib
ln -s "${lib.getDev sdk}/include/sandbox.h" $out/include/sandbox.h
cp "${darwin-stubs}/usr/lib/libsandbox.1.tbd" $out/lib
ln -s libsandbox.1.tbd $out/lib/libsandbox.tbd
'';
};
simd = stdenvNoCC.mkDerivation {
name = "apple-lib-simd";
preferLocalBuild = true;
allowSubstitutes = false;
buildCommand = "echo 'simd library not available in the 10.12 SDK'; exit 1";
};
};
overrides = super: {
AppKit = lib.overrideDerivation super.AppKit (drv: {
__propagatedImpureHostDeps = drv.__propagatedImpureHostDeps or [] ++ [
"/System/Library/PrivateFrameworks/"
];
});
Carbon = lib.overrideDerivation super.Carbon (drv: {
extraTBDFiles = [ "Versions/A/Frameworks/HTMLRendering.framework/Versions/A/HTMLRendering.tbd" ];
});
CoreFoundation = lib.overrideDerivation super.CoreFoundation (drv: {
setupHook = ./cf-setup-hook.sh;
});
CoreMedia = lib.overrideDerivation super.CoreMedia (drv: {
__propagatedImpureHostDeps = drv.__propagatedImpureHostDeps or [] ++ [
"/System/Library/Frameworks/CoreImage.framework"
];
});
CoreMIDI = lib.overrideDerivation super.CoreMIDI (drv: {
__propagatedImpureHostDeps = drv.__propagatedImpureHostDeps or [] ++ [
"/System/Library/PrivateFrameworks/"
];
setupHook = ./private-frameworks-setup-hook.sh;
});
IMServicePlugIn = lib.overrideDerivation super.IMServicePlugIn (drv: {
extraTBDFiles = [ "Versions/A/Frameworks/IMServicePlugInSupport.framework/Versions/A/IMServicePlugInSupport.tbd" ];
});
Security = lib.overrideDerivation super.Security (drv: {
setupHook = ./security-setup-hook.sh;
});
QuartzCore = lib.overrideDerivation super.QuartzCore (drv: {
installPhase = drv.installPhase + ''
f="$out/Library/Frameworks/QuartzCore.framework/Headers/CoreImage.h"
substituteInPlace "$f" \
--replace "QuartzCore/../Frameworks/CoreImage.framework/Headers" "CoreImage"
'';
});
MetalKit = lib.overrideDerivation super.MetalKit (drv: {
installPhase = drv.installPhase + ''
mkdir -p $out/include/simd
cp ${lib.getDev sdk}/include/simd/*.h $out/include/simd/
'';
});
System = lib.overrideDerivation super.System (drv: {
installPhase = ''
mkdir -p $out/Library/Frameworks/System.framework/Versions/B
ln -s $out/Library/Frameworks/System.framework/Versions/{B,Current}
ln -s ${pkgs.darwin.Libsystem}/lib/libSystem.B.tbd $out/Library/Frameworks/System.framework/Versions/B/System.tbd
ln -s $out/Library/Frameworks/System.framework/{Versions/Current/,}System.tbd
'';
});
WebKit = lib.overrideDerivation super.WebKit (drv: {
extraTBDFiles = [
"Versions/A/Frameworks/WebCore.framework/Versions/A/WebCore.tbd"
"Versions/A/Frameworks/WebKitLegacy.framework/Versions/A/WebKitLegacy.tbd"
];
});
} // lib.genAttrs [
frameworks = lib.genAttrs [
"AGL"
"AVFoundation"
"AVKit"
"Accelerate"
"Accounts"
"AddressBook"
"AppKit"
"AppKitScripting"
"AppleScriptKit"
"AppleScriptObjC"
"ApplicationServices"
"AudioToolbox"
"AudioUnit"
"AudioVideoBridging"
"Automator"
"CFNetwork"
"CalendarStore"
"Carbon"
"Cocoa"
"Collaboration"
"ContactsPersistence"
"CoreAudio"
"CoreAudioKit"
"CoreBluetooth"
"CoreData"
"CoreFoundation"
"CoreGraphics"
"CoreImage"
"CoreLocation"
"CoreMIDI"
"CoreMIDIServer"
"CoreMedia"
"CoreMediaIO"
"CoreServices"
"CoreSymbolication"
"CoreText"
"CoreVideo"
"CoreWLAN"
"DVDPlayback"
"DebugSymbols"
"DirectoryService"
"DiscRecording"
"DiscRecordingUI"
"DiskArbitration"
"DisplayServices"
"EventKit"
"ExceptionHandling"
"FWAUserLib"
"ForceFeedback"
"Foundation"
"GLKit"
"GLUT"
"GSS"
"GameCenter"
"GameController"
"GameKit"
"GameplayKit"
"Hypervisor"
"ICADevices"
"IMServicePlugIn"
"IOBluetooth"
"IOBluetoothUI"
"IOKit"
"IOSurface"
"ImageCaptureCore"
"ImageIO"
"InputMethodKit"
"InstallerPlugins"
"InstantMessage"
"JavaFrameEmbedding"
"JavaNativeFoundation"
"JavaRuntimeSupport"
"JavaScriptCore"
"JavaVM"
"Kerberos"
"Kernel"
"LDAP"
"LatentSemanticMapping"
"LocalAuthentication"
"MapKit"
"MediaAccessibility"
"MediaPlayer"
"MediaToolbox"
"Metal"
"MetalKit"
"ModelIO"
"MultitouchSupport"
"NetFS"
"OSAKit"
"OpenAL"
"OpenCL"
"OpenDirectory"
"OpenGL"
"PCSC"
"PreferencePanes"
"PubSub"
"QTKit"
"Quartz"
"QuartzCore"
"QuickLook"
"QuickTime"
"SceneKit"
"ScreenSaver"
"Scripting"
"ScriptingBridge"
"Security"
"SecurityFoundation"
"SecurityInterface"
"ServiceManagement"
"SkyLight"
"Social"
"SpriteKit"
"StoreKit"
"SyncServices"
"System"
"SystemConfiguration"
"TWAIN"
"Tcl"
"UIFoundation"
]
(x: tbdOnlyFramework x {});
"VideoDecodeAcceleration"
"VideoToolbox"
"WebKit"
"vmnet"
] mkStub;
bareFrameworks = lib.mapAttrs framework (import ./frameworks.nix {
inherit frameworks libs;
inherit (pkgs.darwin) libobjc;
});
bareFrameworks = lib.genAttrs [
"AGL"
"AVFoundation"
"AVKit"
"Accelerate"
"Accounts"
"AddressBook"
"AppKit"
"AppKitScripting"
"AppleScriptKit"
"AppleScriptObjC"
"ApplicationServices"
"AudioToolbox"
"AudioUnit"
"AudioVideoBridging"
"Automator"
"CFNetwork"
"CalendarStore"
"Carbon"
"Cocoa"
"Collaboration"
"CoreAudio"
"CoreAudioKit"
"CoreBluetooth"
"CoreData"
"CoreFoundation"
"CoreGraphics"
"CoreImage"
"CoreLocation"
"CoreMIDI"
"CoreMIDIServer"
"CoreMedia"
"CoreMediaIO"
"CoreServices"
"CoreText"
"CoreVideo"
"CoreWLAN"
"DVDPlayback"
"DirectoryService"
"DiscRecording"
"DiscRecordingUI"
"DiskArbitration"
"EventKit"
"ExceptionHandling"
"FWAUserLib"
"ForceFeedback"
"Foundation"
"GLKit"
"GLUT"
"GSS"
"GameCenter"
"GameController"
"GameKit"
"GameplayKit"
"Hypervisor"
"ICADevices"
"IMServicePlugIn"
"IOBluetooth"
"IOBluetoothUI"
"IOKit"
"IOSurface"
"ImageCaptureCore"
"ImageIO"
"InputMethodKit"
"InstallerPlugins"
"InstantMessage"
"JavaFrameEmbedding"
"JavaNativeFoundation"
"JavaRuntimeSupport"
"JavaScriptCore"
"JavaVM"
"Kerberos"
"Kernel"
"LDAP"
"LatentSemanticMapping"
"LocalAuthentication"
"MapKit"
"MediaAccessibility"
"MediaPlayer"
"MediaToolbox"
"Metal"
"MetalKit"
"ModelIO"
"NetFS"
"OSAKit"
"OpenAL"
"OpenCL"
"OpenDirectory"
"OpenGL"
"PCSC"
"PreferencePanes"
"PubSub"
"QTKit"
"Quartz"
"QuartzCore"
"QuickLook"
"QuickTime"
"SceneKit"
"ScreenSaver"
"Scripting"
"ScriptingBridge"
"Security"
"SecurityFoundation"
"SecurityInterface"
"ServiceManagement"
"Social"
"SpriteKit"
"StoreKit"
"SyncServices"
"System"
"SystemConfiguration"
"TWAIN"
"Tcl"
"VideoDecodeAcceleration"
"VideoToolbox"
"WebKit"
"vmnet"
] mkStub;
in
{
inherit bareFrameworks frameworks;
frameworks = bareFrameworks // overrides bareFrameworks;
libs = lib.genAttrs [
"Xplugin"
"sandbox"
"simd"
"utmp"
"xpc"
] mkStub;
inherit darwin-stubs;
objc4 = pkgs.darwin.libobjc;
sdkRoot = pkgs.callPackage ./sdkRoot.nix { sdkVersion = "10.12.4"; };
inherit (pkgs.darwin) Libsystem;
inherit sdk;
version = "10.12";
}
// lib.genAttrs [
"darwin-stubs"
"Libsystem"
"objc4"
"sdk"
"sdkRoot"
] mkStub

View File

@ -1,130 +0,0 @@
# Current as of 10.12
# Epic weird knot-tying happening here.
# TODO: clean up the process for generating this and include it
{ frameworks, libs, libobjc, }:
with frameworks; with libs; {
AGL = { inherit Carbon OpenGL; };
AVFoundation = { inherit ApplicationServices CoreGraphics CoreMedia MediaToolbox; };
AVKit = {};
Accounts = {};
AddressBook = { inherit libobjc Carbon ContactsPersistence; };
AppKit = { inherit ApplicationServices AudioToolbox AudioUnit Foundation QuartzCore UIFoundation; };
AppKitScripting = {};
AppleScriptKit = {};
AppleScriptObjC = {};
AudioToolbox = { inherit CoreAudio CoreMIDI; };
AudioUnit = { inherit AudioToolbox Carbon CoreAudio; };
AudioVideoBridging = { inherit Foundation; };
Automator = {};
CFNetwork = {};
CalendarStore = {};
Cocoa = { inherit AppKit CoreData; };
Collaboration = {};
# Impure version of CoreFoundation, this should not be used unless another
# framework includes headers that are not available in the pure version.
CoreFoundation = {};
CoreAudio = { inherit IOKit; };
CoreAudioKit = { inherit AudioUnit; };
CoreData = {};
CoreGraphics = { inherit Accelerate IOKit IOSurface SystemConfiguration; };
CoreImage = {};
CoreLocation = {};
CoreMIDI = {};
CoreMIDIServer = { inherit CoreMIDI; };
CoreMedia = { inherit ApplicationServices AudioToolbox AudioUnit CoreAudio CoreGraphics CoreVideo; };
CoreMediaIO = { inherit CoreMedia; };
CoreText = { inherit CoreGraphics; };
CoreVideo = { inherit ApplicationServices CoreGraphics IOSurface OpenGL; };
CoreWLAN = { inherit SecurityFoundation; };
DVDPlayback = {};
DirectoryService = {};
DiscRecording = { inherit libobjc CoreServices IOKit; };
DiscRecordingUI = {};
DiskArbitration = { inherit IOKit; };
EventKit = {};
ExceptionHandling = {};
FWAUserLib = {};
ForceFeedback = { inherit IOKit; };
Foundation = { inherit libobjc CoreFoundation Security ApplicationServices SystemConfiguration; };
GLKit = {};
GLUT = { inherit OpenGL; };
GSS = {};
GameCenter = {};
GameController = {};
GameKit = { inherit Cocoa Foundation GameCenter GameController GameplayKit Metal MetalKit ModelIO SceneKit SpriteKit; };
GameplayKit = {};
Hypervisor = {};
ICADevices = { inherit libobjc Carbon IOBluetooth; };
IMServicePlugIn = {};
IOBluetoothUI = { inherit IOBluetooth; };
IOKit = {};
IOSurface = { inherit IOKit xpc; };
ImageCaptureCore = {};
ImageIO = { inherit CoreGraphics; };
InputMethodKit = { inherit Carbon; };
InstallerPlugins = {};
InstantMessage = {};
JavaFrameEmbedding = {};
JavaNativeFoundation = {};
JavaRuntimeSupport = {};
JavaScriptCore = { inherit libobjc; };
Kerberos = {};
Kernel = { inherit IOKit; };
LDAP = {};
LatentSemanticMapping = { inherit Carbon; };
LocalAuthentication = {};
MapKit = {};
MediaAccessibility = { inherit CoreGraphics CoreText QuartzCore; };
MediaPlayer = {};
MediaToolbox = { inherit AudioToolbox AudioUnit CoreMedia; };
Metal = {};
MetalKit = { inherit ModelIO Metal; };
ModelIO = {};
NetFS = {};
OSAKit = { inherit Carbon; };
OpenAL = {};
OpenCL = { inherit IOSurface OpenGL; };
OpenGL = {};
PCSC = { inherit CoreData; };
PreferencePanes = {};
PubSub = {};
QTKit = { inherit CoreMediaIO CoreMedia MediaToolbox QuickTime VideoToolbox; };
QuickLook = { inherit ApplicationServices; };
SceneKit = {};
ScreenSaver = {};
Scripting = {};
ScriptingBridge = {};
Security = { inherit IOKit; };
SecurityFoundation = {};
SecurityInterface = { inherit Security SecurityFoundation; };
ServiceManagement = { inherit Security; };
Social = {};
SpriteKit = {};
StoreKit = {};
SyncServices = {};
System = {};
SystemConfiguration = { inherit Security; };
TWAIN = { inherit Carbon; };
Tcl = {};
VideoDecodeAcceleration = { inherit CoreVideo; };
VideoToolbox = { inherit CoreMedia CoreVideo; };
WebKit = { inherit libobjc ApplicationServices Carbon JavaScriptCore OpenGL; };
# Umbrellas
Accelerate = { inherit CoreWLAN IOBluetooth; };
ApplicationServices = { inherit CoreGraphics CoreServices CoreText ImageIO; };
Carbon = { inherit libobjc ApplicationServices CoreServices Foundation IOKit Security QuartzCore; };
CoreBluetooth = {};
# TODO: figure out which part of the umbrella depends on CoreFoundation and move it there.
CoreServices = { inherit CFNetwork CoreFoundation CoreAudio CoreData DiskArbitration Security NetFS OpenDirectory ServiceManagement; };
IOBluetooth = { inherit CoreBluetooth IOKit; };
JavaVM = {};
OpenDirectory = {};
Quartz = { inherit QuartzCore QuickLook QTKit; };
QuartzCore = { inherit libobjc ApplicationServices CoreVideo OpenCL CoreImage Metal; };
QuickTime = { inherit ApplicationServices AudioUnit Carbon CoreAudio CoreServices OpenGL QuartzCore; };
vmnet = {};
}

View File

@ -1,256 +0,0 @@
rec {
CFNetwork = [
"/System/Library/Frameworks/CFNetwork.framework"
"/usr/lib/libsqlite3.dylib"
"/usr/lib/libxml2.2.dylib"
];
ForceFeedback = [
"/System/Library/Frameworks/ForceFeedback.framework"
];
AGL = [
"/System/Library/Frameworks/AGL.framework"
];
IOKit = [
"/System/Library/Frameworks/IOKit.framework"
];
JavaScriptCore = [
"/System/Library/Frameworks/JavaScriptCore.framework"
];
QuickLook = [
"/System/Library/Frameworks/QuickLook.framework"
];
Quartz = [
"/System/Library/Frameworks/Quartz.framework"
"/System/Library/PrivateFrameworks/AppleSystemInfo.framework/Versions/A/AppleSystemInfo"
"/System/Library/PrivateFrameworks/CorePDF.framework/Versions/A/CorePDF"
"/usr/lib/libspindump.dylib"
];
ImageCaptureCore = [
"/System/Library/Frameworks/ImageCaptureCore.framework"
];
VideoToolbox = [
"/System/Library/Frameworks/VideoToolbox.framework"
"/System/Library/PrivateFrameworks/AppleVA.framework/Versions/A/AppleVA"
];
QuickTime = [
"/System/Library/Frameworks/QuickTime.framework"
];
CoreMedia = [
"/System/Library/Frameworks/CoreMedia.framework"
];
CoreMediaIO = [
"/System/Library/Frameworks/CoreMediaIO.framework"
"/System/Library/PrivateFrameworks/AppSandbox.framework/Versions/A/AppSandbox"
"/System/Library/PrivateFrameworks/AppContainer.framework/Versions/A/AppContainer"
"/System/Library/PrivateFrameworks/SecCodeWrapper.framework/Versions/A/SecCodeWrapper"
"/System/Library/PrivateFrameworks/XPCService.framework/Versions/A/XPCService"
"/usr/lib/libsandbox.1.dylib"
"/usr/lib/libMatch.1.dylib"
];
MediaToolbox = [
"/System/Library/Frameworks/MediaToolbox.framework"
"/System/Library/PrivateFrameworks/CoreAUC.framework/Versions/A/CoreAUC"
"/System/Library/PrivateFrameworks/NetworkStatistics.framework/Versions/A/NetworkStatistics"
];
QTKit = [
"/System/Library/Frameworks/QTKit.framework"
"/System/Library/PrivateFrameworks/CoreMediaAuthoring.framework/Versions/A/CoreMediaAuthoring"
];
OSAKit = [
"/System/Library/Frameworks/OSAKit.framework"
"/usr/lib/libexslt.0.dylib"
];
WebKit = [
"/System/Library/Frameworks/WebKit.framework"
];
DiskArbitration = [
"/System/Library/Frameworks/DiskArbitration.framework"
];
Security = [
"/System/Library/Frameworks/Security.framework"
"/usr/lib/libbsm.0.dylib"
"/usr/lib/libbz2.1.0.dylib"
"/usr/lib/libpam.2.dylib"
"/usr/lib/libxar.1.dylib"
"/usr/lib/libxml2.2.dylib"
"/usr/lib/libsqlite3.dylib"
];
GSS = [
"/System/Library/Frameworks/GSS.framework"
];
Kerberos = [
"/System/Library/Frameworks/Kerberos.framework"
];
CoreServices = [
"/System/Library/Frameworks/CoreServices.framework"
"/System/Library/PrivateFrameworks/DataDetectorsCore.framework/Versions/A/DataDetectorsCore"
"/System/Library/PrivateFrameworks/TCC.framework/Versions/A/TCC"
"/System/Library/PrivateFrameworks/LanguageModeling.framework/Versions/A/LanguageModeling"
"/usr/lib/libmecabra.dylib"
"/usr/lib/libcmph.dylib"
"/usr/lib/libiconv.2.dylib"
"/usr/lib/libxslt.1.dylib"
] ++ Foundation;
IOSurface = [
"/System/Library/Frameworks/IOSurface.framework"
];
CoreGraphics = [
"/System/Library/Frameworks/CoreGraphics.framework"
"/System/Library/PrivateFrameworks/MultitouchSupport.framework/Versions/A/MultitouchSupport"
"/usr/lib/libbsm.0.dylib"
"/usr/lib/libz.1.dylib"
];
CoreText = [
"/System/Library/Frameworks/CoreText.framework"
];
ImageIO = [
"/System/Library/Frameworks/ImageIO.framework"
];
ApplicationServices = [
"/System/Library/Frameworks/ApplicationServices.framework"
"/usr/lib/libcups.2.dylib"
"/usr/lib/libresolv.9.dylib"
] ++ AudioToolbox;
OpenGL = [
"/System/Library/Frameworks/OpenGL.framework"
];
CoreVideo = [
"/System/Library/Frameworks/CoreVideo.framework"
];
QuartzCore = [
"/System/Library/Frameworks/QuartzCore.framework"
"/System/Library/PrivateFrameworks/CrashReporterSupport.framework/Versions/A/CrashReporterSupport"
];
PCSC = [
"/System/Library/Frameworks/PCSC.framework"
];
AppKit = [
"/System/Library/Frameworks/AppKit.framework"
"/System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Apple80211"
"/System/Library/PrivateFrameworks/AppleJPEG.framework/Versions/A/AppleJPEG"
"/System/Library/PrivateFrameworks/AppleVPA.framework/Versions/A/AppleVPA"
"/System/Library/PrivateFrameworks/Backup.framework/Versions/A/Backup"
"/System/Library/PrivateFrameworks/ChunkingLibrary.framework/Versions/A/ChunkingLibrary"
"/System/Library/PrivateFrameworks/CommonAuth.framework/Versions/A/CommonAuth"
"/System/Library/PrivateFrameworks/CoreSymbolication.framework/Versions/A/CoreSymbolication"
"/System/Library/PrivateFrameworks/CoreUI.framework/Versions/A/CoreUI"
"/System/Library/PrivateFrameworks/CoreWiFi.framework/Versions/A/CoreWiFi"
"/System/Library/PrivateFrameworks/CrashReporterSupport.framework/Versions/A/CrashReporterSupport"
"/System/Library/PrivateFrameworks/DataDetectorsCore.framework/Versions/A/DataDetectorsCore"
"/System/Library/PrivateFrameworks/DebugSymbols.framework/Versions/A/DebugSymbols"
"/System/Library/PrivateFrameworks/DesktopServicesPriv.framework/Versions/A/DesktopServicesPriv"
"/System/Library/PrivateFrameworks/FaceCore.framework/Versions/A/FaceCore"
"/System/Library/PrivateFrameworks/GenerationalStorage.framework/Versions/A/GenerationalStorage"
"/System/Library/PrivateFrameworks/Heimdal.framework/Heimdal"
"/System/Library/PrivateFrameworks/Heimdal.framework/Versions/Current"
"/System/Library/PrivateFrameworks/Heimdal.framework/Versions/A/Heimdal"
"/System/Library/PrivateFrameworks/IconServices.framework/Versions/A/IconServices"
"/System/Library/PrivateFrameworks/LanguageModeling.framework/Versions/A/LanguageModeling"
"/System/Library/PrivateFrameworks/MultitouchSupport.framework/Versions/A/MultitouchSupport"
"/System/Library/PrivateFrameworks/NetAuth.framework/Versions/A/NetAuth"
"/System/Library/PrivateFrameworks/PerformanceAnalysis.framework/Versions/A/PerformanceAnalysis"
"/System/Library/PrivateFrameworks/RemoteViewServices.framework/Versions/A/RemoteViewServices"
"/System/Library/PrivateFrameworks/Sharing.framework/Versions/A/Sharing"
"/System/Library/PrivateFrameworks/SpeechRecognitionCore.framework/Versions/A/SpeechRecognitionCore"
"/System/Library/PrivateFrameworks/Symbolication.framework/Versions/A/Symbolication"
"/System/Library/PrivateFrameworks/TCC.framework/Versions/A/TCC"
"/System/Library/PrivateFrameworks/UIFoundation.framework/Versions/A/UIFoundation"
"/System/Library/PrivateFrameworks/login.framework/Versions/A/Frameworks/loginsupport.framework/Versions/A/loginsupport"
"/usr/lib/libCRFSuite.dylib"
"/usr/lib/libOpenScriptingUtil.dylib"
"/usr/lib/libarchive.2.dylib"
"/usr/lib/libbsm.0.dylib"
"/usr/lib/libbz2.1.0.dylib"
"/usr/lib/libc++.1.dylib"
"/usr/lib/libc++abi.dylib"
"/usr/lib/libcmph.dylib"
"/usr/lib/libcups.2.dylib"
"/usr/lib/libextension.dylib"
"/usr/lib/libheimdal-asn1.dylib"
"/usr/lib/libiconv.2.dylib"
"/usr/lib/libicucore.A.dylib"
"/usr/lib/liblangid.dylib"
"/usr/lib/liblzma.5.dylib"
"/usr/lib/libmecabra.dylib"
"/usr/lib/libpam.2.dylib"
"/usr/lib/libresolv.9.dylib"
"/usr/lib/libsqlite3.dylib"
"/usr/lib/libxar.1.dylib"
"/usr/lib/libxml2.2.dylib"
"/usr/lib/libxslt.1.dylib"
"/usr/lib/libz.1.dylib"
];
Foundation = [
"/System/Library/Frameworks/Foundation.framework"
"/usr/lib/libextension.dylib"
"/usr/lib/libarchive.2.dylib"
"/usr/lib/liblzma.5.dylib"
"/usr/lib/liblangid.dylib"
"/usr/lib/libCRFSuite.dylib"
];
CoreData = [
"/System/Library/Frameworks/CoreData.framework"
];
Cocoa = [
"/System/Library/Frameworks/Cocoa.framework"
"/System/Library/PrivateFrameworks/UIFoundation.framework/Versions/A/UIFoundation"
"/System/Library/PrivateFrameworks/UIFoundation.framework/Versions/A"
];
Carbon = [
"/System/Library/Frameworks/Carbon.framework"
"/System/Library/PrivateFrameworks/CoreUI.framework/Versions/A/CoreUI"
"/System/Library/PrivateFrameworks/DesktopServicesPriv.framework/Versions/A/DesktopServicesPriv"
"/System/Library/PrivateFrameworks/IconServices.framework/Versions/A/IconServices"
"/System/Library/PrivateFrameworks/ChunkingLibrary.framework/Versions/A/ChunkingLibrary"
"/System/Library/PrivateFrameworks/Sharing.framework/Versions/A/Sharing"
"/System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Apple80211"
"/System/Library/PrivateFrameworks/GenerationalStorage.framework/Versions/A/GenerationalStorage"
];
CoreAudio = [
"/System/Library/Frameworks/CoreAudio.framework"
];
AudioUnit = [
"/System/Library/Frameworks/AudioUnit.framework"
];
CoreMIDI = [
"/System/Library/Frameworks/CoreMIDI.framework"
];
AudioToolbox = [
"/System/Library/Frameworks/AudioToolbox.framework"
];
SystemConfiguration = [
"/System/Library/Frameworks/SystemConfiguration.framework"
];
NetFS = [
"/System/Library/Frameworks/NetFS.framework"
"/System/Library/PrivateFrameworks/NetAuth.framework/Versions/A/NetAuth"
"/System/Library/PrivateFrameworks/login.framework/Versions/A/Frameworks/loginsupport.framework/Versions/A/loginsupport"
];
Accelerate = [
"/System/Library/Frameworks/Accelerate.framework"
];
OpenDirectory = [
"/System/Library/Frameworks/OpenDirectory.framework"
];
ServiceManagement = [
"/System/Library/Frameworks/ServiceManagement.framework"
];
OpenCL = [
"/System/Library/Frameworks/OpenCL.framework"
];
CoreWLAN = [
"/System/Library/Frameworks/CoreWLAN.framework"
];
IOBluetooth = [
"/System/Library/Frameworks/IOBluetooth.framework"
] ++ AudioUnit ++ CoreBluetooth;
CoreBluetooth = [
"/System/Library/Frameworks/CoreBluetooth.framework"
];
SecurityFoundation = [
"/System/Library/Frameworks/SecurityFoundation.framework"
];
Kernel = [
"/System/Library/Frameworks/Kernel.framework"
];
}

View File

@ -1,8 +0,0 @@
addPrivateFrameworks() {
flag="-F/System/Library/PrivateFrameworks"
if [[ "${NIX_CFLAGS_COMPILE-}" != *$flag* ]]; then
NIX_CFLAGS_COMPILE+=" $flag"
fi
}
addEnvHooks "$hostOffset" addPrivateFrameworks

View File

@ -1,68 +0,0 @@
{
lib,
runCommand,
writeText,
sdkVersion,
}:
let
sdkName = "MacOSX${sdkVersion}";
toolchainName = "com.apple.dt.toolchain.XcodeDefault";
productBuildVer = null;
inherit (lib.generators) toPlist toJSON;
SDKSettings = {
CanonicalName = "macosx${sdkVersion}";
DisplayName = "macOS ${sdkVersion}";
Toolchains = [ toolchainName ];
Version = sdkVersion;
MaximumDeploymentTarget = "${sdkVersion}.99";
isBaseSDK = "YES";
};
SystemVersion =
lib.optionalAttrs (productBuildVer != null) { ProductBuildVersion = productBuildVer; }
// {
ProductName = "macOS";
ProductVersion = sdkVersion;
};
in
runCommand "sdkroot-${sdkVersion}" { } ''
sdk="$out/${sdkName}.sdk"
install -D ${writeText "SDKSettings.plist" (toPlist { } SDKSettings)} "$sdk/SDKSettings.plist"
install -D ${writeText "SDKSettings.json" (toJSON { } SDKSettings)} "$sdk/SDKSettings.json"
install -D ${
writeText "SystemVersion.plist" (toPlist { } SystemVersion)
} "$sdk/System/Library/CoreServices/SystemVersion.plist"
ln -s "$sdk" "$sdk/usr"
install -D '${../../../build-support/setup-hooks/role.bash}' "$out/nix-support/setup-hook"
cat >> "$out/nix-support/setup-hook" <<-hook
#
# See comments in cc-wrapper's setup hook. This works exactly the same way.
#
[[ -z \''${strictDeps-} ]] || (( "\$hostOffset" < 0 )) || return 0
sdkRootHook() {
# See ../../../build-support/setup-hooks/role.bash
local role_post
getHostRoleEnvHook
# Only set the SDK root if one has not been set via this hook or some other means.
if [[ ! \$NIX_CFLAGS_COMPILE =~ isysroot ]]; then
export NIX_CFLAGS_COMPILE\''${role_post}+=' -isysroot $out/${sdkName}.sdk'
fi
}
# See ../../../build-support/setup-hooks/role.bash
getTargetRole
addEnvHooks "\$targetOffset" sdkRootHook
# No local scope in sourced file
unset -v role_post
hook
''

View File

@ -1,10 +0,0 @@
noDeprecatedDeclarations() {
# Security.framework has about 2000 deprecated constants, all of which the user will be
# warned about at compilation time
flag="-Wno-deprecated-declarations"
if [[ "${NIX_CFLAGS_COMPILE-}" != *$flag* ]]; then
NIX_CFLAGS_COMPILE+=" $flag"
fi
}
addEnvHooks "$hostOffset" noDeprecatedDeclarations

View File

@ -50,11 +50,7 @@ makeScopeWithSplicing' {
impure-cmds = pkgs.callPackage ../os-specific/darwin/impure-cmds { };
# macOS 10.12 SDK
apple_sdk_10_12 = pkgs.callPackage ../os-specific/darwin/apple-sdk {
inherit (buildPackages.darwin) print-reexports;
inherit (self) darwin-stubs;
fetchurl = fetchurlBoot;
};
apple_sdk_10_12 = pkgs.callPackage ../os-specific/darwin/apple-sdk { };
# macOS 11.0 SDK
apple_sdk_11_0 = pkgs.callPackage ../os-specific/darwin/apple-sdk-11.0 { };
@ -93,15 +89,13 @@ makeScopeWithSplicing' {
};
stubs = {
inherit apple_sdk_11_0 apple_sdk_12_3;
inherit apple_sdk apple_sdk_10_12 apple_sdk_11_0 apple_sdk_12_3;
} // lib.genAttrs [
] (mkStub apple_sdk.version);
in
impure-cmds // appleSourcePackages // chooseLibs // stubs // {
inherit apple_sdk apple_sdk_10_12;
stdenvNoCF = stdenv.override {
extraBuildInputs = [];
};