git: ab65e95cc8fd - main - x11/workrave: add flavor for XFCE support

From: Fernando Apesteguía <fernape_at_FreeBSD.org>
Date: Sun, 29 Jan 2023 18:26:14 UTC
The branch main has been updated by fernape:

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

commit ab65e95cc8fd0ba5d1ebbe1b5b7e7fd905ec683e
Author:     Pau Amma <pauamma@FreeBSD.org>
AuthorDate: 2023-01-29 17:36:41 +0000
Commit:     Fernando Apesteguía <fernape@FreeBSD.org>
CommitDate: 2023-01-29 18:21:42 +0000

    x11/workrave: add flavor for XFCE support
    
    Deliberately not bumping PORTREVISION.
    
    PR:             269160
    Reported by:    pauamma@FreeBSD.org
    Reviewed by:    cyberbotx@cyberbotx.com (maintainer)
---
 x11/workrave/Makefile       | 28 +++++++++++++++++++++++-----
 x11/workrave/pkg-descr.xfce |  6 ++++++
 2 files changed, 29 insertions(+), 5 deletions(-)

diff --git a/x11/workrave/Makefile b/x11/workrave/Makefile
index d5d3ea3cee79..25c83486b7b7 100644
--- a/x11/workrave/Makefile
+++ b/x11/workrave/Makefile
@@ -5,7 +5,7 @@ CATEGORIES=	x11
 MASTER_SITES=	https://github.com/rcaelers/workrave/releases/download/v${PORTVERSION:S/./_/g}/
 
 MAINTAINER=	cyberbotx@cyberbotx.com
-COMMENT=	RSI prevention tool
+COMMENT=	RSI prevention tool (${FLAVOR} flavor)
 WWW=		https://www.workrave.org/
 
 LICENSE=	GPLv3+
@@ -13,8 +13,24 @@ LICENSE=	GPLv3+
 LIB_DEPENDS=	libgdome.so:textproc/gdome2 \
 		libharfbuzz.so:print/harfbuzz
 
-USES=		compiler:c++11-lang gmake gnome libtool localbase pkgconfig \
-		xorg
+FLAVORS=	default xfce
+FLAVOR?=	${FLAVORS:[1]}
+xfce_PKGNAMESUFFIX=	-xfce
+xfce_DESCR=	${.CURDIR}/pkg-descr.xfce
+xfce_CONFLICTS_INSTALL=	workrave
+default_CONFLICTS_INSTALL=	workrave-xfce
+
+USES=		compiler:c++11-lang desktop-file-utils gmake gnome libtool \
+		localbase pkgconfig xorg
+.if ${FLAVOR} == xfce
+CATEGORIES+=	xfce
+USES+=		xfce
+USE_XFCE=	libutil panel
+# Easier than using *_SUB since there's no flavor helper for that.
+PLIST_FILES=	lib/xfce4/panel/plugins/libworkrave-plugin.a \
+		lib/xfce4/panel/plugins/libworkrave-plugin.so \
+		share/xfce4/panel/plugins/workrave-xfce-applet.desktop
+.endif
 USE_CXXSTD=	c++11
 USE_GNOME=	gdkpixbuf2 gtkmm30 intlhack intltool introspection:build
 USE_LDCONFIG=	yes
@@ -26,8 +42,10 @@ CONFIGURE_ARGS=	--disable-gconf \
 		--disable-gsettings \
 		--disable-indicator \
 		--disable-mate \
-		--disable-pulse \
-		--disable-xfce
+		--disable-pulse
+.if ${FLAVOR} != xfce
+CONFIGURE_ARGS+=	--disable-xfce
+.endif
 INSTALL_TARGET=	install-strip
 
 WRKSRC=		${WRKDIR}/${PORTNAME}-${PORTVERSION}
diff --git a/x11/workrave/pkg-descr.xfce b/x11/workrave/pkg-descr.xfce
new file mode 100644
index 000000000000..219b7d5a54fe
--- /dev/null
+++ b/x11/workrave/pkg-descr.xfce
@@ -0,0 +1,6 @@
+Workrave is a program that assists in the recovery and prevention of
+Repetitive Strain Injury (RSI).  The program frequently alerts you to
+take micro-pauses, rest breaks and restricts you to your daily limit.
+These can be customized and it stops the counter when you stop.
+
+This is the XFCE-enabled flavor.