Github messages for voidlinux
 help / color / mirror / Atom feed
* [PR PATCH] qwt: add qt6 packages
@ 2023-10-26 16:41 ahesford
  2023-10-26 20:22 ` [PR PATCH] [Updated] " ahesford
  2023-10-28  1:56 ` [PR PATCH] [Closed]: " ahesford
  0 siblings, 2 replies; 3+ messages in thread
From: ahesford @ 2023-10-26 16:41 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 780 bytes --]

There is a new pull request by ahesford against master on the void-packages repository

https://github.com/ahesford/void-packages qwt-qt6
https://github.com/void-linux/void-packages/pull/46911

qwt: add qt6 packages
Qwt can be built with Qt5 or Qt6. Unfortunately, `gnuradio` remains wed to Qt5, so we still need a Qt5 version. The other dependant, `linssid`, can be built with Qt6 with a trivial patch. For now, we can install `qwt` for both Qt5 and Qt6, and we can drop the `-qt6` packages when the Qt5 variant becomes obsolete.

#### Testing the changes
- I tested the changes in this PR: **yes** (`linssid` launches, locally built software that uses qwt works fine for Qt5 and Qt6)

A patch file from https://github.com/void-linux/void-packages/pull/46911.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-qwt-qt6-46911.patch --]
[-- Type: text/x-diff, Size: 15324 bytes --]

From 6f28052729cb1587a353d30c62f6547f46d03f63 Mon Sep 17 00:00:00 2001
From: "Andrew J. Hesford" <ajh@sideband.org>
Date: Wed, 25 Oct 2023 14:52:02 -0400
Subject: [PATCH 1/4] qwt: add qt6 packages

---
 common/shlibs                       |   3 +-
 srcpkgs/qwt-headers                 |   1 +
 srcpkgs/qwt-qt6                     |   1 +
 srcpkgs/qwt-qt6-devel               |   1 +
 srcpkgs/qwt/patches/locations.patch |  40 +++++++++
 srcpkgs/qwt/patches/multi-qt.patch  |  54 ++++++++++++
 srcpkgs/qwt/template                | 124 ++++++++++++++++++++++++----
 7 files changed, 206 insertions(+), 18 deletions(-)
 create mode 120000 srcpkgs/qwt-headers
 create mode 120000 srcpkgs/qwt-qt6
 create mode 120000 srcpkgs/qwt-qt6-devel
 create mode 100644 srcpkgs/qwt/patches/locations.patch
 create mode 100644 srcpkgs/qwt/patches/multi-qt.patch

diff --git a/common/shlibs b/common/shlibs
index 67e0812c68e19..f99d5d3c69374 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -1949,7 +1949,8 @@ libQt5WebKitWidgets.so.5 qt5-webkit-5.6.0_1
 libx265.so.199 x265-3.5_1
 libQt5Xdg.so.3 libqtxdg-3.1.0_1
 libQt5XdgIconLoader.so.3 libqtxdg-3.1.0_1
-libqwt.so.6.2 qwt-6.2.0_1
+libqwt-qt5.so.6.2 qwt-6.2.0_2
+libqwt-qt6.so.6.2 qwt-qt6-6.2.0_2
 liblxqt-qt5.so.0 liblxqt-0.8.0_1
 liblxqt-globalkeys-qt5.so.0 lxqt-globalkeys-0.8.0_1
 liblxqt-globalkeys-ui-qt5.so.0 lxqt-globalkeys-0.8.0_1
