From 37296ca0b3df6fbac49073b6bd95f9e7bc62dc09 Mon Sep 17 00:00:00 2001
From: Helmut Pozimski <helmut@pozimski.eu>
Date: Mon, 13 Jan 2020 08:42:32 +0100
Subject: [PATCH] gwenhywfar: update to 5.1.0. (soname bump)

---
 common/shlibs                              |  2 +-
 srcpkgs/gwenhywfar/patches/qt5-cross.patch | 28 +++++++++++++
 srcpkgs/gwenhywfar/template                | 46 +++++++++++++++++-----
 3 files changed, 65 insertions(+), 11 deletions(-)
 create mode 100644 srcpkgs/gwenhywfar/patches/qt5-cross.patch

diff --git a/common/shlibs b/common/shlibs
index 51692ea249..8ea6617ba7 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -1484,7 +1484,7 @@ libdom.so.0 libdom-0.0.1_1
 libslang.so.2 slang-2.2.4_1
 libtre.so.5 tre-0.8.0_1
 libktoblzcheck.so.1 ktoblzcheck-1.43_2
-libgwenhywfar.so.60 gwenhywfar-4.10.0beta_1
+libgwenhywfar.so.79 gwenhywfar-5.1.0_1
 libgwengui-gtk2.so.0 gwenhywfar-gtk-4.10.0beta_1
 libgwengui-gtk3.so.0 gwenhywfar-gtk3-4.20.0_1
 libgwengui-cpp.so.0 gwenhywfar-4.10.0beta_1
diff --git a/srcpkgs/gwenhywfar/patches/qt5-cross.patch b/srcpkgs/gwenhywfar/patches/qt5-cross.patch
new file mode 100644
index 0000000000..41b447e2b7
--- /dev/null
+++ b/srcpkgs/gwenhywfar/patches/qt5-cross.patch
@@ -0,0 +1,28 @@
+--- m4/ax_have_qt.m4.ORIG	2020-01-16 19:40:22.927813462 +0100
++++ m4/ax_have_qt.m4	2020-01-16 19:42:12.106436543 +0100
+@@ -74,6 +74,12 @@
+     [QT_QMAKE="qmake"]
+   )
+ 
++  AC_ARG_WITH(qt5-config,
++    [  --with-qt5-config=FILE   uses given qt configuration],
++    [QT_CONFIGURATION="$withval"],
++    [QT_CONFIGURATION=""]
++  )
++
+   AC_MSG_CHECKING(for Qt)
+   # If we have Qt5 or later in the path, we're golden
+   ver=`$QT_QMAKE --version | grep -o "Qt version ."`
+@@ -122,7 +128,11 @@
+ percent.commands = @echo -n "\$(\$(@))\ "
+ QMAKE_EXTRA_TARGETS += percent
+ EOF
+-    $QT_QMAKE $am_have_qt_pro -o $am_have_qt_makefile
++    if test -z $QT_CONFIGURATION; then
++        $QT_QMAKE $am_have_qt_pro -o $am_have_qt_makefile
++    else
++        $QT_QMAKE $am_have_qt_pro -o $am_have_qt_makefile -qtconf $QT_CONFIGURATION
++    fi
+     QT_CXXFLAGS=`make -s -f $am_have_qt_makefile CXXFLAGS INCPATH`
+     QT_LIBS=`make -s -f $am_have_qt_makefile LIBS`
+     rm $am_have_qt_pro $am_have_qt_makefile
diff --git a/srcpkgs/gwenhywfar/template b/srcpkgs/gwenhywfar/template
index 2407ac90bc..2cc807c20a 100644
--- a/srcpkgs/gwenhywfar/template
+++ b/srcpkgs/gwenhywfar/template
@@ -1,20 +1,18 @@
 # Template file for 'gwenhywfar'
 pkgname=gwenhywfar
-version=4.20.1
-revision=3
-hostmakedepends="automake pkg-config libgcrypt-devel libtool"
-makedepends="libgcrypt-devel gnutls-devel gtk+-devel qt5-devel gtk+3-devel"
+version=5.1.0
+revision=1
 build_style=gnu-configure
 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.org>"
-license="LGPL-2.1"
+hostmakedepends="automake pkg-config libgcrypt-devel libtool which"
+makedepends="libgcrypt-devel gnutls-devel gtk+-devel qt5-devel gtk+3-devel"
 short_desc="OS abstraction functions for various projects"
+maintainer="Enno Boland <gottox@voidlinux.org>"
+license="LGPL-2.1-or-later"
 homepage="https://github.com/aqbanking/gwenhywfar"
 distfiles="https://github.com/aqbanking/gwenhywfar/archive/${version}.tar.gz"
-checksum=efc4b9dcb51981e7c56e22ac6054ace396c3387667b134128d4e9fcad50544b8
+checksum=414a29c0f28cb8172b780f2aa71a8408ce0b379304714949190398fde3bcbfbf
 
 if [ "$CROSS_BUILD" ]; then
 	hostmakedepends+=" qt5-host-tools qt5-devel"
@@ -22,8 +20,36 @@ fi
 
 pre_configure() {
 	# Build all GUIs
-	sed -i configure.ac -e's;"qt4 gtk2";"qt5 gtk2 gtk3";'
+	vsed -i configure.ac -e's;"qt4 gtk2";"qt5 gtk2 gtk3";'
 	autoreconf -fi
+	if [ "$CROSS_BUILD" ]; then
+                cat > "${wrksrc}/qt.conf" <<_EOF
+[Paths]
+Sysroot=${XBPS_CROSS_BASE}
+Prefix=${XBPS_CROSS_BASE}/usr
+ArchData=${XBPS_CROSS_BASE}/usr/lib/qt5
+Data=${XBPS_CROSS_BASE}/usr/share/qt5
+Documentation=${XBPS_CROSS_BASE}/usr/share/doc/qt5
+Headers=${XBPS_CROSS_BASE}/usr/include/qt5
+Libraries=${XBPS_CROSS_BASE}/usr/lib
+LibraryExecutables=/usr/lib/qt5/libexec
+Binaries=/usr/lib/qt5/bin
+Tests=${XBPS_CROSS_BASE}/usr/tests
+Plugins=/usr/lib/qt5/plugins
+Imports=${XBPS_CROSS_BASE}/usr/lib/qt5/imports
+Qml2Imports=${XBPS_CROSS_BASE}/usr/lib/qt5/qml
+Translations=${XBPS_CROSS_BASE}/usr/share/qt5/translations
+Settings=${XBPS_CROSS_BASE}/etc/xdg
+Examples=${XBPS_CROSS_BASE}/usr/share/qt5/examples
+HostPrefix=/usr
+HostData=/usr/lib/qt5
+HostBinaries=/usr/lib/qt5/bin
+HostLibraries=/usr/lib
+Spec=linux-g++
+TargetSpec=linux-g++
+_EOF
+	configure_args+=" --with-qt5-config=${wrksrc}/qt.conf"
+        fi
 }
 
 gwenhywfar-gtk_package() {