-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
320 additions
and
180 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
From 4fefba48aebc88b3619d2c34e6328ec598a406fb Mon Sep 17 00:00:00 2001 | ||
From 0300f4f8d9fa7021e717551f68ad22a924af3d74 Mon Sep 17 00:00:00 2001 | ||
From: liviaerxin <[email protected]> | ||
Date: Sat, 24 Jun 2023 22:10:03 +0800 | ||
Subject: [PATCH 1/3] Fixup install name and rpath after building dynamic | ||
Subject: [PATCH 1/7] Fixup install name and rpath after building dynamic | ||
libraries on osx | ||
|
||
--- | ||
|
@@ -13,7 +13,7 @@ Subject: [PATCH 1/3] Fixup install name and rpath after building dynamic | |
|
||
diff --git a/scripts/cmake/z_vcpkg_fixup_install_name_rpath.cmake b/scripts/cmake/z_vcpkg_fixup_install_name_rpath.cmake | ||
new file mode 100644 | ||
index 000000000000..46510168cfe5 | ||
index 0000000000000..46510168cfe56 | ||
--- /dev/null | ||
+++ b/scripts/cmake/z_vcpkg_fixup_install_name_rpath.cmake | ||
@@ -0,0 +1,404 @@ | ||
|
@@ -377,13 +377,13 @@ index 000000000000..46510168cfe5 | |
+ | ||
+ # Iterate over the filtered dependencies and fix their install names | ||
+ foreach(dep_install_name IN LISTS dep_install_names) | ||
+ string(REGEX MATCH "[^/]+(.dylib|.so)" dep_install_short_name "${dep_install_name}") | ||
+ string(REGEX MATCH "[^/]+(.dylib|.so)" dep_install_name "${dep_install_name}") | ||
+ message(DEBUG "dep_install_name: ${dep_install_name}") | ||
+ | ||
+ if(type EQUAL 2) | ||
+ file(GLOB_RECURSE dep_files LIST_DIRECTORIES FALSE "${CURRENT_PACKAGES_DIR}/lib/${dep_install_short_name}") | ||
+ file(GLOB_RECURSE dep_files LIST_DIRECTORIES FALSE "${CURRENT_PACKAGES_DIR}/lib/${dep_install_name}") | ||
+ else() | ||
+ file(GLOB_RECURSE dep_files LIST_DIRECTORIES FALSE "${folder}/${dep_install_short_name}") | ||
+ file(GLOB_RECURSE dep_files LIST_DIRECTORIES FALSE "${folder}/${dep_install_name}") | ||
+ endif() | ||
+ | ||
+ if(NOT dep_files) | ||
|
@@ -423,12 +423,12 @@ index 000000000000..46510168cfe5 | |
+z_vcpkg_fixup_install_name_rpath_in_dir() | ||
\ No newline at end of file | ||
diff --git a/scripts/ports.cmake b/scripts/ports.cmake | ||
index ac0b64e6eb45..05ff31b15db0 100644 | ||
index c6746a6662686..267ad325f7702 100644 | ||
--- a/scripts/ports.cmake | ||
+++ b/scripts/ports.cmake | ||
@@ -149,6 +149,9 @@ if(CMD STREQUAL "BUILD") | ||
if(VCPKG_FIXUP_ELF_RPATH) | ||
include("${SCRIPTS}/cmake/z_vcpkg_fixup_rpath.cmake") | ||
@@ -178,6 +178,9 @@ if(CMD STREQUAL "BUILD") | ||
if(VCPKG_FIXUP_ELF_RPATH OR (VCPKG_TARGET_IS_LINUX AND NOT DEFINED VCPKG_FIXUP_ELF_RPATH)) | ||
z_vcpkg_fixup_rpath_in_dir() | ||
endif() | ||
+ if(VCPKG_FIXUP_MACHO_RPATH) | ||
+ include("${SCRIPTS}/cmake/z_vcpkg_fixup_install_name_rpath.cmake") | ||
|
@@ -437,7 +437,7 @@ index ac0b64e6eb45..05ff31b15db0 100644 | |
endif() | ||
elseif(CMD STREQUAL "CREATE") | ||
diff --git a/triplets/community/arm64-osx-dynamic.cmake b/triplets/community/arm64-osx-dynamic.cmake | ||
index c9b1243c92cf..8f37d4024377 100644 | ||
index c9b1243c92cfa..8f37d40243770 100644 | ||
--- a/triplets/community/arm64-osx-dynamic.cmake | ||
+++ b/triplets/community/arm64-osx-dynamic.cmake | ||
@@ -4,3 +4,5 @@ set(VCPKG_LIBRARY_LINKAGE dynamic) | ||
|
@@ -448,17 +448,17 @@ index c9b1243c92cf..8f37d4024377 100644 | |
+set(VCPKG_FIXUP_MACHO_RPATH ON) | ||
\ No newline at end of file | ||
|
||
From 2df07eac5d0efb6edfa698cc4cd4e9e1bf187843 Mon Sep 17 00:00:00 2001 | ||
From fc41a9a218dfedee5f9e6b4a37cfc7ea57c96b3d Mon Sep 17 00:00:00 2001 | ||
From: liviaerxin <[email protected]> | ||
Date: Sat, 24 Jun 2023 23:39:48 +0800 | ||
Subject: [PATCH 2/3] Update comments | ||
Subject: [PATCH 2/7] Update comments | ||
|
||
--- | ||
scripts/cmake/z_vcpkg_fixup_install_name_rpath.cmake | 8 ++++---- | ||
1 file changed, 4 insertions(+), 4 deletions(-) | ||
|
||
diff --git a/scripts/cmake/z_vcpkg_fixup_install_name_rpath.cmake b/scripts/cmake/z_vcpkg_fixup_install_name_rpath.cmake | ||
index 46510168cfe5..38fb716b3c22 100644 | ||
index 46510168cfe56..38fb716b3c223 100644 | ||
--- a/scripts/cmake/z_vcpkg_fixup_install_name_rpath.cmake | ||
+++ b/scripts/cmake/z_vcpkg_fixup_install_name_rpath.cmake | ||
@@ -217,14 +217,14 @@ endfunction() | ||
|
@@ -481,17 +481,17 @@ index 46510168cfe5..38fb716b3c22 100644 | |
find_program( | ||
install_name_tool_cmd | ||
|
||
From b94dc25d372b8269095f3aff73fd344b6c96f207 Mon Sep 17 00:00:00 2001 | ||
From 2f51fcee81cd2b8c30843805b6fe13efc7135839 Mon Sep 17 00:00:00 2001 | ||
From: liviaerxin <[email protected]> | ||
Date: Mon, 26 Jun 2023 21:32:14 +0800 | ||
Subject: [PATCH 3/3] chore: do fixup if necessary tools found | ||
Subject: [PATCH 3/7] chore: do fixup if necessary tools found | ||
|
||
--- | ||
.../z_vcpkg_fixup_install_name_rpath.cmake | 17 ++++++++++++++++- | ||
1 file changed, 16 insertions(+), 1 deletion(-) | ||
|
||
diff --git a/scripts/cmake/z_vcpkg_fixup_install_name_rpath.cmake b/scripts/cmake/z_vcpkg_fixup_install_name_rpath.cmake | ||
index 38fb716b3c22..2f07720938ec 100644 | ||
index 38fb716b3c223..2f07720938ece 100644 | ||
--- a/scripts/cmake/z_vcpkg_fixup_install_name_rpath.cmake | ||
+++ b/scripts/cmake/z_vcpkg_fixup_install_name_rpath.cmake | ||
@@ -229,10 +229,25 @@ function(z_vcpkg_fixup_install_name_rpath_in_dir) | ||
|
@@ -521,3 +521,154 @@ index 38fb716b3c22..2f07720938ec 100644 | |
message(DEBUG "Start fix install name and rpath for Mach-O files") | ||
|
||
# Iterate over the folders. DON'T change order! | ||
|
||
From 20255d645e1a4e27b2e3c4a891aa7cfe9035baf8 Mon Sep 17 00:00:00 2001 | ||
From: Matthias Kuhn <[email protected]> | ||
Date: Sat, 3 Feb 2024 16:11:03 +0100 | ||
Subject: [PATCH 4/7] Fail if rpath fixups cannot be applied | ||
|
||
--- | ||
.../z_vcpkg_fixup_install_name_rpath.cmake | 20 ++++++------------- | ||
1 file changed, 6 insertions(+), 14 deletions(-) | ||
|
||
diff --git a/scripts/cmake/z_vcpkg_fixup_install_name_rpath.cmake b/scripts/cmake/z_vcpkg_fixup_install_name_rpath.cmake | ||
index 2f07720938ece..f72927ad8a624 100644 | ||
--- a/scripts/cmake/z_vcpkg_fixup_install_name_rpath.cmake | ||
+++ b/scripts/cmake/z_vcpkg_fixup_install_name_rpath.cmake | ||
@@ -230,24 +230,16 @@ function(z_vcpkg_fixup_install_name_rpath_in_dir) | ||
install_name_tool_cmd | ||
NAMES install_name_tool | ||
DOC "Absolute path of install_name_tool cmd" | ||
+ REQUIRED | ||
) | ||
|
||
- if(NOT install_name_tool_cmd) | ||
- message(WARNING " install_name_tool not found!") | ||
- return() | ||
- endif() | ||
- | ||
find_program( | ||
otool_cmd | ||
NAMES otool | ||
DOC "Absolute path of otool cmd" | ||
+ REQUIRED | ||
) | ||
|
||
- if(NOT otool_cmd) | ||
- message(WARNING "otool not found!") | ||
- return() | ||
- endif() | ||
- | ||
message(DEBUG "Start fix install name and rpath for Mach-O files") | ||
|
||
# Iterate over the folders. DON'T change order! | ||
@@ -331,7 +323,7 @@ function(z_vcpkg_fixup_install_name_rpath_in_dir) | ||
) | ||
|
||
if(NOT set_install_name_rv EQUAL 0) | ||
- message(WARNING "Failed, install_name_tool -id ${id_name} ${file}, \n${set_install_name_ov}") | ||
+ message(FATAL_ERROR "Failed, install_name_tool -id ${id_name} ${file}, \n${set_install_name_ov}") | ||
continue() | ||
endif() | ||
endif() | ||
@@ -346,7 +338,7 @@ function(z_vcpkg_fixup_install_name_rpath_in_dir) | ||
) | ||
|
||
if(NOT set_rpath_rv EQUAL 0) | ||
- message(WARNING "Failed, install_name_tool -add_rpath ${rpath} ${file}, \n${set_rpath_ov}") | ||
+ message(FATAL_ERROR "Failed, install_name_tool -add_rpath ${rpath} ${file}, \n${set_rpath_ov}") | ||
continue() | ||
endif() | ||
|
||
@@ -400,7 +392,7 @@ function(z_vcpkg_fixup_install_name_rpath_in_dir) | ||
) | ||
|
||
if(NOT change_dep_install_name_rv EQUAL 0) | ||
- message(WARNING "Failed, install_name_tool -change ${dep_install_name} ${id_name} ${file}, \n${change_dep_install_name_ov}") | ||
+ message(FATAL_ERROR "Failed, install_name_tool -change ${dep_install_name} ${id_name} ${file}, \n${change_dep_install_name_ov}") | ||
continue() | ||
else() | ||
message(DEBUG "Fix ${file}: ${dep_install_name} to ${id_name}") | ||
@@ -416,4 +408,4 @@ function(z_vcpkg_fixup_install_name_rpath_in_dir) | ||
endforeach() | ||
endfunction() | ||
|
||
-z_vcpkg_fixup_install_name_rpath_in_dir() | ||
\ No newline at end of file | ||
+z_vcpkg_fixup_install_name_rpath_in_dir() | ||
|
||
From 7619e9e2e08317e3151e03f9947776c156a7dc3e Mon Sep 17 00:00:00 2001 | ||
From: Matthias Kuhn <[email protected]> | ||
Date: Sat, 3 Feb 2024 16:11:53 +0100 | ||
Subject: [PATCH 5/7] Remove extra function call | ||
|
||
--- | ||
scripts/cmake/z_vcpkg_fixup_install_name_rpath.cmake | 2 -- | ||
1 file changed, 2 deletions(-) | ||
|
||
diff --git a/scripts/cmake/z_vcpkg_fixup_install_name_rpath.cmake b/scripts/cmake/z_vcpkg_fixup_install_name_rpath.cmake | ||
index f72927ad8a624..33e062efe18c8 100644 | ||
--- a/scripts/cmake/z_vcpkg_fixup_install_name_rpath.cmake | ||
+++ b/scripts/cmake/z_vcpkg_fixup_install_name_rpath.cmake | ||
@@ -407,5 +407,3 @@ function(z_vcpkg_fixup_install_name_rpath_in_dir) | ||
endforeach() | ||
endforeach() | ||
endfunction() | ||
- | ||
-z_vcpkg_fixup_install_name_rpath_in_dir() | ||
|
||
From 4fe55167a9218b69980e843d035265a7a9df1962 Mon Sep 17 00:00:00 2001 | ||
From: Matthias Kuhn <[email protected]> | ||
Date: Sat, 3 Feb 2024 17:11:20 +0100 | ||
Subject: [PATCH 6/7] Use original dep install name for fixup | ||
|
||
--- | ||
scripts/cmake/z_vcpkg_fixup_install_name_rpath.cmake | 8 ++++---- | ||
1 file changed, 4 insertions(+), 4 deletions(-) | ||
|
||
diff --git a/scripts/cmake/z_vcpkg_fixup_install_name_rpath.cmake b/scripts/cmake/z_vcpkg_fixup_install_name_rpath.cmake | ||
index 33e062efe18c8..74a8691667ca1 100644 | ||
--- a/scripts/cmake/z_vcpkg_fixup_install_name_rpath.cmake | ||
+++ b/scripts/cmake/z_vcpkg_fixup_install_name_rpath.cmake | ||
@@ -364,9 +364,9 @@ function(z_vcpkg_fixup_install_name_rpath_in_dir) | ||
list(FILTER dep_install_names EXCLUDE REGEX "^/System/Library/.*(dylib|so)$") | ||
|
||
# Iterate over the filtered dependencies and fix their install names | ||
- foreach(dep_install_name IN LISTS dep_install_names) | ||
- string(REGEX MATCH "[^/]+(.dylib|.so)" dep_install_name "${dep_install_name}") | ||
- message(DEBUG "dep_install_name: ${dep_install_name}") | ||
+ foreach(orig_dep_install_name IN LISTS dep_install_names) | ||
+ string(REGEX MATCH "[^/]+(.dylib|.so)" dep_install_name "${orig_dep_install_name}") | ||
+ message(DEBUG "dep_install_name: ${dep_install_name} (${orig_dep_install_name})") | ||
|
||
if(type EQUAL 2) | ||
file(GLOB_RECURSE dep_files LIST_DIRECTORIES FALSE "${CURRENT_PACKAGES_DIR}/lib/${dep_install_name}") | ||
@@ -386,7 +386,7 @@ function(z_vcpkg_fixup_install_name_rpath_in_dir) | ||
message(DEBUG "${dep_install_name} match with ${dep_file} of install name ${id_name}") | ||
|
||
execute_process( | ||
- COMMAND "${install_name_tool_cmd}" -change "${dep_install_name}" "${id_name}" "${file}" | ||
+ COMMAND "${install_name_tool_cmd}" -change "${orig_dep_install_name}" "${id_name}" "${file}" | ||
OUTPUT_VARIABLE change_dep_install_name_ov | ||
RESULT_VARIABLE change_dep_install_name_rv | ||
) | ||
|
||
From 3c48d0602efab400be375067a4160583628dd09d Mon Sep 17 00:00:00 2001 | ||
From: Matthias Kuhn <[email protected]> | ||
Date: Tue, 12 Mar 2024 07:58:50 +0100 | ||
Subject: [PATCH 7/7] Run fixups | ||
|
||
--- | ||
scripts/cmake/z_vcpkg_fixup_install_name_rpath.cmake | 2 ++ | ||
1 file changed, 2 insertions(+) | ||
|
||
diff --git a/scripts/cmake/z_vcpkg_fixup_install_name_rpath.cmake b/scripts/cmake/z_vcpkg_fixup_install_name_rpath.cmake | ||
index 74a8691667ca1..226d820ea7b28 100644 | ||
--- a/scripts/cmake/z_vcpkg_fixup_install_name_rpath.cmake | ||
+++ b/scripts/cmake/z_vcpkg_fixup_install_name_rpath.cmake | ||
@@ -407,3 +407,5 @@ function(z_vcpkg_fixup_install_name_rpath_in_dir) | ||
endforeach() | ||
endforeach() | ||
endfunction() | ||
+ | ||
+z_vcpkg_fixup_install_name_rpath_in_dir() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.