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.apple_sdk.frameworks: cleanup, add missing frameworks, fix dependency structure #118906

Closed
wants to merge 3 commits into from

Conversation

lukegb
Copy link
Contributor

@lukegb lukegb commented Apr 9, 2021

Motivation for this change

As part of packaging pyobjc in #102306 and #118851, @SuperSandro2000 and I both discovered that a variety of the frameworks from macOS 10.12 are either missing, or not packaged in a way that lends it to use (because the headers refer to other frameworks, which aren't actually listed properly as dependencies).

This PR:

  • fixes GameCenter, so its TBD reexports from GameCenterUI and GameCenterFoundation work correctly
  • adds a number of missing frameworks that are wrapped by pyobjc from the 10.12 SDK
  • removes the simd headers from MetalKit and puts them into their own lib
  • adds all the dependencies required for each framework to be able to evaluate its top-level header files without any other intervention, and checks this. This mechanism is explained in further detail in the commit message, as well as within in the code itself
Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • 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 nixpkgs-review --run "nixpkgs-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)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@ofborg ofborg bot added the 6.topic: darwin Running or building packages on Darwin label Apr 9, 2021
@lukegb
Copy link
Contributor Author

lukegb commented Apr 9, 2021

/rebase staging

@github-actions
Copy link
Contributor

github-actions bot commented Apr 9, 2021

Failed to rebase

@lukegb lukegb requested a review from thefloweringash April 9, 2021 21:09
@lukegb lukegb force-pushed the macos-frameworks branch from 2dd39f3 to 23def15 Compare April 9, 2021 21:11
@lukegb lukegb requested review from LnL7 and siraben April 11, 2021 13:35
Copy link
Member

@SuperSandro2000 SuperSandro2000 left a comment

Choose a reason for hiding this comment

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

Mostly alphabetically sorting nits.

pkgs/os-specific/darwin/apple-sdk/frameworks.nix Outdated Show resolved Hide resolved
pkgs/os-specific/darwin/apple-sdk/frameworks.nix Outdated Show resolved Hide resolved
pkgs/os-specific/darwin/apple-sdk/frameworks.nix Outdated Show resolved Hide resolved
pkgs/os-specific/darwin/apple-sdk/frameworks.nix Outdated Show resolved Hide resolved
pkgs/os-specific/darwin/apple-sdk/frameworks.nix Outdated Show resolved Hide resolved
pkgs/os-specific/darwin/apple-sdk/frameworks.nix Outdated Show resolved Hide resolved
pkgs/os-specific/darwin/apple-sdk/frameworks.nix Outdated Show resolved Hide resolved
pkgs/os-specific/darwin/apple-sdk/frameworks.nix Outdated Show resolved Hide resolved
@@ -0,0 +1,33 @@
# Some frameworks have recursive dependencies - e.g. CoreData depends on
Copy link
Member

Choose a reason for hiding this comment

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

I am not sure anymore how I solved this but I think I used CoreFoundation instead of Foundation which is also not a good solution.

pkgs/os-specific/darwin/apple-sdk/default.nix Outdated Show resolved Hide resolved
@lukegb lukegb force-pushed the macos-frameworks branch from 23def15 to 1669222 Compare April 12, 2021 18:11
@lukegb
Copy link
Contributor Author

lukegb commented Apr 12, 2021

Mostly alphabetically sorting nits.

Applied a liberal dose of perl -ne 'if (/(^.*inherit )([^;]+)(;.*)/) { @s=split / /, $2; @s=sort @s; $s=join " ", @s; print $1, $s, $3, "\n" } else { print }' pkgs/os-specific/darwin/apple-sdk/frameworks.nix > pkgs/os-specific/darwin/apple-sdk/frameworks_sorted.nix (wasn't sure how to mass pull your suggestions other than by committing and pulling the branch down, and that seemed like a lot of work)

@SuperSandro2000
Copy link
Member

wasn't sure how to mass pull your suggestions other than by committing and pulling the branch down, and that seemed like a lot of work

You can always just do the same changes locally. Its not that important that you apply the suggestions.

@lukegb
Copy link
Contributor Author

lukegb commented Apr 12, 2021

@ofborg build darwin.apple_sdk.frameworks

lukegb added 3 commits April 17, 2021 02:23
GameCenter relies on GameCenterFoundation and GameCenterUI, which finally gives
the push needed to start checking and fixing the TBD reexports for TBD-only
frameworks.
pyobjc is effectively a bunch of Python bindings to a whole heap of the
frameworks in the Apple SDK - as such, we need to be able to declare
dependencies on a consistent set of frameworks as exposed by a particular macOS
SDK version.

Since the current SDK version fetched here is 10.12, this commit exports all
the frameworks that pyobjc expects for macOS 10.12.
These frameworks tend to themselves include other framework headers; in general
most software expects to see all of them at once, since they're all part of the
macOS SDK.

This commit adds the dependencies required to resolve all of the top-level
framework headers (which appears to be a decent heuristic for those which are
intended to be included). It also introduces a second-layer mechanism by which
the frameworks are checked to ensure that all dependencies are correctly
listed, as well as to bring in dependencies which would not otherwise be
possible due to circular dependencies.
@lukegb lukegb force-pushed the macos-frameworks branch from 1669222 to 0a729b1 Compare April 17, 2021 02:25
@SuperSandro2000
Copy link
Member

ping @NixOS/darwin-maintainers

@jeremyschlatter
Copy link
Contributor

Gentle bump.

(Rooting for progress on this so I can fix the iterm2 python package, which needs pyobjc.)

@veprbl veprbl added the 2.status: merge conflict This PR has merge conflicts with the target branch label Dec 25, 2021
@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jul 10, 2022
@lukegb lukegb closed this Dec 5, 2022
@lukegb lukegb deleted the macos-frameworks branch December 5, 2022 01:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.status: merge conflict This PR has merge conflicts with the target branch 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md 6.topic: darwin Running or building packages on Darwin 10.rebuild-darwin: 501+ 10.rebuild-darwin: 5001+ 10.rebuild-linux: 1-10 10.rebuild-linux: 1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants