git: bd58b57d8141 - main - print/qpdfview: add flavors set maintainership

From: Fernando Apesteguía <fernape_at_FreeBSD.org>
Date: Tue, 09 Jul 2024 07:08:54 UTC
The branch main has been updated by fernape:

URL: https://cgit.FreeBSD.org/ports/commit/?id=bd58b57d81415582daf4aa71c19f7b12ef6a0c5c

commit bd58b57d81415582daf4aa71c19f7b12ef6a0c5c
Author:     mew14930xvi <mew14930xvi@inbox.lv>
AuthorDate: 2024-07-07 17:16:16 +0000
Commit:     Fernando Apesteguía <fernape@FreeBSD.org>
CommitDate: 2024-07-09 07:08:32 +0000

    print/qpdfview: add flavors set maintainership
    
    Add qt5 and qt6 flavors.
    While here, submitter takes maintainership. Already maintainer of several ports.
    
    PR:             279882
    Reported by:    mew14930xvi@inbox.lv
---
 print/qpdfview/Makefile                          | 52 ++++++++++++++++--------
 print/qpdfview/files/patch-qpdfview.pri          |  8 ----
 print/qpdfview/files/patch-sources_djvumodel.cpp | 10 -----
 print/qpdfview/files/patch-sources_model.h       | 10 -----
 4 files changed, 36 insertions(+), 44 deletions(-)

diff --git a/print/qpdfview/Makefile b/print/qpdfview/Makefile
index f6ea9e280c60..1a3709d35688 100644
--- a/print/qpdfview/Makefile
+++ b/print/qpdfview/Makefile
@@ -1,30 +1,42 @@
 PORTNAME=	qpdfview
 DISTVERSION=	0.5.0
-PORTREVISION=	4
+PORTREVISION=	5
 CATEGORIES=	print
 MASTER_SITES=	https://launchpad.net/${PORTNAME}/trunk/${DISTVERSION}/+download/
