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-frameworks: remove CF references #63381

Merged
merged 43 commits into from Jul 3, 2019
Merged

Conversation

LnL7
Copy link
Member

@LnL7 LnL7 commented Jun 17, 2019

Motivation for this change

While trying to fix wx I ran into a bunch of problems that because it's very hard to actually replace what version of CoreFoundation is used. This change enables making the CF version configurable in the stdenv or omitting it entirely.

/cc @copumpkin @matthewbauer Do either of you know if there's a specific reason why these definitions are here, given that CF is a default stdenv input?

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nix-review --run "nix-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Assured whether relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@LnL7 LnL7 added this to Infrastructure (stdenv, sandboxing, etc.) in Darwin Jun 17, 2019
EventKit = [];
ExceptionHandling = [];
FWAUserLib = [];
ForceFeedback = [ CF IOKit ];
Foundation = [ cf-private libobjc Security ApplicationServices SystemConfiguration ];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can't use Foundation without cf-private, so IMO at least this one should be left in.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you elaborate? Currently we have darwin.CF, darwin.cf-private and frameworks.CoreFoundation. Using either of the three explicitly here means the others can't be used in builds without messing with flag ordering which I can't get to work for some reason.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think CoreServices or one of it's parts might also need it, was there a specific reason you determined this or was it just based on the various usages in nixpkgs?

@matthewbauer
Copy link
Member

matthewbauer commented Jun 17, 2019

IIRC those were these just to make it clear which frameworks actually use CoreFoundation directly. I agree that it's probably not too useful anymore.

I would support removing the SDK frameworks altogether and replace them with a catch-all "apple_sdk" dependency (that also depends on cf-private). This makes things less granular, but also makes things much more convenient. Most things that use one framework end up using a lot more. But it's maybe not worth the trouble, right now.

Besides the cf-private thing, this looks okay.

@ofborg ofborg bot added the 6.topic: darwin Running or building packages on Darwin label Jun 17, 2019
@LnL7
Copy link
Member Author

LnL7 commented Jun 17, 2019

In that case I'll look into folding cf-private/CoreFoundation, we shouldn't need both and with that there's only one to reference here.

@matthewbauer
Copy link
Member

In that case I'll look into folding cf-private/CoreFoundation, we shouldn't need both and with that there's only one to reference here.

It is probably still useful to keep them separate. Basically we have 3 difference versions of CoreFoundation:

  • darwin.apple_sdk.frameworks.CoreFoundation - Apple's official SDK release. This should never be needed directly.
  • darwin.CF - Open Source CoreFoundation taken from https://github.com/apple/swift-corelibs-foundation. Included in the stdenv.
  • darwin.cf-private - Merging of the two above + setup hook that includes lots of impurities. This is a hack that is necessary because Apple's SDK includes some private or macOS-specific symbols that aren't available in swift core foundation.

@LnL7
Copy link
Member Author

LnL7 commented Jun 17, 2019

I don't think there's an advantage to have cf-private except for the hook, which can be moved. Now that we use the swift corelibs it's a weird hybrid of the sdk and swift headers while still linking against the system libs anyway.

Foundation = [ cf-private libobjc Security ApplicationServices SystemConfiguration ];
GLKit = [ CF ];
ForceFeedback = [ IOKit ];
Foundation = [ libobjc CoreFoundation Security ApplicationServices SystemConfiguration ];
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that with this we can actually get rid of most of the remaining cf-private references, as well as some of the ugly cflags workaround needed before because of missing symbols.

@copumpkin
Copy link
Member

It's probably just weird legacy stuff from when I was clueless putting the first pure stdenv together 😄 In principle this seems 👍, but maybe worth sending to staging first?

@LnL7
Copy link
Member Author

LnL7 commented Jun 18, 2019

Definitively, mainly opened it to get feedback in case the idea doesn't make sense. It also needs more testing to verify my assumptions about cf-private are actually correct.

@LnL7 LnL7 mentioned this pull request Jun 19, 2019
9 tasks
@LnL7 LnL7 requested a review from ttuegel as a code owner June 19, 2019 21:27
@LnL7 LnL7 force-pushed the darwin-frameworks branch 2 times, most recently from 69e442a to 5d11398 Compare June 20, 2019 16:49
@LnL7 LnL7 requested a review from FRidh as a code owner June 20, 2019 16:49
@LnL7 LnL7 changed the title [WIP] darwin-frameworks: remove CF references darwin-frameworks: remove CF references Jun 22, 2019
@LnL7 LnL7 changed the base branch from master to staging June 22, 2019 21:49
@LnL7
Copy link
Member Author

LnL7 commented Jun 22, 2019

I think this is ready now, all the cleanup are cf-private references that are now not required anymore.

@LnL7 LnL7 merged commit 10f3980 into NixOS:staging Jul 3, 2019
@LnL7 LnL7 deleted the darwin-frameworks branch July 3, 2019 20:40
@LnL7 LnL7 mentioned this pull request Jul 28, 2019
10 tasks
@veprbl veprbl mentioned this pull request Oct 22, 2019
@veprbl veprbl moved this from Infrastructure (stdenv, sandboxing, etc.) to Apps in Darwin Oct 31, 2019
@veprbl veprbl moved this from Apps to Done in Darwin Oct 31, 2019
angerman added a commit to angerman/nixpkgs that referenced this pull request Dec 22, 2019
LnL7 added a commit to LnL7/nixpkgs that referenced this pull request Dec 27, 2019
No longer needded since NixOS#63381.
LnL7 added a commit to LnL7/nixpkgs that referenced this pull request Dec 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Darwin
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

3 participants