Skip to content

Emit Apple .framework from the skiasharp_build GN target#256

Open
mattleibow wants to merge 1 commit into
skiasharpfrom
dev/apple-gn-off-main
Open

Emit Apple .framework from the skiasharp_build GN target#256
mattleibow wants to merge 1 commit into
skiasharpfrom
dev/apple-gn-off-main

Conversation

@mattleibow

Copy link
Copy Markdown
Collaborator

Summary

Make the GN skiasharp_build targets emit a complete Apple .framework directly, so SkiaSharp can build libSkiaSharp and libHarfBuzzSharp for iOS/tvOS/MacCatalyst (and a plain .dylib for macOS) from GN/ninja — without the hand-maintained Xcode projects.

This is the submodule half of the Apple GN migration. It is derived cleanly off the skiasharp branch (no dependency on the C-API-move work) so it can land independently.

Changes

  • gn/skia/BUILD.gn — drop the invalid -Wl,{ios,tvos,macosx}_version_min ldflags (not real linker flags); add -target for iOS/tvOS device links.
  • BUILD.gn — set the framework install_name at link time (-Wl,-install_name,@rpath/lib<N>.framework/...) on both skiasharp_build targets, gated on skiasharp_apple_framework.
  • gn/toolchain/BUILD.gn — reorder $rpath before {{ldflags}} in the solink command so the link-time install_name takes effect.
  • gn/BUILDCONFIG.gn — add declare_args (skiasharp_apple_framework, skiasharp_apple_framework_versioned) and extend the skiasharp_build template to assemble the .framework bundle via a GN action when framework mode is on.
  • gn/skiasharp/assemble_apple_framework.{py,sh} (new) — assemble a single-arch, provenance-complete framework (bundle layout, arm64e thinning, Info.plist with the CFBundle*/DT*/BuildMachineOSBuild keys the App Store and notarization require) using the Apple CLI tools.

Verification

Built libSkiaSharp + libHarfBuzzSharp from source for macOS, iOS (+sim), tvOS (+sim) and Mac Catalyst via the SkiaSharp parent PR. Verified against the released 3.119.0 baseline: symbol counts (887 sk_/gr_, 560 hb_), fat archs, framework-relative install_name (/Versions/A/ for Catalyst), valid codesign, and Info.plist key parity. iOS simulator and Mac Catalyst test suites pass 5548/0.

Make the GN/ninja build produce the complete, App-Store-safe Apple native
artifacts directly, so SkiaSharp can drop its hand-maintained Xcode projects
for libSkiaSharp/libHarfBuzzSharp and build Apple the same way as every other
GN platform.

Changes (build-system only; does not move src/c, which stays in :core and
already reaches libSkiaSharp via :skia):

- gn/skia/BUILD.gn: drop the invalid "-Wl,{ios,tvos,macosx}_version_min"
  ldflags (modern ld treats them as input files) and supply the deployment
  target to the linker via "-target" for iOS/tvOS device links. These link
  paths are only exercised now that GN links the dylib directly.
- BUILD.gn: set the framework-relative -install_name at link time on the
  SkiaSharp/HarfBuzzSharp targets for iOS/tvOS/MacCatalyst (gated on is_ios,
  versioned layout when is_maccatalyst).
- gn/toolchain/BUILD.gn: place $rpath before {{ldflags}} in the solink command
  so a target's own -install_name wins (last-flag-wins); position-insensitive
  for non-overriding targets.
- gn/BUILDCONFIG.gn: make skiasharp_build emit a ready-to-use
  lib<Name>.framework (bundle layout, arm64e-thinned binary, provenance-complete
  Info.plist) via a GN action whenever is_ios, using the macOS-style versioned
  Versions/A layout when is_maccatalyst. No extra GN args are needed: the
  framework shape is derived entirely from the OS.
- gn/skiasharp/assemble_apple_framework.py: a single self-contained Python GN
  action that wraps the linked dylib into the .framework using first-party
  Apple CLI tools only (lipo/xcrun/xcodebuild/sw_vers) and plistlib.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@mattleibow mattleibow force-pushed the dev/apple-gn-off-main branch from 924f2d6 to f545a93 Compare June 16, 2026 09:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant