git: 980f3d067c8a - main - graphics/xpdf4: add Qt5/Qt6 flavors

From: Sergey A. Osokin <osa_at_FreeBSD.org>
Date: Fri, 08 Nov 2024 19:49:29 UTC
The branch main has been updated by osa:

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

commit 980f3d067c8a375b10ef79854b8bf791599df284
Author:     Sergey A. Osokin <osa@FreeBSD.org>
AuthorDate: 2024-11-08 19:32:38 +0000
Commit:     Sergey A. Osokin <osa@FreeBSD.org>
CommitDate: 2024-11-08 19:49:22 +0000

    graphics/xpdf4: add Qt5/Qt6 flavors
    
    Bump PORTREVISION.
    
    Approved by:    cy (maintainer)
    Differential Revision:  https://reviews.freebsd.org/D47466
---
 graphics/xpdf4/Makefile | 41 ++++++++++++++++++++++++++++++-----------
 1 file changed, 30 insertions(+), 11 deletions(-)

diff --git a/graphics/xpdf4/Makefile b/graphics/xpdf4/Makefile
index 59c26202b9ac..74358d07f7e5 100644
--- a/graphics/xpdf4/Makefile
+++ b/graphics/xpdf4/Makefile
@@ -1,12 +1,9 @@
 PORTNAME=	xpdf
 PORTVERSION=	4.05
-PORTREVISION=	2
+PORTREVISION=	3
 PORTEPOCH=	1
 CATEGORIES=	graphics print
 MASTER_SITES=	https://dl.xpdfreader.com/
-.if !defined(MASTERDIR)
-PKGNAMESUFFIX=	4
-.endif
 
 MAINTAINER=	cy@FreeBSD.org
 COMMENT=	Display PDF files and convert them to other formats
@@ -21,6 +18,20 @@ CONFLICTS_INSTALL+=	xpdf3 xpdf
 CONFLICTS_INSTALL+=	xpdf3 xpdf4
 .endif
 
+FLAVORS=	qt5 qt6
+FLAVOR?=	${FLAVORS:[1]}
+.if !defined(MASTERDIR)
+qt5_PKGNAMESUFFIX=	4
+qt6_PKGNAMESUFFIX=	4-qt6
+qt5_CONFLICTS_INSTALL=  ${PORTNAME}4-qt6
+qt6_CONFLICTS_INSTALL=  ${PORTNAME}4
+.else
+qt5_PKGNAMESUFFIX=
+qt6_PKGNAMESUFFIX=	-qt6
+qt5_CONFLICTS_INSTALL=  ${PORTNAME}-qt6
+qt6_CONFLICTS_INSTALL=  ${PORTNAME}
+.endif
+
 USES=		compiler:c++11-lang cmake cpe localbase:ldflags
 LIB_DEPENDS=	libfreetype.so:print/freetype2 \
 		libpng.so:graphics/png \
@@ -34,9 +45,7 @@ CMAKE_ARGS+=	-DOPI_SUPPORT:BOOL=ON -DCMAKE_DISABLE_FIND_PACKAGE_Qt4:BOOL=ON \
 		-DCMAKE_INSTALL_PREFIX=${PREFIX} \
 		-DCMAKE_INSTALL_BINDIR=${PREFIX}/libexec/xpdf \
 		-DCMAKE_INSTALL_MANDIR=${PREFIX}/share/xpdf/man \
-		-DNO_TEXT_SELECT:BOOL=OFF \
-		-DCMAKE_DISABLE_FIND_PACKAGE_Qt5Widgets:BOOL=FALSE \
-		-DCMAKE_DISABLE_FIND_PACKAGE_Qt6Widgets:BOOL=ON
+		-DNO_TEXT_SELECT:BOOL=OFF
 CPE_VENDOR=	xpdfreader
 
 PLIST_SUB=		DESKTOPDIR="${DESKTOPDIR}"
@@ -52,10 +61,20 @@ TYPE1_RUN_DEPENDS=	${LOCALBASE}/share/ghostscript/fonts/d050000l.pfb:print/gsfon
 LIBPAPER_CMAKE_BOOL=	USE_LIBPAPER
 LIBPAPER_LIB_DEPENDS=	libpaper.so:print/libpaper
 
-GUI_CMAKE_OFF=		-DCMAKE_DISABLE_FIND_PACKAGE_Qt5Widgets=1
-GUI_DESC=		QT5 interface
-GUI_USES=		qt:5 desktop-file-utils
-GUI_USE=		QT=buildtools:build,qmake:build,concurrent,core,gui,widgets,printsupport,svg,network,printsupport
+GUI_DESC=		GUI interface
+GUI_USES=		desktop-file-utils
+
+.if ${FLAVOR} == qt5
+USES+=		qt:5
+GUI_USE=	QT=buildtools:build,qmake:build,concurrent,core,gui,network,printsupport,svg,widgets
+CMAKE_ARGS+=	-DCMAKE_DISABLE_FIND_PACKAGE_Qt5Widgets:BOOL=FALSE \
+		-DCMAKE_DISABLE_FIND_PACKAGE_Qt6Widgets:BOOL=ON
+.else
+USES+=		qt:6
+GUI_USE=	QT=base,tools:build
+CMAKE_ARGS+=	-DCMAKE_DISABLE_FIND_PACKAGE_Qt5Widgets:BOOL=ON \
+		-DCMAKE_DISABLE_FIND_PACKAGE_Qt6Widgets:BOOL=FALSE
+.endif
 
 PRINT_CMAKE_ON=		-DXPDFWIDGET_PRINTING:BOOL=ON -DCUPS:BOOL=ON
 PRINT_CMAKE_OFF=	-DXPDFWIDGET_PRINTING:BOOL=OFF -DCUPS:BOOL=OFF