-DISTNAME=	${PORTNAME}-0.5
+DISTNAME=	${PORTNAME}-${DISTVERSION:S/.0$//}
 
-MAINTAINER=	ports@FreeBSD.org
+MAINTAINER=	mew14930xvi@inbox.lv
 COMMENT=	Tabbed DjVu/PDF/PS document viewer
 WWW=		https://launchpad.net/qpdfview
 
 LICENSE=	GPLv2+
 LICENSE_FILE=	${WRKSRC}/COPYING
 
-LIB_DEPENDS=	libpoppler-qt5.so:graphics/poppler-qt5
+LIB_DEPENDS=	libpoppler-${FLAVOR}.so:graphics/poppler-${FLAVOR}
 
-USES=		compiler:c++17-lang desktop-file-utils gl pkgconfig qmake qt:5
-USE_GL=		gl
+FLAVORS=	qt6 qt5
+FLAVOR?=	qt6
+
+USES=		desktop-file-utils gl pkgconfig qmake
 USE_LDCONFIG=	yes
-USE_QT=		concurrent core dbus gui imageformats linguisttools \
-		printsupport sql sql-sqlite3 svg widgets xml buildtools:build
 
-QMAKE_SOURCE_PATH=	${PORTNAME}.pro
+.if ${FLAVOR} == "qt5"
+PKGNAMESUFFIX=		-qt5
+USES+=			compiler:c++17-lang qt:5
+USE_GL=			gl
+USE_QT=			concurrent core dbus gui linguisttools printsupport \
+			sql svg widgets xml buildtools:build
+CONFLICTS_INSTALL=	${PORTNAME}
+.else
+USES+=			compiler:c++11-lang qt:6
+USE_GL=			opengl
+USE_QT=			base svg tools:build
+CONFLICTS_INSTALL=	${PORTNAME}-qt5
+.endif
 
-DATADIR=	${PREFIX}/share/${PORTNAME}
+QMAKE_SOURCE_PATH=	${PORTNAME}.pro
 
-OPTIONS_DEFINE=		CUPS DJVU PS
+OPTIONS_DEFINE=		CUPS DJVU PS SYNCTEX
 OPTIONS_DEFAULT=	CUPS DJVU PS
 OPTIONS_SUB=		yes
 
@@ -34,14 +46,22 @@ CUPS_QMAKE_OFF=		"CONFIG+=without_cups"
 DJVU_LIB_DEPENDS=	libdjvulibre.so:graphics/djvulibre
 DJVU_QMAKE_OFF=		"CONFIG+=without_djvu"
 
-PS_LIB_DEPENDS=	libspectre.so:print/libspectre
-PS_QMAKE_OFF=	"CONFIG+=without_ps"
+PS_LIB_DEPENDS=		libspectre.so:print/libspectre
+PS_QMAKE_OFF=		"CONFIG+=without_ps"
 
-.include <bsd.port.options.mk>
+SYNCTEX_DESC=		SyncTeX support
+SYNCTEX_LIB_DEPENDS=	libsynctex.so:devel/tex-synctex
+SYNCTEX_QMAKE_OFF=	"CONFIG+=without_synctex"
 
-pre-configure:
-	${REINPLACE_CMD} -e 's#/usr#${PREFIX}#g' \
+post-patch:
+.if ${FLAVOR} == "qt5"
+	${REINPLACE_CMD} -e '/CONFIG/s/c\+\+11/c++17/' \
 		${WRKSRC}/${PORTNAME}.pri
+.endif
+	${REINPLACE_CMD} -e 's|/usr|${PREFIX}|g' \
+		${WRKSRC}/${PORTNAME}.pri
+
+pre-configure:
 	cd ${WRKSRC} && ${LRELEASE} ${PORTNAME}.pro
 
 .include <bsd.port.mk>
diff --git a/print/qpdfview/files/patch-qpdfview.pri b/print/qpdfview/files/patch-qpdfview.pri
deleted file mode 100644
index 266e872da9ac..000000000000
--- a/print/qpdfview/files/patch-qpdfview.pri
+++ /dev/null
@@ -1,8 +0,0 @@
---- qpdfview.pri.orig	2024-01-02 16:01:53 UTC
-+++ qpdfview.pri
-@@ -12,4 +12,4 @@ os2:include(qpdfview_os2.pri)
- win32:include(qpdfview_win32.pri)
- os2:include(qpdfview_os2.pri)
- 
--CONFIG += c++11
-+CONFIG += c++17
diff --git a/print/qpdfview/files/patch-sources_djvumodel.cpp b/print/qpdfview/files/patch-sources_djvumodel.cpp
deleted file mode 100644
index 6a3b2a1bfb95..000000000000
--- a/print/qpdfview/files/patch-sources_djvumodel.cpp
+++ /dev/null
@@ -1,10 +0,0 @@
---- sources/djvumodel.cpp.orig	2020-05-21 10:55:32 UTC
-+++ sources/djvumodel.cpp
-@@ -29,6 +29,7 @@ along with qpdfview.  If not, see <http://www.gnu.org/
- #include <cstdio>
- 
- #include <QFile>
-+#include <QPainterPath>
- #include <qmath.h>
- 
- #if defined(Q_OS_WIN) && defined(DJVU_STATIC)
diff --git a/print/qpdfview/files/patch-sources_model.h b/print/qpdfview/files/patch-sources_model.h
deleted file mode 100644
index bd0d0b752480..000000000000
--- a/print/qpdfview/files/patch-sources_model.h
+++ /dev/null
@@ -1,10 +0,0 @@
---- sources/model.h.orig	2020-05-21 10:55:32 UTC
-+++ sources/model.h
-@@ -27,6 +27,7 @@ along with qpdfview.  If not, see <http://www.gnu.org/
- #include <QtPlugin>
- #include <QWidget>
- #include <QVector>
-+#include <QPainterPath>
- 
- class QAbstractItemModel;
- class QColor;