From 482b81ae5d4dc0bca6d2869c94237b48a55a2cfa Mon Sep 17 00:00:00 2001
From: Akaps316 <48785708+Akaps316@users.noreply.github.com>
Date: Fri, 3 Apr 2026 21:17:05 +0530
Subject: fix(xcode.application): avoid duplicate bundle rpath insertion
Only add the macOS app bundle framework rpath if it is missing from the copied app binary.
This avoids install_name_tool failing when the target already links with @executable_path/../Frameworks, for example via add_rpathdirs().
Add a regression test covering a macOS app target that already carries the bundle rpath before xcode.application generates the app bundle.
---
.../objc/macapp_duplicate_rpath/src/Info.plist | 18 ++++++++++++++++++
tests/projects/objc/macapp_duplicate_rpath/src/main.m | 5 +++++
2 files changed, 23 insertions(+)
create mode 100644 tests/projects/objc/macapp_duplicate_rpath/src/Info.plist
create mode 100644 tests/projects/objc/macapp_duplicate_rpath/src/main.m
(limited to 'tests/projects/objc/macapp_duplicate_rpath/src')
diff --git a/tests/projects/objc/macapp_duplicate_rpath/src/Info.plist b/tests/projects/objc/macapp_duplicate_rpath/src/Info.plist
new file mode 100644
index 000000000..e20952d73
--- /dev/null
+++ b/tests/projects/objc/macapp_duplicate_rpath/src/Info.plist
@@ -0,0 +1,18 @@
+
+
+
+
+ CFBundleExecutable
+ demo
+ CFBundleIdentifier
+ io.xmake.demo.duprpath
+ CFBundleName
+ demo
+ CFBundlePackageType
+ APPL
+ CFBundleVersion
+ 1
+ CFBundleShortVersionString
+ 1.0
+
+
diff --git a/tests/projects/objc/macapp_duplicate_rpath/src/main.m b/tests/projects/objc/macapp_duplicate_rpath/src/main.m
new file mode 100644
index 000000000..f481d2909
--- /dev/null
+++ b/tests/projects/objc/macapp_duplicate_rpath/src/main.m
@@ -0,0 +1,5 @@
+#import
+
+int main(void) {
+ return 0;
+}
--
cgit v1.3.1