diff --git a/srcpkgs/qwt-headers b/srcpkgs/qwt-headers
new file mode 120000
index 0000000000000..120b77f854709
--- /dev/null
+++ b/srcpkgs/qwt-headers
@@ -0,0 +1 @@
+qwt
\ No newline at end of file
diff --git a/srcpkgs/qwt-qt6 b/srcpkgs/qwt-qt6
new file mode 120000
index 0000000000000..120b77f854709
--- /dev/null
+++ b/srcpkgs/qwt-qt6
@@ -0,0 +1 @@
+qwt
\ No newline at end of file
diff --git a/srcpkgs/qwt-qt6-devel b/srcpkgs/qwt-qt6-devel
new file mode 120000
index 0000000000000..120b77f854709
--- /dev/null
+++ b/srcpkgs/qwt-qt6-devel
@@ -0,0 +1 @@
+qwt
\ No newline at end of file
diff --git a/srcpkgs/qwt/patches/locations.patch b/srcpkgs/qwt/patches/locations.patch
new file mode 100644
index 0000000000000..a5765d64eeb4a
--- /dev/null
+++ b/srcpkgs/qwt/patches/locations.patch
@@ -0,0 +1,40 @@
+--- a/qwtconfig.pri
++++ b/qwtconfig.pri
+@@ -19,7 +19,7 @@
+ QWT_INSTALL_PREFIX = $$[QT_INSTALL_PREFIX]
+ 
+ unix {
+-    QWT_INSTALL_PREFIX    = /usr/local/qwt-$$QWT_VERSION
++    QWT_INSTALL_PREFIX    = /usr
+     # QWT_INSTALL_PREFIX = /usr/local/qwt-$$QWT_VERSION-qt-$$QT_VERSION
+ }
+ 
+@@ -28,8 +28,8 @@
+     # QWT_INSTALL_PREFIX = C:/Qwt-$$QWT_VERSION-qt-$$QT_VERSION
+ }
+ 
+-QWT_INSTALL_DOCS      = $${QWT_INSTALL_PREFIX}/doc
+-QWT_INSTALL_HEADERS   = $${QWT_INSTALL_PREFIX}/include
++QWT_INSTALL_DOCS      = $${QWT_INSTALL_PREFIX}/share/doc/qwt
++QWT_INSTALL_HEADERS   = $${QWT_INSTALL_PREFIX}/include/qwt
+ QWT_INSTALL_LIBS      = $${QWT_INSTALL_PREFIX}/lib
+ 
+ ######################################################################
+@@ -49,7 +49,7 @@
+ # path. Also QT_INSTALL_PREFIX is only one of the default
+ # search paths of the designer - not the Qt creator
+ 
+-#QWT_INSTALL_PLUGINS   = $$[QT_INSTALL_PREFIX]/plugins/designer
++QWT_INSTALL_PLUGINS   = /usr/lib/qt$${QT_MAJOR_VERSION}/plugins/designer
+ 
+ ######################################################################
+ # Features
+@@ -64,7 +64,7 @@
+ ######################################################################
+ 
+ QWT_INSTALL_FEATURES  = $${QWT_INSTALL_PREFIX}/features
+-# QWT_INSTALL_FEATURES  = $$[QT_INSTALL_PREFIX]/features
++QWT_INSTALL_FEATURES  = /usr/lib/qt$${QT_MAJOR_VERSION}/mkspecs/features
+ 
+ ######################################################################
+ # Build the static/shared libraries.
diff --git a/srcpkgs/qwt/patches/multi-qt.patch b/srcpkgs/qwt/patches/multi-qt.patch
new file mode 100644
index 0000000000000..e8f901d7ad67a
--- /dev/null
+++ b/srcpkgs/qwt/patches/multi-qt.patch
@@ -0,0 +1,54 @@
+diff -ur a/qwtfunctions.pri b/qwtfunctions.pri
+--- a/qwtfunctions.pri	2021-07-18 07:19:33.644367625 -0400
++++ b/qwtfunctions.pri	2023-10-26 10:12:25.650218378 -0400
+@@ -12,7 +12,7 @@
+ defineReplace(qwtLibraryTarget) {
+ 
+     unset(LIBRARY_NAME)
+-    LIBRARY_NAME = $$1
++    LIBRARY_NAME = $${1}-qt$${QT_MAJOR_VERSION}
+ 
+     mac:contains(QWT_CONFIG, QwtFramework) {
+ 
+@@ -36,7 +36,7 @@
+ defineTest(qwtAddLibrary) {
+ 
+     LIB_PATH = $$1
+-    LIB_NAME = $$2
++    LIB_NAME = $${2}-qt$${QT_MAJOR_VERSION}
+ 
+     mac:contains(QWT_CONFIG, QwtFramework) {
+ 
+diff -ur a/src/src.pro b/src/src.pro
+--- a/src/src.pro	2021-07-18 07:19:33.628367286 -0400
++++ b/src/src.pro	2023-10-26 10:11:09.320983554 -0400
+@@ -31,7 +31,7 @@
+     
+             # we increase the SONAME for every minor number
+ 
+-            QWT_SONAME=libqwt.so.$${VER_MAJ}.$${VER_MIN}
++            QWT_SONAME=libqwt-qt$${QT_MAJOR_VERSION}.so.$${VER_MAJ}.$${VER_MIN}
+             QMAKE_LFLAGS *= $${QMAKE_LFLAGS_SONAME}$${QWT_SONAME}
+             QMAKE_LFLAGS_SONAME=
+         }
+@@ -82,14 +82,17 @@
+     greaterThan(QT_MAJOR_VERSION, 4) {
+ 
+         QMAKE_PKGCONFIG_FILE = Qt$${QT_MAJOR_VERSION}$${QMAKE_PKGCONFIG_NAME}
+-        QMAKE_PKGCONFIG_REQUIRES = Qt5Widgets Qt5Concurrent Qt5PrintSupport
++
++        QMAKE_PKGCONFIG_REQUIRES = Qt$${QT_MAJOR_VERSION}Widgets
++        QMAKE_PKGCONFIG_REQUIRES += Qt$${QT_MAJOR_VERSION}Concurrent
++        QMAKE_PKGCONFIG_REQUIRES += Qt$${QT_MAJOR_VERSION}PrintSupport
+ 
+         contains(QWT_CONFIG, QwtSvg) {
+-            QMAKE_PKGCONFIG_REQUIRES += Qt5Svg
++            QMAKE_PKGCONFIG_REQUIRES += Qt$${QT_MAJOR_VERSION}Svg
+         }
+ 
+         contains(QWT_CONFIG, QwtOpenGL) {
+-            QMAKE_PKGCONFIG_REQUIRES += Qt5OpenGL
++            QMAKE_PKGCONFIG_REQUIRES += Qt$${QT_MAJOR_VERSION}OpenGL
+         }
+ 
+         QMAKE_DISTCLEAN += $${DESTDIR}/$${QMAKE_PKGCONFIG_DESTDIR}/$${QMAKE_PKGCONFIG_FILE}.pc
diff --git a/srcpkgs/qwt/template b/srcpkgs/qwt/template
index b5fdae7aa7fd6..721e7d5b4082f 100644
--- a/srcpkgs/qwt/template
+++ b/srcpkgs/qwt/template
@@ -1,10 +1,12 @@
 # Template file for 'qwt'
 pkgname=qwt
 version=6.2.0
-revision=1
+revision=2
 build_style=qmake
-hostmakedepends="qt5-qmake qt5-host-tools"
-makedepends="qt5-tools-devel qt5-svg-devel"
+hostmakedepends="qt6-base qt6-tools qt5-qmake qt5-host-tools"
+_makedepends_qt6="qt6-tools-devel qt6-svg-devel"
+_makedepends_qt5="${_makedepends_qt6//qt6/qt5}"
+makedepends="${_makedepends_qt6} ${_makedepends_qt5}"
 short_desc="Qt Widgets for Technical Applications"
 maintainer="Giuseppe Fierro <gspe@ae-design.ws>"
 license="LGPL-2.1-only, Qwt-exception-1.0"
@@ -12,32 +14,120 @@ homepage="https://qwt.sourceforge.io/"
 distfiles="https://sourceforge.net/projects/${pkgname}/files/${pkgname}/${version}/${pkgname}-${version}.tar.bz2"
 checksum=9194f6513955d0fd7300f67158175064460197abab1a92fa127a67a4b0b71530
 
-post_patch() {
-	vsed -e '/^\s*QWT_INSTALL_PREFIX/ s|=.*|= /usr|' \
-		-e '/^QWT_INSTALL_DOCS/ s|/doc|/share/doc/qwt|' \
-		-e '/^QWT_INSTALL_HEADERS/ s|include|&/qwt|' \
-		-e '/^QWT_INSTALL_PLUGINS/ s|plugins/designer|lib/qt5/&|' \
-		-e '/^QWT_INSTALL_FEATURES/ s|features|lib/qt5/mkspecs/&|' \
-		-i qwtconfig.pri
+_qt5_conf_to_qt6() {
+	[ -z "${CROSS_BUILD}" ] && return 0
+
+	local f sdir dspec dname
+	dname="linux-g++"
+	for sdir in .host-spec .target-spec; do
+		dspec="${sdir}-qt6/${dname}"
+		mkdir -p "${dspec}"
+		for f in "${sdir}/${dname}"/*; do
+			[ -f "${f}" ] || continue
+			sed 's/qt5/qt6/g' "${f}" > "${dspec}/${f##*/}"
+		done
+	done
+
+	sed -e 's/qt5/qt6/g' -e "s@-spec/@-spec-qt6/@g" qt.conf > qt6.conf
+}
+
+post_configure() {
+	local qmake_args _qt_arch
+
+	if [ -n "${CROSS_BUILD}" ]; then
+		case "${XBPS_TARGET_MACHINE}" in
+			i686*) _qt_arch=i386;;
+			x86_64*) _qt_arch=x86_64;;
+			aarch*) _qt_arch=arm64;;
+			arm*) _qt_arch=arm;;
+			mips*) _qt_arch=mips;;
+			ppc64*) _qt_arch=power64;;
+			ppc*) _qt_arch=power;;
+		esac
+
+		qmake_args=(
+			"-qtconf" "${wrksrc}/qt6.conf"
+			"QT_TARGET_ARCH=${_qt_arch}"
+			"PKG_CONFIG_EXECUTABLE=${XBPS_WRAPPERDIR}/${PKG_CONFIG}"
+		)
+
+		_qt5_conf_to_qt6
+	else
+		qmake_args=(
+			"QMAKE_CC=${CC}" "QMAKE_CXX=${CXX}"
+			"QMAKE_LINK=${CXX}" "QMAKE_LINK_C=${CC}"
+			"QMAKE_CFLAGS=${CFLAGS}" "QMAKE_CXXFLAGS=${CXXFLAGS}"
+			"QMAKE_LFLAGS=${LDFLAGS}" "CONFIG+=no_qt_rpath"
+		)
+	fi
+
+	mkdir -p build-qt6
+	cd build-qt6
+	/usr/lib/qt6/bin/qmake "${qmake_args[@]}" \
+		PREFIX=/usr QT_INSTALL_PREFIX=/usr LIB=/usr/lib ..
+}
+
+do_build() {
+	make ${makejobs} CC="$CC" CXX="$CXX" LINK="$CXX"
+	make ${makejobs} -C build-qt6 CC="$CC" CXX="$CXX" LINK="$CXX"
 }
 
