git: 0ef660f00d79 - main - graphics/ImageMagick6: Convert -nox11 to flavor

From: Felix Palmen <zirias_at_FreeBSD.org>
Date: Sun, 30 Apr 2023 11:11:13 UTC
The branch main has been updated by zirias:

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

commit 0ef660f00d793e8555ab98c3730dae124e017400
Author:     Felix Palmen <zirias@FreeBSD.org>
AuthorDate: 2023-04-05 08:37:02 +0000
Commit:     Felix Palmen <zirias@FreeBSD.org>
CommitDate: 2023-04-30 11:10:39 +0000

    graphics/ImageMagick6: Convert -nox11 to flavor
    
    Approved by:            tcberner (mentor)
    Differential Revision:  https://reviews.freebsd.org/D39424
---
 MOVED                                |  1 +
 graphics/ImageMagick6-nox11/Makefile |  9 ------
 graphics/ImageMagick6/Makefile       | 53 ++++++++++++++++++++----------------
 graphics/Makefile                    |  1 -
 4 files changed, 30 insertions(+), 34 deletions(-)

diff --git a/MOVED b/MOVED
index c8382746b24b..875a00e65513 100644
--- a/MOVED
+++ b/MOVED
@@ -17921,3 +17921,4 @@ devel/zpu-binutils||2023-04-30|Has expired: Broken with latest C compiler and po
 databases/rocksdb-lite||2023-04-30|Has expired: Removed by upstream, see https://github.com/facebook/rocksdb/commit/4720ba4391eb016b05a30d09a8275624c3a4a87e
 textproc/ltxml||2023-04-30|Has expired: Unfetchable
 graphics/ImageMagick7-nox11|graphics/ImageMagick7|2023-04-30|Flavorized
+graphics/ImageMagick6-nox11|graphics/ImageMagick6|2023-04-30|Flavorized
diff --git a/graphics/ImageMagick6-nox11/Makefile b/graphics/ImageMagick6-nox11/Makefile
deleted file mode 100644
index ee3ae2da6df2..000000000000
--- a/graphics/ImageMagick6-nox11/Makefile
+++ /dev/null
@@ -1,9 +0,0 @@
-# the SVG and PANGO plugins need X11
-OPTIONS_EXCLUDE=	X11 SVG PANGO
-PORTSCOUT=	ignore:1
-# workaround until bsd.port.mk code can grok the disabling of the X11 option
-WITHOUT_X11=yes
-
-MASTERDIR=	${.CURDIR}/../ImageMagick6
-
-.include        "${MASTERDIR}/Makefile"
diff --git a/graphics/ImageMagick6/Makefile b/graphics/ImageMagick6/Makefile
index 0724a66d4055..10413b3eba0e 100644
--- a/graphics/ImageMagick6/Makefile
+++ b/graphics/ImageMagick6/Makefile
@@ -1,6 +1,6 @@
 PORTNAME=	ImageMagick
 DISTVERSION=	6.9.12-77
-PORTREVISION=	2
+PORTREVISION=	3
 PORTEPOCH=	1
 CATEGORIES=	graphics perl5
 MASTER_SITES=	https://ftp.acc.umu.se/mirror/imagemagick.org/ftp/releases/ \
@@ -19,11 +19,16 @@ LICENSE_FILE=	${WRKSRC}/LICENSE
 
 LIB_DEPENDS=	libltdl.so:devel/libltdl
 
-TESTS_DEPENDS=	gsfonts>=0:print/gsfonts
+FLAVORS=		x11 nox11
+FLAVOR?=		${FLAVORS:[1]}
+FLAVORS_SUB=		yes
+nox11_PKGNAMESUFFIX=	6-nox11
 
 PORTSCOUT?=	limit:^6\.9\.
 
-CONFLICTS_INSTALL=	ImageMagick7 ImageMagick7-nox11 # bin/Magick++-config
+# bin/Magick++-config
+CONFLICTS_INSTALL=	ImageMagick6 ImageMagick6-nox11 \
+			ImageMagick7 ImageMagick7-nox11
 
 # This port uses .la files, keep libtool:keepla! (magick/module.c)
 USES=		compiler:c++11-lang cpe gettext-runtime gmake gnome \
@@ -50,11 +55,22 @@ PLIST_SUB=	PORTVERSION=${PORTVERSION:R}
 OPTIONS_SUB=	yes
 OPTIONS_DEFINE=	BZIP2 DOCS DJVU FFMPEG FFTW FONTCONFIG FPX FREETYPE \
 		GRAPHVIZ GSLIB HEIF JPEG2000 JBIG JPEG LCMS2 LZMA LQR MODULES \
-		OPENEXR OPENMP PANGO PDF PERL PNG RAQM SVG TESTS TIFF WEBP WMF \
-		THREADS X11 16BIT_PIXEL HDRI RAW
+		OPENEXR OPENMP PDF PERL PNG TESTS TIFF WEBP WMF THREADS \
+		16BIT_PIXEL HDRI RAW
 OPTIONS_DEFAULT=	16BIT_PIXEL BZIP2 FFTW FONTCONFIG FREETYPE HEIF \
