From 360dec443807e1296dddd79e620e5bdb7460f6c6 Mon Sep 17 00:00:00 2001 From: Jacob Oursland Date: Tue, 29 Jul 2025 01:42:26 -0700 Subject: [PATCH] CI: recursively fixup RPATHs on macOS. --- package/rattler-build/osx/create_bundle.sh | 2 +- package/rattler-build/scripts/fix_macos_lib_paths.py | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/package/rattler-build/osx/create_bundle.sh b/package/rattler-build/osx/create_bundle.sh index c4d62fc493..b3756ab4a0 100644 --- a/package/rattler-build/osx/create_bundle.sh +++ b/package/rattler-build/osx/create_bundle.sh @@ -42,7 +42,7 @@ find . -name "*.pyc" -type f -delete # see https://github.com/FreeCAD/FreeCAD/issues/10144#issuecomment-1836686775 # and https://github.com/FreeCAD/FreeCAD-Bundle/pull/203 # and https://github.com/FreeCAD/FreeCAD-Bundle/issues/375 -python ../scripts/fix_macos_lib_paths.py ${conda_env}/lib +python ../scripts/fix_macos_lib_paths.py ${conda_env}/lib -r # build and install the launcher cmake -B build launcher diff --git a/package/rattler-build/scripts/fix_macos_lib_paths.py b/package/rattler-build/scripts/fix_macos_lib_paths.py index b616af4e2e..813cedc782 100644 --- a/package/rattler-build/scripts/fix_macos_lib_paths.py +++ b/package/rattler-build/scripts/fix_macos_lib_paths.py @@ -73,14 +73,20 @@ def scan_directory(directory, recursive=False): file_dir = os.path.dirname(full_path) rpaths_processed = set() for rpath in rpaths: + if rpath == "@loader_path": + rpath = "@loader_path/" + if os.path.isabs(rpath) and os.path.samefile(file_dir, rpath): if scanmode: print(f'\nFound absolute path in LC_RPATH: {rpath}\nIn: {full_path}') else: remove_rpath(full_path, rpath) + if rpath in rpaths_processed: - print(f'\nFound duplicate RPATH: {rpath}\nIn: {full_path}') - remove_rpath(full_path, rpath) + if scanmode: + print(f'\nFound duplicate RPATH: {rpath}\nIn: {full_path}') + else: + remove_rpath(full_path, rpath) rpaths_processed.add(rpath) for reexport_dylib in reexport_dylibs: if os.path.isabs(reexport_dylib):