git: f5d6cd42fc05 - main - textproc/fcitx5-qt*: Add Qt6 support

From: Ka Ho Ng <khng_at_FreeBSD.org>
Date: Mon, 10 Oct 2022 09:39:01 UTC
The branch main has been updated by khng (src committer):

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

commit f5d6cd42fc05d26dea853e58c19b4ab0cae05cbc
Author:     Li-Wen Hsu <lwhsu@FreeBSD.org>
AuthorDate: 2022-10-10 07:08:16 +0000
Commit:     Ka Ho Ng <khng@FreeBSD.org>
CommitDate: 2022-10-10 09:36:02 +0000

    textproc/fcitx5-qt*: Add Qt6 support
    
    - Split into qt5, qt6 FLAVORS
    - Extract common files to textproc/fcitx5-qt-common
    
    Differential Revision:  https://reviews.freebsd.org/D36408
    Approved by:    lwhsu (ports)
---
 textproc/Makefile                                  |  1 +
 textproc/fcitx5-qt-common/Makefile                 | 16 +++++++++++
 textproc/fcitx5-qt/Makefile                        | 33 ++++++++++++++++++----
 .../fcitx5-qt/files/extra-patch-CMakeLists.txt     | 14 +++++++++
 textproc/fcitx5-qt/pkg-plist.common                | 11 ++++++++
 textproc/fcitx5-qt/{pkg-plist => pkg-plist.qt5}    | 11 --------
 textproc/fcitx5-qt/pkg-plist.qt6                   | 15 ++++++++++
 7 files changed, 84 insertions(+), 17 deletions(-)

diff --git a/textproc/Makefile b/textproc/Makefile
index 6a854748625a..7fd1d840f6ea 100644
--- a/textproc/Makefile
+++ b/textproc/Makefile
@@ -200,6 +200,7 @@
     SUBDIR += fcitx5-gtk
     SUBDIR += fcitx5-lua
     SUBDIR += fcitx5-qt
+    SUBDIR += fcitx5-qt-common
     SUBDIR += fex
     SUBDIR += ffe
     SUBDIR += fi-aspell
diff --git a/textproc/fcitx5-qt-common/Makefile b/textproc/fcitx5-qt-common/Makefile
new file mode 100644
index 000000000000..48a6209023db
--- /dev/null
+++ b/textproc/fcitx5-qt-common/Makefile
@@ -0,0 +1,16 @@
+PORTREVISION=	0
+
+COMMENT=	Fcitx support for Qt (common files)
+
+PKGNAMESUFFIX=	-common
+
+MASTERDIR=	${.CURDIR}/../fcitx5-qt
+
+PLIST=	${MASTERDIR}/pkg-plist.common
+
+FLAVORS=	# empty
+FLAVOR=	# empty
+
+CMAKE_OFF=	ENABLE_QT4 ENABLE_QT5 ENABLE_QT6
+
+.include "${MASTERDIR}/Makefile"
diff --git a/textproc/fcitx5-qt/Makefile b/textproc/fcitx5-qt/Makefile
index 5f00f8cd132a..ad0290e4d434 100644
--- a/textproc/fcitx5-qt/Makefile
+++ b/textproc/fcitx5-qt/Makefile
@@ -6,7 +6,7 @@ PATCH_SITES=	https://github.com/${GH_ACCOUNT}/${GH_PROJECT}/commit/
 PATCHFILES=	f7f983e1e709.patch:-p1
 
 MAINTAINER=	khng@FreeBSD.org
-COMMENT=	Fcitx support for Qt5
+COMMENT=	Fcitx support for Qt (${FLAVOR})
 WWW=		https://github.com/fcitx/fcitx5-qt
 
 LICENSE=	LGPL21+ BSD3CLAUSE
@@ -17,18 +17,39 @@ LICENSE_FILE_BSD3CLAUSE=	${WRKSRC}/LICENSES/BSD-3-Clause.txt
 LIB_DEPENDS=	libFcitx5Utils.so:textproc/fcitx5 \
 		libxkbcommon.so:x11/libxkbcommon
 
-USES=		compiler:c++17-lang gettext-tools cmake kde:5 pkgconfig qt:5 xorg
+FLAVORS?=	qt5 qt6
+FLAVOR?=	${FLAVORS:[1]}
 
+qt5_PKGNAMESUFFIX=	5
+qt6_PKGNAMESUFFIX=	6
+
+USES=		compiler:c++17-lang gettext-tools cmake kde:5 pkgconfig xorg
+
+CMAKE_OFF?=	ENABLE_QT4
+
+.if ${FLAVOR} == qt5
+USES+=		qt:5
+USE_QT=		concurrent core dbus gui widgets xml buildtools:build qmake:build
+CMAKE_ON=	ENABLE_QT5
+CMAKE_OFF+=	ENABLE_QT6
+EXTRA_PATCHES=	${PATCHDIR}/extra-patch-CMakeLists.txt
+RUN_DEPENDS=	fcitx5-qt-common>=${DISTVERSION}:textproc/fcitx5-qt-common
+.elif ${FLAVOR} == qt6
+USES+=		qt:6
+USE_QT=		base
+CMAKE_ON=	ENABLE_QT6
+CMAKE_OFF+=	ENABLE_QT5
+EXTRA_PATCHES=	${PATCHDIR}/extra-patch-CMakeLists.txt
+RUN_DEPENDS=	fcitx5-qt-common>=${DISTVERSION}:textproc/fcitx5-qt-common
+.endif
+
+PLIST?=		${PKGDIR}/pkg-plist.${FLAVOR}
 PLIST_SUB=	VER=${PORTVERSION}
 
 USE_GITHUB=	yes
 GH_ACCOUNT=	fcitx
 USE_KDE=	ecm
-USE_QT=		concurrent core dbus widgets buildtools:build qmake:build
 USE_XORG=	x11 xcb
 USE_LDCONFIG=	yes
 
-CMAKE_ON=	ENABLE_QT5
-CMAKE_OFF=	ENABLE_QT4 ENABLE_QT6
-
 .include <bsd.port.mk>
diff --git a/textproc/fcitx5-qt/files/extra-patch-CMakeLists.txt b/textproc/fcitx5-qt/files/extra-patch-CMakeLists.txt
new file mode 100644
index 000000000000..7fa1abdc5bf2
--- /dev/null
+++ b/textproc/fcitx5-qt/files/extra-patch-CMakeLists.txt
@@ -0,0 +1,14 @@
+--- CMakeLists.txt.orig	2022-08-31 10:36:00 UTC
++++ CMakeLists.txt
+@@ -80,11 +80,6 @@ if(ENABLE_QT6)
+   add_subdirectory(qt6)
+ endif()
+ 
+-if(NOT BUILD_ONLY_PLUGIN)
+-find_package(Gettext REQUIRED)
+-add_subdirectory(po)
+-endif()
+-
+ enable_testing()
+ add_subdirectory(test)
+ 
diff --git a/textproc/fcitx5-qt/pkg-plist.common b/textproc/fcitx5-qt/pkg-plist.common
new file mode 100644
index 000000000000..37a4e686b05b
--- /dev/null
+++ b/textproc/fcitx5-qt/pkg-plist.common
@@ -0,0 +1,11 @@
+share/locale/ca/LC_MESSAGES/fcitx5-qt.mo
+share/locale/da/LC_MESSAGES/fcitx5-qt.mo
+share/locale/de/LC_MESSAGES/fcitx5-qt.mo
+share/locale/es/LC_MESSAGES/fcitx5-qt.mo
+share/locale/fr/LC_MESSAGES/fcitx5-qt.mo
+share/locale/he/LC_MESSAGES/fcitx5-qt.mo
+share/locale/ja/LC_MESSAGES/fcitx5-qt.mo
+share/locale/ko/LC_MESSAGES/fcitx5-qt.mo
+share/locale/ru/LC_MESSAGES/fcitx5-qt.mo
+share/locale/zh_CN/LC_MESSAGES/fcitx5-qt.mo
+share/locale/zh_TW/LC_MESSAGES/fcitx5-qt.mo
diff --git a/textproc/fcitx5-qt/pkg-plist b/textproc/fcitx5-qt/pkg-plist.qt5
similarity index 79%
rename from textproc/fcitx5-qt/pkg-plist
rename to textproc/fcitx5-qt/pkg-plist.qt5
index 49b1e8121515..0da39797c8e6 100644
--- a/textproc/fcitx5-qt/pkg-plist
+++ b/textproc/fcitx5-qt/pkg-plist.qt5
@@ -29,14 +29,3 @@ lib/libFcitx5Qt5WidgetsAddons.so.2
 lib/libFcitx5Qt5WidgetsAddons.so.%%VER%%
 %%QT_PLUGINDIR%%/platforminputcontexts/libfcitx5platforminputcontextplugin.so
 libexec/fcitx5-qt5-gui-wrapper
-share/locale/ca/LC_MESSAGES/fcitx5-qt.mo
-share/locale/da/LC_MESSAGES/fcitx5-qt.mo
-share/locale/de/LC_MESSAGES/fcitx5-qt.mo
-share/locale/es/LC_MESSAGES/fcitx5-qt.mo
-share/locale/fr/LC_MESSAGES/fcitx5-qt.mo
-share/locale/he/LC_MESSAGES/fcitx5-qt.mo
-share/locale/ja/LC_MESSAGES/fcitx5-qt.mo
-share/locale/ko/LC_MESSAGES/fcitx5-qt.mo
-share/locale/ru/LC_MESSAGES/fcitx5-qt.mo
-share/locale/zh_CN/LC_MESSAGES/fcitx5-qt.mo
-share/locale/zh_TW/LC_MESSAGES/fcitx5-qt.mo
diff --git a/textproc/fcitx5-qt/pkg-plist.qt6 b/textproc/fcitx5-qt/pkg-plist.qt6
new file mode 100644
index 000000000000..f240faa5c1df
--- /dev/null
+++ b/textproc/fcitx5-qt/pkg-plist.qt6
@@ -0,0 +1,15 @@
+include/Fcitx5Qt6/Fcitx5Qt6DBusAddons/fcitx5qt6dbusaddons_export.h
+include/Fcitx5Qt6/Fcitx5Qt6DBusAddons/fcitxqtcontrollerproxy.h
+include/Fcitx5Qt6/Fcitx5Qt6DBusAddons/fcitxqtdbustypes.h
+include/Fcitx5Qt6/Fcitx5Qt6DBusAddons/fcitxqtinputcontextproxy.h
+include/Fcitx5Qt6/Fcitx5Qt6DBusAddons/fcitxqtinputmethodproxy.h
+include/Fcitx5Qt6/Fcitx5Qt6DBusAddons/fcitxqtwatcher.h
+include/Fcitx5Qt6/fcitx5qt6dbusaddons_version.h
+lib/cmake/Fcitx5Qt6DBusAddons/Fcitx5Qt6DBusAddonsConfig.cmake
+lib/cmake/Fcitx5Qt6DBusAddons/Fcitx5Qt6DBusAddonsConfigVersion.cmake
+lib/cmake/Fcitx5Qt6DBusAddons/Fcitx5Qt6DBusAddonsTargets-%%CMAKE_BUILD_TYPE%%.cmake
+lib/cmake/Fcitx5Qt6DBusAddons/Fcitx5Qt6DBusAddonsTargets.cmake
+lib/libFcitx5Qt6DBusAddons.so
+lib/libFcitx5Qt6DBusAddons.so.1
+lib/libFcitx5Qt6DBusAddons.so.%%VER%%
+%%QT_PLUGINDIR%%/platforminputcontexts/libfcitx5platforminputcontextplugin.so