Skip to content

Commit

Permalink
Keep dSYM bundles when creating universal macOS binaries
Browse files Browse the repository at this point in the history
  • Loading branch information
lcruz99 committed Jul 29, 2024
1 parent ed537a4 commit 997b89b
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions rust_build_utils/darwin_build_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,21 +95,33 @@ def lipo(
packages: rutils.PackageList,
):
archs = GLOBAL_CONFIG[target_os]["archs"]
universal_binary_dist_path = get_universal_library_distribution_directory(
project, target_os, debug
)

for _, bins in packages.items():
for _, binary in bins.items():
create_fat_binary(
project,
get_universal_library_distribution_directory(project, target_os, debug)
/ binary,
universal_binary_dist_path / binary,
target_os,
archs.keys(),
binary,
debug,
)

for arch in archs:
shutil.rmtree(project.get_distribution_path(target_os, arch, "", debug))
dist_path = project.get_distribution_path(target_os, arch, "", debug)

for _, bins in packages.items():
for _, binary in bins.items():
dsym_dir = f"{dist_path}/{binary}.dSYM"
if os.path.isdir(dsym_dir):
dst_dir = f"{universal_binary_dist_path}/{binary}.dSYM/{arch}"
os.makedirs(dst_dir, exist_ok=True)
shutil.copytree(dsym_dir, dst_dir, dirs_exist_ok=True)

shutil.rmtree(dist_path)


def create_fat_binary(
Expand Down

0 comments on commit 997b89b

Please sign in to comment.