gwenhywfar: change prefix detection for the cmake config file

The cmake configuration file for gwenhywfar always uses /usr as prefix
which causes issues while cross-compiling. This adds a patch to change
the detection to do it the same way most KDE/QT software does it.
This commit is contained in:
Helmut Pozimski 2018-01-10 16:06:34 +01:00 committed by Enno Boland
parent a4db03f6a8
commit 946bb21082
2 changed files with 93 additions and 2 deletions

View File

@ -0,0 +1,91 @@
--- gwenhywfar-config.cmake.in 2018-01-10 14:46:29.110367258 +0100
+++ 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@")
--- gui/qt4/gwengui-qt4-config.cmake.in 2018-01-10 16:45:24.121341582 +0100
+++ 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@")
--- gui/cpp/gwengui-cpp-config.cmake.in 2018-01-10 16:45:30.860247916 +0100
+++ 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@")
--- gui/qt5/gwengui-qt5-config.cmake.in 2018-01-10 16:45:39.551127015 +0100
+++ 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@")

View File

@ -1,7 +1,7 @@
# Template file for 'gwenhywfar'
pkgname=gwenhywfar
version=4.18.0
revision=1
revision=2
_dnrel=206
hostmakedepends="automake pkg-config libgcrypt-devel libtool"
makedepends="libgcrypt-devel gnutls-devel gtk+-devel qt-devel qt5-devel"
@ -12,7 +12,7 @@ configure_args="--enable-visibility --disable-binreloc
--with-qt5-includes=${XBPS_CROSS_BASE}/usr/include --with-qt5-libs=${XBPS_CROSS_BASE}/usr/lib
--with-qt5-moc=/usr/lib/qt5/bin/moc --with-qt5-uic=/usr/lib/qt5/bin/uic"
maintainer="Enno Boland <gottox@voidlinux.eu>"
license="LGPL"
license="LGPL-2.1"
homepage="http://www.aquamaniac.de"
short_desc="OS abstraction functions for various projects"
distfiles="http://www2.aquamaniac.de/sites/download/download.php?package=01&release=${_dnrel}&file=01&dummy=gwenhywfar-$version.tar.gz"