void-packages/srcpkgs/gwenhywfar/patches/cmake-prefix.patch
Đoàn Trần Công Danh 7fc9190f0e srcpkgs/g*: convert patches to -Np1
* gcc is kept at -Np0, because of void-cross

```sh
git grep -l '^patch_args=-Np0' "srcpkgs/$1*/template" |
while read template; do
	for p in ${template%/template}/patches/*; do
		sed -i '
			\,^[+-][+-][+-] /dev/null,b
			/^[*-]\+ [0-9]\+\(,[0-9]\+\)\? [*-]\+$/b
			s,^[*][*][*] ,&a/,
			/^--- /{
				s,\(^--- \)\(./\)*,\1a/,
				s,[.][Oo][Rr][Ii][Gg]\([	/]\),\1,
				s/[.][Oo][Rr][Ii][Gg]$//
				s/[.]patched[.]\([^.]\)/.\1/
				h
			}
			/^+++ -/{
				g
				s/^--- a/+++ b/
				b
			}
			s,\(^+++ \)\(./\)*,\1b/,
		' "$p"
	done
	sed -i '/^patch_args=/d' $template
done
```
2021-06-20 13:17:29 +07:00

92 lines
3.6 KiB
Diff

--- a/gwenhywfar-config.cmake.in 2018-01-10 14:46:29.110367258 +0100
+++ b/gwenhywfar-config.cmake.in 2018-01-10 15:00:33.544490115 +0100
@@ -19,7 +19,18 @@
endforeach()
endmacro()
-set_and_check(prefix "@prefix@")
+get_filename_component(prefix "${CMAKE_CURRENT_LIST_DIR}/../../../" ABSOLUTE)
+
+# Use original install prefix when loaded through a "/usr move"
+# cross-prefix symbolic link such as /lib -> /usr/lib.
+get_filename_component(_realCurr "${CMAKE_CURRENT_LIST_DIR}" REALPATH)
+get_filename_component(_realOrig "@prefix@/lib/cmake/gwenhywfar-@GWENHYWFAR_VERSION_MAJOR@.@GWENHYWFAR_VERSION_MINOR@" REALPATH)
+if(_realCurr STREQUAL _realOrig)
+ set(prefix "/usr")
+endif()
+unset(_realOrig)
+unset(_realCurr)
+
set_and_check(exec_prefix "@exec_prefix@")
set_and_check(includedir "@includedir@")
set_and_check(GWENHYWFAR_INCLUDE_DIRS "@gwenhywfar_headerdir@")
--- a/gui/qt4/gwengui-qt4-config.cmake.in 2018-01-10 16:45:24.121341582 +0100
+++ b/gui/qt4/gwengui-qt4-config.cmake.in 2018-01-10 16:48:25.082803122 +0100
@@ -40,7 +40,18 @@
return()
endif()
-set_and_check(prefix "@prefix@")
+get_filename_component(prefix "${CMAKE_CURRENT_LIST_DIR}/../../../" ABSOLUTE)
+
+# Use original install prefix when loaded through a "/usr move"
+# cross-prefix symbolic link such as /lib -> /usr/lib.
+get_filename_component(_realCurr "${CMAKE_CURRENT_LIST_DIR}" REALPATH)
+get_filename_component(_realOrig "@prefix@/lib/cmake/gwengui-qt4-@GWENHYWFAR_VERSION_MAJOR@.@GWENHYWFAR_VERSION_MINOR@" REALPATH)
+if(_realCurr STREQUAL _realOrig)
+ set(prefix "/usr")
+endif()
+unset(_realOrig)
+unset(_realCurr)
+
set_and_check(exec_prefix "@exec_prefix@")
set_and_check(includedir "@includedir@")
set_and_check(${CMAKE_FIND_PACKAGE_NAME}_INCLUDE_DIRS "@gwenhywfar_headerdir@")
--- a/gui/cpp/gwengui-cpp-config.cmake.in 2018-01-10 16:45:30.860247916 +0100
+++ b/gui/cpp/gwengui-cpp-config.cmake.in 2018-01-10 16:47:54.086241064 +0100
@@ -21,7 +21,18 @@
include(CMakeFindDependencyMacro)
find_dependency(gwenhywfar "@GWENHYWFAR_VERSION_STRING@")
-set_and_check(prefix "@prefix@")
+get_filename_component(prefix "${CMAKE_CURRENT_LIST_DIR}/../../../" ABSOLUTE)
+
+# Use original install prefix when loaded through a "/usr move"
+# cross-prefix symbolic link such as /lib -> /usr/lib.
+get_filename_component(_realCurr "${CMAKE_CURRENT_LIST_DIR}" REALPATH)
+get_filename_component(_realOrig "@prefix@/lib/cmake/gwengui-cpp-@GWENHYWFAR_VERSION_MAJOR@.@GWENHYWFAR_VERSION_MINOR@" REALPATH)
+if(_realCurr STREQUAL _realOrig)
+ set(prefix "/usr")
+endif()
+unset(_realOrig)
+unset(_realCurr)
+
set_and_check(exec_prefix "@exec_prefix@")
set_and_check(includedir "@includedir@")
set_and_check(GWENGUI_CPP_INCLUDE_DIRS "@gwenhywfar_headerdir@")
--- a/gui/qt5/gwengui-qt5-config.cmake.in 2018-01-10 16:45:39.551127015 +0100
+++ b/gui/qt5/gwengui-qt5-config.cmake.in 2018-01-10 16:48:51.927422936 +0100
@@ -23,8 +23,18 @@
find_dependency(Qt5Core)
find_dependency(Qt5Widgets)
+get_filename_component(prefix "${CMAKE_CURRENT_LIST_DIR}/../../../" ABSOLUTE)
+
+# Use original install prefix when loaded through a "/usr move"
+# cross-prefix symbolic link such as /lib -> /usr/lib.
+get_filename_component(_realCurr "${CMAKE_CURRENT_LIST_DIR}" REALPATH)
+get_filename_component(_realOrig "@prefix@/lib/cmake/gwengui-qt5-@GWENHYWFAR_VERSION_MAJOR@.@GWENHYWFAR_VERSION_MINOR@" REALPATH)
+if(_realCurr STREQUAL _realOrig)
+ set(prefix "/usr")
+endif()
+unset(_realOrig)
+unset(_realCurr)
-set_and_check(prefix "@prefix@")
set_and_check(exec_prefix "@exec_prefix@")
set_and_check(includedir "@includedir@")
set_and_check(${CMAKE_FIND_PACKAGE_NAME}_INCLUDE_DIRS "@gwenhywfar_headerdir@")