-		JPEG2000 JBIG JPEG LCMS2 LZMA LQR MODULES PDF PERL PNG RAQM SVG \
-		TIFF WEBP WMF THREADS X11 RAW
+		JPEG2000 JBIG JPEG LCMS2 LZMA LQR MODULES PDF PERL PNG \
+		TIFF WEBP WMF THREADS RAW
+
+.if ${FLAVOR:U} == x11
+# the SVG and PANGO plugins need X11
+OPTIONS_DEFINE+=	PANGO RAQM SVG
+OPTIONS_DEFAULT+=	RAQM SVG
+CONFIGURE_ARGS+=	--with-x
+USES+=			xorg
+USE_XORG=		ice sm x11 xext xt
+.else
+CONFIGURE_ARGS+=	--without-x
+.endif
 
 DJVU_DESC=		DJVU format support (needs THREADS)
 GSLIB_DESC=		libgs (Postscript SHLIB) support
@@ -129,7 +145,6 @@ MODULES_CONFIGURE_WITH=	modules
 
 PANGO_CONFIGURE_WITH=	pango
 PANGO_USE=		gnome=pango
-PANGO_IMPLIES=		X11
 
 PNG_CONFIGURE_WITH=	png
 PNG_LIB_DEPENDS=	libpng.so:graphics/png
@@ -148,7 +163,8 @@ RAW_IMPLIES=		LCMS2
 SVG_DESC=		SVG vector image format support (via librsvg, implies the x11 option)
 SVG_CONFIGURE_WITH=	rsvg
 SVG_USE=		gnome=cairo,gdkpixbuf2,librsvg2
-SVG_IMPLIES=		X11
+
+TESTS_TEST_DEPENDS=	gsfonts>=0:print/gsfonts
 
 TIFF_CONFIGURE_WITH=	tiff
 TIFF_LIB_DEPENDS=	libtiff.so:graphics/tiff
@@ -156,13 +172,6 @@ TIFF_LIB_DEPENDS=	libtiff.so:graphics/tiff
 WEBP_CONFIGURE_WITH=	webp
 WEBP_LIB_DEPENDS=	libwebp.so:graphics/webp
 
-X11_CONFIGURE_WITH=	x
-X11_USES=		xorg
-X11_USE=		xorg=ice,sm,x11,xext,xt
-X11_VARS=		CONFLICTS_INSTALL+="ImageMagick6-nox11"
-X11_VARS_OFF=		CONFLICTS_INSTALL+="ImageMagick6" \
-			PKGNAMESUFFIX=6-nox11
-
 .include <bsd.port.options.mk>
 
 .if ${PORT_OPTIONS:MTHREADS}
@@ -256,7 +265,7 @@ RUN_DEPENDS+=		ffmpeg:multimedia/ffmpeg
 
 .if ${PORT_OPTIONS:MGSLIB}
 CONFIGURE_ARGS+=	--with-gslib
-. if ${PORT_OPTIONS:MX11}
+. if ${FLAVOR:U} == x11
 USES+=		ghostscript:x11
 . else
 USES+=		ghostscript
@@ -267,7 +276,7 @@ CONFIGURE_ARGS+=	--without-gslib
 
 # WMF (Windows Meta File) images
 .if ${PORT_OPTIONS:MWMF}
-. if ${PORT_OPTIONS:MX11}
+. if ${FLAVOR:U} == x11
 LIB_DEPENDS+=		libwmf.so:graphics/libwmf
 . else
 LIB_DEPENDS+=		libwmf.so:graphics/libwmf-nox11
@@ -281,7 +290,7 @@ PLIST_SUB+=		WMF="@comment "
 
 # PDF (Adobe Portable Document Format) support
 .if ${PORT_OPTIONS:MPDF}
-. if ${PORT_OPTIONS:MX11}
+. if ${FLAVOR:U} == x11
 USES+=		ghostscript:x11
 . else
 USES+=		ghostscript
@@ -299,7 +308,7 @@ INSTALL_TARGET=	install-strip
 .endif
 
 .if ${PORT_OPTIONS:MTESTS}
-. if ${PORT_OPTIONS:MX11}
+. if ${FLAVOR:U} == x11
 USES+=		ghostscript:x11,build
 . else
 USES+=		ghostscript:build
@@ -332,10 +341,6 @@ pre-configure:
 	@${ECHO_CMD} '###################################################################'
 .endif
 
-.if ${PORT_OPTIONS:MSVG} && ! ${PORT_OPTIONS:MX11}
-	@${ECHO_CMD} NOTICE: SVG format support disabled, requires X11
-.endif
-
 post-install:
 .for i in ${SAMPLE_FILES}
 	@${MV} ${STAGEDIR}${PREFIX}/etc/ImageMagick-6/${i} \
diff --git a/graphics/Makefile b/graphics/Makefile
index 28fd5bdf6b44..e51d95bd12c7 100644
--- a/graphics/Makefile
+++ b/graphics/Makefile
@@ -6,7 +6,6 @@
     SUBDIR += Hermes
     SUBDIR += IPA
     SUBDIR += ImageMagick6
-    SUBDIR += ImageMagick6-nox11
     SUBDIR += ImageMagick7
     SUBDIR += O2-tools
     SUBDIR += R-cran-DiagrammeR