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

apple_sdk_11_0: generate frameworks.nix #196197

Merged
merged 4 commits into from
Mar 18, 2023
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
120 changes: 88 additions & 32 deletions pkgs/os-specific/darwin/apple-sdk-11.0/apple_sdk.nix
Original file line number Diff line number Diff line change
Expand Up @@ -160,40 +160,96 @@ in rec {
};
};

overrides = super: {
CoreFoundation = lib.overrideDerivation super.CoreFoundation (drv: {
setupHook = ./cf-setup-hook.sh;
});

# This framework doesn't exist in newer SDKs (somewhere around 10.13), but
# there are references to it in nixpkgs.
QuickTime = throw "QuickTime framework not available";

# Seems to be appropriate given https://developer.apple.com/forums/thread/666686
JavaVM = super.JavaNativeFoundation;

CoreVideo = lib.overrideDerivation super.CoreVideo (drv: {
installPhase = drv.installPhase + ''
# When used as a module, complains about a missing import for
# Darwin.C.stdint. Apparently fixed in later SDKs.
awk -i inplace '/CFBase.h/ { print "#include <stdint.h>" } { print }' \
$out/Library/Frameworks/CoreVideo.framework/Headers/CVBase.h
'';
});
};

bareFrameworks = (
lib.mapAttrs framework (import ./frameworks.nix {
frameworks = let
# Dependency map created by gen-frameworks.py.
generatedDeps = import ./frameworks.nix {
inherit frameworks libs;
};

# Additional dependencies that are not picked up by gen-frameworks.py.
# Some of these are simply private frameworks the generator does not see.
extraDeps = with libs; with frameworks; let
inherit (pkgs.darwin.apple_sdk_11_0) libnetwork;
libobjc = pkgs.darwin.apple_sdk_11_0.objc4;
})
) // (
lib.mapAttrs privateFramework (import ./private-frameworks.nix {
inherit frameworks;
libobjc = pkgs.darwin.apple_sdk_11_0.objc4;
})
);
in {
# Below this comment are entries migrated from before the generator was
# added. If, for a given framework, you are able to reverify the extra
# deps are really necessary on top of the generator deps, move it above
# this comment (and maybe document your findings).
AVFoundation = { inherit ApplicationServices AVFCapture AVFCore; };
Accelerate = { inherit CoreWLAN IOBluetooth; };
AddressBook = { inherit AddressBookCore ContactsPersistence libobjc; };
AppKit = { inherit AudioToolbox AudioUnit UIFoundation; };
AudioToolbox = { inherit AudioToolboxCore; };
AudioUnit = { inherit Carbon CoreAudio; };
Carbon = { inherit IOKit QuartzCore libobjc; };
CoreAudio = { inherit IOKit; };
CoreFoundation = { inherit libobjc; };
CoreGraphics = { inherit SystemConfiguration; };
CoreMIDIServer = { inherit CoreMIDI; };
CoreMedia = { inherit ApplicationServices AudioToolbox AudioUnit; };
CoreServices = { inherit CoreAudio NetFS ServiceManagement; };
CoreWLAN = { inherit SecurityFoundation; };
DiscRecording = { inherit IOKit libobjc; };
Foundation = { inherit SystemConfiguration libobjc; };
GameKit = { inherit GameCenterFoundation GameCenterUI GameCenterUICore ReplayKit; };
ICADevices = { inherit Carbon libobjc; };
IOBluetooth = { inherit CoreBluetooth; };
JavaScriptCore = { inherit libobjc; };
Kernel = { inherit IOKit; };
LinkPresentation = { inherit URLFormatting; };
MediaToolbox = { inherit AudioUnit; };
MetricKit = { inherit SignpostMetrics; };
Network = { inherit libnetwork; };
PCSC = { inherit CoreData; };
PassKit = { inherit PassKitCore; };
QTKit = { inherit CoreMedia CoreMediaIO MediaToolbox VideoToolbox; };
Quartz = { inherit QTKit; };
QuartzCore = { inherit ApplicationServices CoreImage CoreVideo Metal OpenCL libobjc; };
Security = { inherit IOKit libDER; };
TWAIN = { inherit Carbon; };
VideoDecodeAcceleration = { inherit CoreVideo; };
WebKit = { inherit ApplicationServices Carbon libobjc; };
};

frameworks = bareFrameworks // overrides bareFrameworks;
# Overrides for framework derivations.
overrides = super: {
CoreFoundation = lib.overrideDerivation super.CoreFoundation (drv: {
setupHook = ./cf-setup-hook.sh;
});

# This framework doesn't exist in newer SDKs (somewhere around 10.13), but
# there are references to it in nixpkgs.
QuickTime = throw "QuickTime framework not available";

# Seems to be appropriate given https://developer.apple.com/forums/thread/666686
JavaVM = super.JavaNativeFoundation;

CoreVideo = lib.overrideDerivation super.CoreVideo (drv: {
installPhase = drv.installPhase + ''
# When used as a module, complains about a missing import for
# Darwin.C.stdint. Apparently fixed in later SDKs.
awk -i inplace '/CFBase.h/ { print "#include <stdint.h>" } { print }' \
$out/Library/Frameworks/CoreVideo.framework/Headers/CVBase.h
'';
});
};

# Merge extraDeps into generatedDeps.
deps = generatedDeps // (
lib.mapAttrs
(name: deps: generatedDeps.${name} // deps)
extraDeps
);

# Create derivations, and add private frameworks.
bareFrameworks = (lib.mapAttrs framework deps) // (
lib.mapAttrs privateFramework (import ./private-frameworks.nix {
inherit frameworks;
libobjc = pkgs.darwin.apple_sdk_11_0.objc4;
})
);
in
# Apply derivation overrides.
bareFrameworks // overrides bareFrameworks;
}
10 changes: 2 additions & 8 deletions pkgs/os-specific/darwin/apple-sdk-11.0/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,7 @@ let
};

installPhase = ''
cd Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk

mkdir $out
cp -r System usr $out/
mv Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk $out
'';
};

Expand All @@ -49,10 +46,7 @@ let
};

installPhase = ''
cd Library/Developer/CommandLineTools

mkdir $out
cp -r Library usr $out/
mv Library/Developer/CommandLineTools $out
'';
};

Expand Down
Loading