-post_install() {
+do_install() {
+	for build_root in . build-qt6; do
+		make -C "${build_root}" STRIP=true PREFIX=/usr \
+			DESTDIR="${DESTDIR}" INSTALL_ROOT="${DESTDIR}" install
+	done
+
+	# This is Qt5 only, so it will be installed in qwt-devel
+	rm "${DESTDIR}/usr/include/qwt/qwt_plot_glcanvas.h"
+
 	vlicense COPYING
 }
 
-qwt-devel_package() {
-	depends="${makedepends} ${sourcepkg}-${version}_${revision}"
-	short_desc+=" - development files"
+qwt-qt6_package() {
+	short_desc+=" (Qt6)"
+	pkg_install() {
+		vmove "usr/lib/libqwt-qt6.so.*"
+		vlicense COPYING
+	}
+}
+
+qwt-headers_package() {
+	short_desc+=" - Qt5/Qt6 common headers"
 	pkg_install() {
 		vmove usr/include
-		vmove "usr/lib/*.so"
+		vlicense COPYING
+	}
+}
+
+qwt-devel_package() {
+	depends="${sourcepkg}-${version}_${revision}
+	 qwt-headers-${version}_${revision} ${_makedepends_qt5}"
+	short_desc+=" - Qt5 development files"
+	pkg_install() {
+		vmove "usr/lib/*-qt5.so"
 		vmove usr/lib/qt5
-		vmove usr/lib/pkgconfig
+		vmove usr/lib/pkgconfig/Qt5*
+
+		vmkdir usr/include/qwt
+		vcopy "src/qwt_plot_glcanvas.h" usr/include/qwt
+
+	}
+}
+
+qwt-qt6-devel_package() {
+	depends="qwt-qt6-${version}_${revision}
+	 qwt-headers-${version}_${revision} ${_makedepends_qt6}"
+	short_desc+=" - Qt6 development files"
+	pkg_install() {
+		vmove "usr/lib/*-qt6.so"
+		vmove usr/lib/qt6
+		vmove usr/lib/pkgconfig/Qt6*
 	}
 }
 
 qwt-doc_package() {
-	depends="${makedepends} ${sourcepkg}-${version}_${revision}"
+	depends="${sourcepkg}-${version}_${revision}"
 	short_desc+=" - doc files"
 	pkg_install() {
 		vmove usr/share/doc

From 1b2ac50388e8ed247fb8806b93d5945412b1a5cf Mon Sep 17 00:00:00 2001
From: "Andrew J. Hesford" <ajh@sideband.org>
Date: Wed, 25 Oct 2023 15:04:27 -0400
Subject: [PATCH 2/4] linssid: build with qt6

---
 srcpkgs/linssid/patches/project.patch |  5 +++--
 srcpkgs/linssid/patches/qt-6.5.patch  | 24 ++++++++++++++++++++++++
 srcpkgs/linssid/template              |  7 +++----
 3 files changed, 30 insertions(+), 6 deletions(-)
 create mode 100644 srcpkgs/linssid/patches/qt-6.5.patch

diff --git a/srcpkgs/linssid/patches/project.patch b/srcpkgs/linssid/patches/project.patch
index 8adc2028ec412..7fc92012dc93b 100644
--- a/srcpkgs/linssid/patches/project.patch
+++ b/srcpkgs/linssid/patches/project.patch
@@ -24,8 +24,9 @@
  INCLUDEPATH += /usr/include/qwt
  LIBS += -lboost_regex
 -LIBS += /usr/lib/libqwt-qt5.so.6
-+LIBS += -lqwt
- QMAKE_CXXFLAGS += -std=c++11
+-QMAKE_CXXFLAGS += -std=c++11
++LIBS += -lqwt-qt6
++QMAKE_CXXFLAGS += -std=c++17
  #
  TARGET = linssid
 -target.path = /usr/sbin
diff --git a/srcpkgs/linssid/patches/qt-6.5.patch b/srcpkgs/linssid/patches/qt-6.5.patch
new file mode 100644
index 0000000000000..e162970ae02a5
--- /dev/null
+++ b/srcpkgs/linssid/patches/qt-6.5.patch
@@ -0,0 +1,24 @@
+--- ./linssid-app/MainForm.cpp.orig	2023-10-25 14:47:34.411697129 -0400
++++ ./linssid-app/MainForm.cpp	2023-10-25 14:50:20.485975281 -0400
+@@ -924,10 +924,10 @@
+                 setData(Qt::DisplayRole, MainForm::cellDataRay[row].cenChan);
+         MainForm::cellDataRay[row].pTableItem[CENCHAN]->setTextAlignment(Qt::AlignCenter);
+         MainForm::cellDataRay[row].pTableItem[FIRST_SEEN]->
+-                setText(QDateTime::fromTime_t(MainForm::cellDataRay[row].firstSeen).toString("MM/dd-hh:mm:ss"));
++                setText(QDateTime::fromSecsSinceEpoch(MainForm::cellDataRay[row].firstSeen).toString("MM/dd-hh:mm:ss"));
+         MainForm::cellDataRay[row].pTableItem[FIRST_SEEN]->setTextAlignment(Qt::AlignCenter);
+         MainForm::cellDataRay[row].pTableItem[LAST_SEEN]->
+-                setText(QDateTime::fromTime_t(MainForm::cellDataRay[row].lastSeen).toString("MM/dd-hh:mm:ss"));
++                setText(QDateTime::fromSecsSinceEpoch(MainForm::cellDataRay[row].lastSeen).toString("MM/dd-hh:mm:ss"));
+         MainForm::cellDataRay[row].pTableItem[LAST_SEEN]->setTextAlignment(Qt::AlignCenter);
+         MainForm::cellDataRay[row].pTableItem[VENDOR]->
+                 setText(MainForm::cellDataRay[row].vendor.c_str());
+@@ -1127,7 +1127,7 @@
+     MainForm::cellDataRay[tbi].pTableItem[PLOT]->setFlags(
+             Qt::ItemIsEnabled | Qt::ItemIsUserCheckable | Qt::ItemIsEditable);
+     MainForm::cellDataRay[tbi].pTableItem[PLOT]->setCheckState(Qt::Checked);
+-    MainForm::cellDataRay[tbi].pTableItem[SSID]->setTextColor(MainForm::cellDataRay[tbi].color);
++    MainForm::cellDataRay[tbi].pTableItem[SSID]->setForeground(MainForm::cellDataRay[tbi].color);
+ }
+ 
+ void MainForm::extractData(string tl, int &tbi, int &newBSS) {
diff --git a/srcpkgs/linssid/template b/srcpkgs/linssid/template
index 56aacccc327c7..684ac2fb0d7be 100644
--- a/srcpkgs/linssid/template
+++ b/srcpkgs/linssid/template
@@ -1,11 +1,10 @@
 # Template file for 'linssid'
 pkgname=linssid
 version=3.6
-revision=5
+revision=6
 build_style=qmake
-hostmakedepends="qt5-qmake qt5-host-tools"
-makedepends="boost-devel qwt-devel"
-depends="qt5-svg"
+hostmakedepends="qt6-base qt6-tools"
+makedepends="boost-devel qwt-qt6-devel"
 short_desc="Graphical wireless AP scanner"
 maintainer="Piraty <mail@piraty.dev>"
 license="GPL-3.0-only"

From 85308383d67e78865f9503bd82c0ee2df4642449 Mon Sep 17 00:00:00 2001
From: "Andrew J. Hesford" <ajh@sideband.org>
Date: Wed, 25 Oct 2023 15:07:14 -0400
Subject: [PATCH 3/4] XyGrib: fix build dependencies

---
 srcpkgs/XyGrib/template | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/XyGrib/template b/srcpkgs/XyGrib/template
index b2a1272d5a9f2..fca36be155e18 100644
--- a/srcpkgs/XyGrib/template
+++ b/srcpkgs/XyGrib/template
@@ -1,11 +1,11 @@
 # Template file for 'XyGrib'
 pkgname=XyGrib
 version=1.2.6.1
-revision=4
+revision=5
 build_style=cmake
 hostmakedepends="qt5-devel pkg-config"
 makedepends="jasper-devel libnova-devel nettle-devel proj-devel qt5-devel
- qwt-devel libopenjpeg2-devel"
+ qt5-tools-devel libopenjpeg2-devel"
 short_desc="Weather data visulization"
 maintainer="Andrew Benson <abenson+void@gmail.com>"
 license="GPL-3.0-or-later"

From 0550cb08bb5dfb2dff715737fcd00056c3f41998 Mon Sep 17 00:00:00 2001
From: "Andrew J. Hesford" <ajh@sideband.org>
Date: Thu, 26 Oct 2023 12:33:00 -0400
Subject: [PATCH 4/4] gnuradio: revbump for qwt changes

---
 srcpkgs/gnuradio/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/gnuradio/template b/srcpkgs/gnuradio/template
index 7897e6a91ba79..a1e1f75c8f6bc 100644
--- a/srcpkgs/gnuradio/template
+++ b/srcpkgs/gnuradio/template
@@ -1,7 +1,7 @@
 # Template file for 'gnuradio'
 pkgname=gnuradio
 version=3.10.5.1
-revision=4
+revision=5
 build_style=cmake
 conf_files="/etc/gnuradio/conf.d/*"
 configure_args="-DMATHJAX2_USE_ROOT=/usr/share/mathjax

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PR PATCH] [Updated] qwt: add qt6 packages
  2023-10-26 16:41 [PR PATCH] qwt: add qt6 packages ahesford
@ 2023-10-26 20:22 ` ahesford
  2023-10-28  1:56 ` [PR PATCH] [Closed]: " ahesford
  1 sibling, 0 replies; 3+ messages in thread
From: ahesford @ 2023-10-26 20:22 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 800 bytes --]

There is an updated pull request by ahesford against master on the void-packages repository

https://github.com/ahesford/void-packages qwt-qt6
https://github.com/void-linux/void-packages/pull/46911

qwt: add qt6 packages
Qwt can be built with Qt5 or Qt6. Unfortunately, `gnuradio` remains wed to Qt5, so we still need a Qt5 version. The other dependant, `linssid`, can be built with Qt6 with a trivial patch. For now, we can install `qwt` for both Qt5 and Qt6, and we can drop the `-qt6` packages when the Qt5 variant becomes obsolete.

#### Testing the changes
- I tested the changes in this PR: **yes** (`linssid` launches, locally built software that uses `qwt` works fine for Qt5 and Qt6)

[ci skip]

A patch file from https://github.com/void-linux/void-packages/pull/46911.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-qwt-qt6-46911.patch --]
[-- Type: text/x-diff, Size: 14827 bytes --]

From c4b0a01c9eec5defbdaadd8e6697c426decd213a Mon Sep 17 00:00:00 2001
From: "Andrew J. Hesford" <ajh@sideband.org>
Date: Wed, 25 Oct 2023 14:52:02 -0400
Subject: [PATCH 1/4] qwt: add qt6 packages

---
 common/shlibs                       |   3 +-
 srcpkgs/qwt-headers                 |   1 +
 srcpkgs/qwt-qt6                     |   1 +
 srcpkgs/qwt-qt6-devel               |   1 +
 srcpkgs/qwt/patches/locations.patch |  40 +++++++++++
 srcpkgs/qwt/patches/multi-qt.patch  |  54 ++++++++++++++
 srcpkgs/qwt/template                | 106 +++++++++++++++++++++++-----
 7 files changed, 188 insertions(+), 18 deletions(-)
 create mode 120000 srcpkgs/qwt-headers
 create mode 120000 srcpkgs/qwt-qt6
 create mode 120000 srcpkgs/qwt-qt6-devel
 create mode 100644 srcpkgs/qwt/patches/locations.patch
 create mode 100644 srcpkgs/qwt/patches/multi-qt.patch

diff --git a/common/shlibs b/common/shlibs
index 67e0812c68e19..f99d5d3c69374 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -1949,7 +1949,8 @@ libQt5WebKitWidgets.so.5 qt5-webkit-5.6.0_1
 libx265.so.199 x265-3.5_1
 libQt5Xdg.so.3 libqtxdg-3.1.0_1
 libQt5XdgIconLoader.so.3 libqtxdg-3.1.0_1
-libqwt.so.6.2 qwt-6.2.0_1
+libqwt-qt5.so.6.2 qwt-6.2.0_2
+libqwt-qt6.so.6.2 qwt-qt6-6.2.0_2
 liblxqt-qt5.so.0 liblxqt-0.8.0_1
 liblxqt-globalkeys-qt5.so.0 lxqt-globalkeys-0.8.0_1
 liblxqt-globalkeys-ui-qt5.so.0 lxqt-globalkeys-0.8.0_1
diff --git a/srcpkgs/qwt-headers b/srcpkgs/qwt-headers
new file mode 120000
index 0000000000000..120b77f854709
--- /dev/null
+++ b/srcpkgs/qwt-headers
@@ -0,0 +1 @@
+qwt
\ No newline at end of file
diff --git a/srcpkgs/qwt-qt6 b/srcpkgs/qwt-qt6
new file mode 120000
index 0000000000000..120b77f854709
--- /dev/null
+++ b/srcpkgs/qwt-qt6
@@ -0,0 +1 @@
+qwt
\ No newline at end of file
diff --git a/srcpkgs/qwt-qt6-devel b/srcpkgs/qwt-qt6-devel
new file mode 120000
index 0000000000000..120b77f854709
--- /dev/null
+++ b/srcpkgs/qwt-qt6-devel
@@ -0,0 +1 @@
+qwt
\ No newline at end of file
diff --git a/srcpkgs/qwt/patches/locations.patch b/srcpkgs/qwt/patches/locations.patch
new file mode 100644
index 0000000000000..a5765d64eeb4a
--- /dev/null
+++ b/srcpkgs/qwt/patches/locations.patch
@@ -0,0 +1,40 @@
+--- a/qwtconfig.pri
++++ b/qwtconfig.pri
+@@ -19,7 +19,7 @@
+ QWT_INSTALL_PREFIX = $$[QT_INSTALL_PREFIX]
+ 
+ unix {
+-    QWT_INSTALL_PREFIX    = /usr/local/qwt-$$QWT_VERSION
++    QWT_INSTALL_PREFIX    = /usr
+     # QWT_INSTALL_PREFIX = /usr/local/qwt-$$QWT_VERSION-qt-$$QT_VERSION
+ }
+ 
+@@ -28,8 +28,8 @@
+     # QWT_INSTALL_PREFIX = C:/Qwt-$$QWT_VERSION-qt-$$QT_VERSION
+ }
+ 
+-QWT_INSTALL_DOCS      = $${QWT_INSTALL_PREFIX}/doc
+-QWT_INSTALL_HEADERS   = $${QWT_INSTALL_PREFIX}/include
++QWT_INSTALL_DOCS      = $${QWT_INSTALL_PREFIX}/share/doc/qwt
++QWT_INSTALL_HEADERS   = $${QWT_INSTALL_PREFIX}/include/qwt
+ QWT_INSTALL_LIBS      = $${QWT_INSTALL_PREFIX}/lib
+ 
+ ######################################################################
+@@ -49,7 +49,7 @@
+ # path. Also QT_INSTALL_PREFIX is only one of the default
+ # search paths of the designer - not the Qt creator
+ 
+-#QWT_INSTALL_PLUGINS   = $$[QT_INSTALL_PREFIX]/plugins/designer
++QWT_INSTALL_PLUGINS   = /usr/lib/qt$${QT_MAJOR_VERSION}/plugins/designer
+ 
+ ######################################################################
+ # Features
+@@ -64,7 +64,7 @@
+ ######################################################################
+ 
+ QWT_INSTALL_FEATURES  = $${QWT_INSTALL_PREFIX}/features
+-# QWT_INSTALL_FEATURES  = $$[QT_INSTALL_PREFIX]/features
++QWT_INSTALL_FEATURES  = /usr/lib/qt$${QT_MAJOR_VERSION}/mkspecs/features
+ 
+ ######################################################################
+ # Build the static/shared libraries.
diff --git a/srcpkgs/qwt/patches/multi-qt.patch b/srcpkgs/qwt/patches/multi-qt.patch
new file mode 100644
index 0000000000000..e8f901d7ad67a
--- /dev/null
+++ b/srcpkgs/qwt/patches/multi-qt.patch
@@ -0,0 +1,54 @@
+diff -ur a/qwtfunctions.pri b/qwtfunctions.pri
+--- a/qwtfunctions.pri	2021-07-18 07:19:33.644367625 -0400
++++ b/qwtfunctions.pri	2023-10-26 10:12:25.650218378 -0400
+@@ -12,7 +12,7 @@
+ defineReplace(qwtLibraryTarget) {
+ 
+     unset(LIBRARY_NAME)
+-    LIBRARY_NAME = $$1
++    LIBRARY_NAME = $${1}-qt$${QT_MAJOR_VERSION}
+ 
+     mac:contains(QWT_CONFIG, QwtFramework) {
+ 
+@@ -36,7 +36,7 @@
+ defineTest(qwtAddLibrary) {
+ 
+     LIB_PATH = $$1
+-    LIB_NAME = $$2
++    LIB_NAME = $${2}-qt$${QT_MAJOR_VERSION}
+ 
+     mac:contains(QWT_CONFIG, QwtFramework) {
+ 
+diff -ur a/src/src.pro b/src/src.pro
+--- a/src/src.pro	2021-07-18 07:19:33.628367286 -0400
++++ b/src/src.pro	2023-10-26 10:11:09.320983554 -0400
+@@ -31,7 +31,7 @@
+     
+             # we increase the SONAME for every minor number
+ 
+-            QWT_SONAME=libqwt.so.$${VER_MAJ}.$${VER_MIN}
++            QWT_SONAME=libqwt-qt$${QT_MAJOR_VERSION}.so.$${VER_MAJ}.$${VER_MIN}
+             QMAKE_LFLAGS *= $${QMAKE_LFLAGS_SONAME}$${QWT_SONAME}
+             QMAKE_LFLAGS_SONAME=
+         }
+@@ -82,14 +82,17 @@
+     greaterThan(QT_MAJOR_VERSION, 4) {
+ 
+         QMAKE_PKGCONFIG_FILE = Qt$${QT_MAJOR_VERSION}$${QMAKE_PKGCONFIG_NAME}
+-        QMAKE_PKGCONFIG_REQUIRES = Qt5Widgets Qt5Concurrent Qt5PrintSupport
++
++        QMAKE_PKGCONFIG_REQUIRES = Qt$${QT_MAJOR_VERSION}Widgets
++        QMAKE_PKGCONFIG_REQUIRES += Qt$${QT_MAJOR_VERSION}Concurrent
++        QMAKE_PKGCONFIG_REQUIRES += Qt$${QT_MAJOR_VERSION}PrintSupport
+ 
+         contains(QWT_CONFIG, QwtSvg) {
+-            QMAKE_PKGCONFIG_REQUIRES += Qt5Svg
++            QMAKE_PKGCONFIG_REQUIRES += Qt$${QT_MAJOR_VERSION}Svg
+         }
+ 
+         contains(QWT_CONFIG, QwtOpenGL) {
+-            QMAKE_PKGCONFIG_REQUIRES += Qt5OpenGL
++            QMAKE_PKGCONFIG_REQUIRES += Qt$${QT_MAJOR_VERSION}OpenGL
+         }
+ 
+         QMAKE_DISTCLEAN += $${DESTDIR}/$${QMAKE_PKGCONFIG_DESTDIR}/$${QMAKE_PKGCONFIG_FILE}.pc
diff --git a/srcpkgs/qwt/template b/srcpkgs/qwt/template
index b5fdae7aa7fd6..bcaebd7e23d9b 100644
--- a/srcpkgs/qwt/template
+++ b/srcpkgs/qwt/template
@@ -1,10 +1,12 @@
 # Template file for 'qwt'
 pkgname=qwt
 version=6.2.0
-revision=1
+revision=2
 build_style=qmake
-hostmakedepends="qt5-qmake qt5-host-tools"
-makedepends="qt5-tools-devel qt5-svg-devel"
+hostmakedepends="qt6-base qt6-tools qt5-qmake qt5-host-tools"
+_makedepends_qt6="qt6-tools-devel qt6-svg-devel"
+_makedepends_qt5="${_makedepends_qt6//qt6/qt5}"
+makedepends="${_makedepends_qt6} ${_makedepends_qt5}"
 short_desc="Qt Widgets for Technical Applications"
 maintainer="Giuseppe Fierro <gspe@ae-design.ws>"
 license="LGPL-2.1-only, Qwt-exception-1.0"
@@ -12,32 +14,102 @@ homepage="https://qwt.sourceforge.io/"
 distfiles="https://sourceforge.net/projects/${pkgname}/files/${pkgname}/${version}/${pkgname}-${version}.tar.bz2"
 checksum=9194f6513955d0fd7300f67158175064460197abab1a92fa127a67a4b0b71530
 
-post_patch() {
-	vsed -e '/^\s*QWT_INSTALL_PREFIX/ s|=.*|= /usr|' \
-		-e '/^QWT_INSTALL_DOCS/ s|/doc|/share/doc/qwt|' \
-		-e '/^QWT_INSTALL_HEADERS/ s|include|&/qwt|' \
-		-e '/^QWT_INSTALL_PLUGINS/ s|plugins/designer|lib/qt5/&|' \
-		-e '/^QWT_INSTALL_FEATURES/ s|features|lib/qt5/mkspecs/&|' \
-		-i qwtconfig.pri
+_qt5_conf_to_qt6() {
+	local f sdir dspec dname
+	dname="linux-g++"
+	for sdir in .host-spec .target-spec; do
+		dspec="${sdir}-qt6/${dname}"
+		mkdir -p "${dspec}"
+		for f in "${sdir}/${dname}"/*; do
+			[ -f "${f}" ] || continue
+			sed 's/qt5/qt6/g' "${f}" > "${dspec}/${f##*/}"
+		done
+	done
+
+	sed -e 's/qt5/qt6/g' -e "s@-spec/@-spec-qt6/@g" qt.conf > qt6.conf
 }
 
-post_install() {
+post_configure() {
+	local qmake_args
+
+	if [ -n "${CROSS_BUILD}" ]; then
+		qmake_args=(
+			"-qtconf" "${wrksrc}/qt6.conf"
+			"PKG_CONFIG_EXECUTABLE=${XBPS_WRAPPERDIR}/${PKG_CONFIG}"
+		)
+
+		_qt5_conf_to_qt6
+	else
+		qmake_args=( "CONFIG+=no_qt_rpath" )
+	fi
+
+	mkdir -p build-qt6
+	cd build-qt6
+	/usr/lib/qt6/bin/qmake "${qmake_args[@]}" \
+		PREFIX=/usr QT_INSTALL_PREFIX=/usr LIB=/usr/lib ..
+}
+
+do_build() {
+	make ${makejobs} CC="$CC" CXX="$CXX" LINK="$CXX"
+	make ${makejobs} -C build-qt6 CC="$CC" CXX="$CXX" LINK="$CXX"
+}
+
+do_install() {
+	for build_root in . build-qt6; do
+		make -C "${build_root}" STRIP=true PREFIX=/usr \
+			DESTDIR="${DESTDIR}" INSTALL_ROOT="${DESTDIR}" install
+	done
+
+	# This is Qt5 only, so it will be installed in qwt-devel
+	rm "${DESTDIR}/usr/include/qwt/qwt_plot_glcanvas.h"
+
 	vlicense COPYING
 }
 
-qwt-devel_package() {
-	depends="${makedepends} ${sourcepkg}-${version}_${revision}"
-	short_desc+=" - development files"
+qwt-qt6_package() {
+	short_desc+=" (Qt6)"
+	pkg_install() {
+		vmove "usr/lib/libqwt-qt6.so.*"
+		vlicense COPYING
+	}
+}
+
+qwt-headers_package() {
+	short_desc+=" - Qt5/Qt6 common headers"
 	pkg_install() {
 		vmove usr/include
-		vmove "usr/lib/*.so"
+		vlicense COPYING
+	}
+}
+
+qwt-devel_package() {
+	depends="${sourcepkg}-${version}_${revision}
+	 qwt-headers-${version}_${revision} ${_makedepends_qt5}"
+	short_desc+=" - Qt5 development files"
+	pkg_install() {
+		vmove "usr/lib/*-qt5.so"
 		vmove usr/lib/qt5
-		vmove usr/lib/pkgconfig
+		vmove usr/lib/pkgconfig/Qt5*
+
+		vmkdir usr/include/qwt
+		vcopy "src/qwt_plot_glcanvas.h" usr/include/qwt
+
+	}
+}
+
+qwt-qt6-devel_package() {
+	depends="qwt-qt6-${version}_${revision}
+	 qwt-headers-${version}_${revision} ${_makedepends_qt6}"
+	short_desc+=" - Qt6 development files"
+	pkg_install() {
+		vmove "usr/lib/*-qt6.so"
+		vmove usr/lib/qt6
+		vmove usr/lib/pkgconfig/Qt6*
 	}
 }
 
 qwt-doc_package() {
-	depends="${makedepends} ${sourcepkg}-${version}_${revision}"
+	depends="${sourcepkg}-${version}_${revision}"
 	short_desc+=" - doc files"
 	pkg_install() {
 		vmove usr/share/doc

From 1e2960513b5044bda535a69f1862a336372f6020 Mon Sep 17 00:00:00 2001
From: "Andrew J. Hesford" <ajh@sideband.org>
Date: Wed, 25 Oct 2023 15:04:27 -0400
Subject: [PATCH 2/4] linssid: build with qt6

---
 srcpkgs/linssid/patches/project.patch |  5 +++--
 srcpkgs/linssid/patches/qt-6.5.patch  | 24 ++++++++++++++++++++++++
 srcpkgs/linssid/template              |  7 +++----
 3 files changed, 30 insertions(+), 6 deletions(-)
 create mode 100644 srcpkgs/linssid/patches/qt-6.5.patch

diff --git a/srcpkgs/linssid/patches/project.patch b/srcpkgs/linssid/patches/project.patch
index 8adc2028ec412..7fc92012dc93b 100644
--- a/srcpkgs/linssid/patches/project.patch
+++ b/srcpkgs/linssid/patches/project.patch
@@ -24,8 +24,9 @@
  INCLUDEPATH += /usr/include/qwt
  LIBS += -lboost_regex
 -LIBS += /usr/lib/libqwt-qt5.so.6
-+LIBS += -lqwt
- QMAKE_CXXFLAGS += -std=c++11
+-QMAKE_CXXFLAGS += -std=c++11
++LIBS += -lqwt-qt6
++QMAKE_CXXFLAGS += -std=c++17
  #
  TARGET = linssid
 -target.path = /usr/sbin
diff --git a/srcpkgs/linssid/patches/qt-6.5.patch b/srcpkgs/linssid/patches/qt-6.5.patch
new file mode 100644
index 0000000000000..e162970ae02a5
--- /dev/null
+++ b/srcpkgs/linssid/patches/qt-6.5.patch
@@ -0,0 +1,24 @@
+--- ./linssid-app/MainForm.cpp.orig	2023-10-25 14:47:34.411697129 -0400
++++ ./linssid-app/MainForm.cpp	2023-10-25 14:50:20.485975281 -0400
+@@ -924,10 +924,10 @@
+                 setData(Qt::DisplayRole, MainForm::cellDataRay[row].cenChan);
+         MainForm::cellDataRay[row].pTableItem[CENCHAN]->setTextAlignment(Qt::AlignCenter);
+         MainForm::cellDataRay[row].pTableItem[FIRST_SEEN]->
+-                setText(QDateTime::fromTime_t(MainForm::cellDataRay[row].firstSeen).toString("MM/dd-hh:mm:ss"));
++                setText(QDateTime::fromSecsSinceEpoch(MainForm::cellDataRay[row].firstSeen).toString("MM/dd-hh:mm:ss"));
+         MainForm::cellDataRay[row].pTableItem[FIRST_SEEN]->setTextAlignment(Qt::AlignCenter);
+         MainForm::cellDataRay[row].pTableItem[LAST_SEEN]->
+-                setText(QDateTime::fromTime_t(MainForm::cellDataRay[row].lastSeen).toString("MM/dd-hh:mm:ss"));
++                setText(QDateTime::fromSecsSinceEpoch(MainForm::cellDataRay[row].lastSeen).toString("MM/dd-hh:mm:ss"));
+         MainForm::cellDataRay[row].pTableItem[LAST_SEEN]->setTextAlignment(Qt::AlignCenter);
+         MainForm::cellDataRay[row].pTableItem[VENDOR]->
+                 setText(MainForm::cellDataRay[row].vendor.c_str());
+@@ -1127,7 +1127,7 @@
+     MainForm::cellDataRay[tbi].pTableItem[PLOT]->setFlags(
+             Qt::ItemIsEnabled | Qt::ItemIsUserCheckable | Qt::ItemIsEditable);
+     MainForm::cellDataRay[tbi].pTableItem[PLOT]->setCheckState(Qt::Checked);
+-    MainForm::cellDataRay[tbi].pTableItem[SSID]->setTextColor(MainForm::cellDataRay[tbi].color);
++    MainForm::cellDataRay[tbi].pTableItem[SSID]->setForeground(MainForm::cellDataRay[tbi].color);
+ }
+ 
+ void MainForm::extractData(string tl, int &tbi, int &newBSS) {
diff --git a/srcpkgs/linssid/template b/srcpkgs/linssid/template
index 56aacccc327c7..684ac2fb0d7be 100644
--- a/srcpkgs/linssid/template
+++ b/srcpkgs/linssid/template
@@ -1,11 +1,10 @@
 # Template file for 'linssid'
 pkgname=linssid
 version=3.6
-revision=5
+revision=6
 build_style=qmake
-hostmakedepends="qt5-qmake qt5-host-tools"
-makedepends="boost-devel qwt-devel"
-depends="qt5-svg"
+hostmakedepends="qt6-base qt6-tools"
+makedepends="boost-devel qwt-qt6-devel"
 short_desc="Graphical wireless AP scanner"
 maintainer="Piraty <mail@piraty.dev>"
 license="GPL-3.0-only"

From 36e108e0ba9d718d81ffd1fae83b2b2e7ea88435 Mon Sep 17 00:00:00 2001
From: "Andrew J. Hesford" <ajh@sideband.org>
Date: Wed, 25 Oct 2023 15:07:14 -0400
Subject: [PATCH 3/4] XyGrib: fix build dependencies

---
 srcpkgs/XyGrib/template | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/XyGrib/template b/srcpkgs/XyGrib/template
index b2a1272d5a9f2..fca36be155e18 100644
--- a/srcpkgs/XyGrib/template
+++ b/srcpkgs/XyGrib/template
@@ -1,11 +1,11 @@
 # Template file for 'XyGrib'
 pkgname=XyGrib
 version=1.2.6.1
-revision=4
+revision=5
 build_style=cmake
 hostmakedepends="qt5-devel pkg-config"
 makedepends="jasper-devel libnova-devel nettle-devel proj-devel qt5-devel
- qwt-devel libopenjpeg2-devel"
+ qt5-tools-devel libopenjpeg2-devel"
 short_desc="Weather data visulization"
 maintainer="Andrew Benson <abenson+void@gmail.com>"
 license="GPL-3.0-or-later"

From 6769d44aa2ece5ac7ed0c630c0b781132197e8f4 Mon Sep 17 00:00:00 2001
From: "Andrew J. Hesford" <ajh@sideband.org>
Date: Thu, 26 Oct 2023 12:33:00 -0400
Subject: [PATCH 4/4] gnuradio: revbump for qwt changes

---
 srcpkgs/gnuradio/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/gnuradio/template b/srcpkgs/gnuradio/template
index 7897e6a91ba79..a1e1f75c8f6bc 100644
--- a/srcpkgs/gnuradio/template
+++ b/srcpkgs/gnuradio/template
@@ -1,7 +1,7 @@
 # Template file for 'gnuradio'
 pkgname=gnuradio
 version=3.10.5.1
-revision=4
+revision=5
 build_style=cmake
 conf_files="/etc/gnuradio/conf.d/*"
 configure_args="-DMATHJAX2_USE_ROOT=/usr/share/mathjax

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PR PATCH] [Closed]: qwt: add qt6 packages
  2023-10-26 16:41 [PR PATCH] qwt: add qt6 packages ahesford
  2023-10-26 20:22 ` [PR PATCH] [Updated] " ahesford
@ 2023-10-28  1:56 ` ahesford
  1 sibling, 0 replies; 3+ messages in thread
From: ahesford @ 2023-10-28  1:56 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 642 bytes --]

There's a closed pull request on the void-packages repository

qwt: add qt6 packages
https://github.com/void-linux/void-packages/pull/46911

Description:
Qwt can be built with Qt5 or Qt6. Unfortunately, `gnuradio` remains wed to Qt5, so we still need a Qt5 version. The other dependant, `linssid`, can be built with Qt6 with a trivial patch. For now, we can install `qwt` for both Qt5 and Qt6, and we can drop the `-qt6` packages when the Qt5 variant becomes obsolete.

#### Testing the changes
- I tested the changes in this PR: **yes** (`linssid` launches, locally built software that uses `qwt` works fine for Qt5 and Qt6)

[ci skip]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-10-28  1:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-26 16:41 [PR PATCH] qwt: add qt6 packages ahesford
2023-10-26 20:22 ` [PR PATCH] [Updated] " ahesford
2023-10-28  1:56 ` [PR PATCH] [Closed]: " ahesford

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).