https://github.com/nixos/darwin-stubs
Text API (TAPI) files to support a pure build environment on macOS in nixpkgs.
https://github.com/nixos/darwin-stubs
Last synced: 8 months ago
JSON representation
Text API (TAPI) files to support a pure build environment on macOS in nixpkgs.
- Host: GitHub
- URL: https://github.com/nixos/darwin-stubs
- Owner: NixOS
- Created: 2020-11-11T15:05:21.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2022-09-27T10:54:03.000Z (over 3 years ago)
- Last Synced: 2024-04-15T12:49:38.639Z (about 2 years ago)
- Language: Shell
- Size: 1.25 MB
- Stars: 11
- Watchers: 41
- Forks: 8
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# darwin-stubs
Text API (TAPI) files to support a pure build environment on macOS in
nixpkgs.
## Generation
nix run -f scripts -c generate-all -s "$MACOS_10_12_SYSROOT" -o stubs/10.12
## Framework Names
These are derived from nixpkgs and stored in this repository for
consistency. To update:
nix run -f scripts -c update-framework-names -o scripts/framework-names.json
## Re-exports and absolute paths
Some libraries frameworks contain a `re-exports` section that exposes
other libraries and frameworks by their absolute path. When generating
stubs, the scripts recuse through all `re-exports` entries.
In regular usage of detached tbd stubs, the linker will use the
`syslibroot` option to find libraries by their absolute
names[1][]. Nixpkgs does not have a single SDK to pass as the
`syslibroot`, but passes individual frameworks as required. To support
re-exports, the absolute paths are rewritten to the corresponding nix
store paths of the stubs.
For libSystem the re-exports are trivial enough that it's sufficient
to replace `/usr/lib/libsystem` with `$out/lib/libsystem`, which is
part of the libSystem definition in nixpkgs.
For frameworks there are links between many frameworks. This is
handled by a two step process. In the definition of these stubs, the
framework path of re-exports is rewritten from
`/System/Library/SomeFramework.framework` to
`@SomeFramework@/Library/SomeFramework.framework`. When assembling the
frameworks for `darwin.apple_sdk.frameworks`, nixpkgs uses
`substituteInPlace --subst-var-by SomeFramework /nix/store/...` to
provide dependencies. To ensure correctness, the builder checks that
each re-exported file actually exists.
[1]: https://reviews.llvm.org/D4409#56025