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

CoreFoundation: apply hook to correct platform #284706

Merged
merged 1 commit into from
Feb 8, 2024
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: 4 additions & 1 deletion pkgs/os-specific/darwin/apple-sdk-11.0/apple_sdk.nix
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,10 @@ in rec {
# Overrides for framework derivations.
overrides = super: {
CoreFoundation = lib.overrideDerivation super.CoreFoundation (drv: {
setupHook = ./cf-setup-hook.sh;
setupHooks = [
../../../build-support/setup-hooks/role.bash
./cf-setup-hook.sh
];
});

# This framework doesn't exist in newer SDKs (somewhere around 10.13), but
Expand Down
14 changes: 11 additions & 3 deletions pkgs/os-specific/darwin/apple-sdk-11.0/cf-setup-hook.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
forceLinkCoreFoundationFramework() {
NIX_CFLAGS_COMPILE="-F@out@/Library/Frameworks${NIX_CFLAGS_COMPILE:+ }${NIX_CFLAGS_COMPILE-}"
toonn marked this conversation as resolved.
Show resolved Hide resolved
NIX_LDFLAGS+=" @out@/Library/Frameworks/CoreFoundation.framework/CoreFoundation.tbd"
local role_post
getHostRole

local cflags_compile_role_var="NIX_CFLAGS_COMPILE${role_post}"
local cflags_compile_role="${!cflags_compile_role_var-}"
export NIX_CFLAGS_COMPILE${role_post}="-F@out@/Library/Frameworks${cflags_compile_role:+ $cflags_compile_role}"

local ldflags_role_var="NIX_LDFLAGS${role_post}"
local ldflags_role="${!ldflags_role_var-}"
export NIX_LDFLAGS${role_post}+="${ldflags_role:+ }@out@/Library/Frameworks/CoreFoundation.framework/CoreFoundation.tbd"
toonn marked this conversation as resolved.
Show resolved Hide resolved
}

preConfigureHooks+=(forceLinkCoreFoundationFramework)
toonn marked this conversation as resolved.
Show resolved Hide resolved
forceLinkCoreFoundationFramework
14 changes: 11 additions & 3 deletions pkgs/os-specific/darwin/apple-sdk/cf-setup-hook.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
linkSystemCoreFoundationFramework() {
NIX_CFLAGS_COMPILE="-F@out@/Library/Frameworks${NIX_CFLAGS_COMPILE:+ }${NIX_CFLAGS_COMPILE-}"
local role_post
getHostRole

local cflags_compile_role_var="NIX_CFLAGS_COMPILE${role_post}"
local cflags_compile_role="${!cflags_compile_role_var-}"
export NIX_CFLAGS_COMPILE${role_post}="-F@out@/Library/Frameworks${cflags_compile_role:+ $cflags_compile_role}"

# 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"
local ldflags_role_var="NIX_LDFLAGS${role_post}"
local ldflags_role="${!ldflags_role_var-}"
export NIX_LDFLAGS${role_post}+="${ldflags_role:+ }@out@/Library/Frameworks/CoreFoundation.framework/CoreFoundation.tbd"
}

preConfigureHooks+=(linkSystemCoreFoundationFramework)
linkSystemCoreFoundationFramework
5 changes: 4 additions & 1 deletion pkgs/os-specific/darwin/apple-sdk/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,10 @@ in rec {
});

CoreFoundation = lib.overrideDerivation super.CoreFoundation (drv: {
setupHook = ./cf-setup-hook.sh;
setupHooks = [
../../../build-support/setup-hooks/role.bash
./cf-setup-hook.sh
];
});

CoreMedia = lib.overrideDerivation super.CoreMedia (drv: {
Expand Down
Loading