From 338570de5c07abeb8a62b24ca667c72308d747f1 Mon Sep 17 00:00:00 2001 From: fanquake Date: Thu, 6 Mar 2025 15:56:09 +0000 Subject: [PATCH] contrib: more selectively pick files for macOS SDK Only include what we really need. Skip 100s of mb of manpages, swiftmodules, modulemaps. Note that System/Library is only needed for the Qt build. Github-Pull: #32009 Rebased-From: a33d03454508187abed764e55351ffcececc4c6e --- contrib/macdeploy/README.md | 2 +- contrib/macdeploy/gen-sdk | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/contrib/macdeploy/README.md b/contrib/macdeploy/README.md index d47ee6774e0..3cbf5b506be 100644 --- a/contrib/macdeploy/README.md +++ b/contrib/macdeploy/README.md @@ -52,7 +52,7 @@ path to `Xcode.app` (extracted in the previous stage) as the first argument. ``` The generated archive should be: `Xcode-15.0-15A240d-extracted-SDK-with-libcxx-headers.tar.gz`. -The `sha256sum` should be `c0c2e7bb92c1fee0c4e9f3a485e4530786732d6c6dd9e9f418c282aa6892f55d`. +The `sha256sum` should be `5aa41897b7f00abdaf1ece242dde3eb96a395746c09638b3a59720694712387d`. ## Deterministic macOS App Notes diff --git a/contrib/macdeploy/gen-sdk b/contrib/macdeploy/gen-sdk index f0bbabf81f9..f269369110d 100755 --- a/contrib/macdeploy/gen-sdk +++ b/contrib/macdeploy/gen-sdk @@ -68,6 +68,8 @@ def run(): """ def change_tarinfo_base(tarinfo): + if tarinfo.name and tarinfo.name.endswith((".swiftmodule", ".modulemap")): + return None if tarinfo.name and tarinfo.name.startswith("./"): tarinfo.name = str(pathlib.Path(alt_base_dir, tarinfo.name)) if tarinfo.linkname and tarinfo.linkname.startswith("./"): @@ -81,7 +83,9 @@ def run(): return tarinfo with cd(dir_to_add): # recursion already adds entries in sorted order - tarfp.add(".", recursive=True, filter=change_tarinfo_base) + tarfp.add("./usr/include", recursive=True, filter=change_tarinfo_base) + tarfp.add("./usr/lib", recursive=True, filter=change_tarinfo_base) + tarfp.add("./System/Library/Frameworks", recursive=True, filter=change_tarinfo_base) print("Creating output .tar.gz file...") with out_sdktgz_path.open("wb") as fp: