git: 952502d4bc71 - main - graphics/libjxl: split GIMP into gimp-jxl-plugin

From: Jan Beich <jbeich_at_FreeBSD.org>
Date: Mon, 21 Feb 2022 18:19:28 UTC
The branch main has been updated by jbeich:

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

commit 952502d4bc71bdb364c13da40cdf2662f963613a
Author:     Jan Beich <jbeich@FreeBSD.org>
AuthorDate: 2022-01-10 22:25:21 +0000
Commit:     Jan Beich <jbeich@FreeBSD.org>
CommitDate: 2022-02-21 18:19:06 +0000

    graphics/libjxl: split GIMP into gimp-jxl-plugin
    
    gimp-app is a heavy dependency that prevents enabling JXL in other ports.
    
    PR:             261043
---
 graphics/Makefile                                  |  1 +
 graphics/gimp-jxl-plugin/Makefile                  | 26 ++++++++++++++++++
 graphics/gimp-jxl-plugin/distinfo                  |  3 ++
 .../gimp-jxl-plugin/files/patch-CMakeLists.txt     | 32 ++++++++++++++++++++++
 graphics/gimp-jxl-plugin/pkg-descr                 |  3 ++
 graphics/libjxl/Makefile                           | 18 +++---------
 graphics/libjxl/pkg-message                        |  8 ++++++
 graphics/libjxl/pkg-plist                          |  1 -
 8 files changed, 77 insertions(+), 15 deletions(-)

diff --git a/graphics/Makefile b/graphics/Makefile
index b5761def4acf..db75b7ead70d 100644
--- a/graphics/Makefile
+++ b/graphics/Makefile
@@ -262,6 +262,7 @@
     SUBDIR += gimp-beautify-plugin
     SUBDIR += gimp-data-extras
     SUBDIR += gimp-gmic-plugin
+    SUBDIR += gimp-jxl-plugin
     SUBDIR += gimp-lensfun-plugin
     SUBDIR += gimp-lqr-plugin
     SUBDIR += gimp-refocus-plugin
diff --git a/graphics/gimp-jxl-plugin/Makefile b/graphics/gimp-jxl-plugin/Makefile
new file mode 100644
index 000000000000..5a2d98ea31ff
--- /dev/null
+++ b/graphics/gimp-jxl-plugin/Makefile
@@ -0,0 +1,26 @@
+PORTNAME=	gimp-jxl-plugin
+DISTVERSIONPREFIX=	v
+DISTVERSION=	0.6.1
+CATEGORIES=	graphics
+
+MAINTAINER=	jbeich@FreeBSD.org
+COMMENT=	GIMP plugin to read/write JPEG XL images
+
+LICENSE=	BSD3CLAUSE
+LICENSE_FILE=	${WRKSRC:H:H}/LICENSE
+
+LIB_DEPENDS=	libgegl-0.4.so:graphics/gegl \
+		libgimp-2.0.so:graphics/gimp-app \
+		libjxl.so:graphics/libjxl \
+		libbabl-0.1.so:x11/babl
+
+USES=		cmake compiler:c++11-lang gnome pkgconfig
+USE_GITHUB=	yes
+USE_GNOME=	gtk20
+GH_ACCOUNT=	${GH_PROJECT}
+GH_PROJECT=	libjxl
+WRKSRC_SUBDIR=	plugins/gimp
+LDFLAGS+=	-Wl,--as-needed # GIMP deps
+PLIST_FILES=	libexec/gimp/2.2/plug-ins/file-jxl/file-jxl
+
+.include <bsd.port.mk>
diff --git a/graphics/gimp-jxl-plugin/distinfo b/graphics/gimp-jxl-plugin/distinfo
new file mode 100644
index 000000000000..adc343eb2152
--- /dev/null
+++ b/graphics/gimp-jxl-plugin/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1635545136
+SHA256 (libjxl-libjxl-v0.6.1_GH0.tar.gz) = ccbd5a729d730152303be399f033b905e608309d5802d77a61a95faa092592c5
+SIZE (libjxl-libjxl-v0.6.1_GH0.tar.gz) = 16953185
diff --git a/graphics/gimp-jxl-plugin/files/patch-CMakeLists.txt b/graphics/gimp-jxl-plugin/files/patch-CMakeLists.txt
new file mode 100644
index 000000000000..98fa6eb5f3f5
--- /dev/null
+++ b/graphics/gimp-jxl-plugin/files/patch-CMakeLists.txt
@@ -0,0 +1,32 @@
+https://github.com/NetBSD/pkgsrc-wip/blob/87d6597e0a2b/libjxl/patches/patch-plugins_gimp_CMakeLists.txt
+
+* adapt to make gimp plugin a separate package
+
+--- CMakeLists.txt.orig	2021-10-29 18:48:36 UTC
++++ CMakeLists.txt
+@@ -2,9 +2,12 @@
+ #
+ # Use of this source code is governed by a BSD-style
+ # license that can be found in the LICENSE file.
++cmake_minimum_required(VERSION 3.10)
++project(gimp-jxl LANGUAGES C CXX)
+ 
+ find_package(PkgConfig)
+ pkg_check_modules(Gimp IMPORTED_TARGET gimp-2.0>=2.10 gimpui-2.0>=2.10)
++pkg_check_modules(JXL IMPORTED_TARGET libjxl libjxl_threads)
+ 
+ if (NOT Gimp_FOUND)
+   message(WARNING "Gimp development libraries not found, the Gimp plugin will not be built")
+@@ -19,10 +22,10 @@ add_executable(file-jxl WIN32
+   file-jxl-save.cc
+   file-jxl-save.h
+   file-jxl.cc)
+-target_link_libraries(file-jxl jxl jxl_threads PkgConfig::Gimp)
++target_link_libraries(file-jxl PkgConfig::JXL PkgConfig::Gimp)
+ 
+ target_include_directories(file-jxl PUBLIC
+-    ${PROJECT_SOURCE_DIR})  # for plugins/gimp absolute paths.
++    ${PROJECT_SOURCE_DIR}/../..)  # for plugins/gimp absolute paths.
+ 
+ pkg_get_variable(GIMP_LIB_DIR gimp-2.0 gimplibdir)
+ install(TARGETS file-jxl RUNTIME DESTINATION "${GIMP_LIB_DIR}/plug-ins/file-jxl/")
diff --git a/graphics/gimp-jxl-plugin/pkg-descr b/graphics/gimp-jxl-plugin/pkg-descr
new file mode 100644
index 000000000000..f31d76453b35
--- /dev/null
+++ b/graphics/gimp-jxl-plugin/pkg-descr
@@ -0,0 +1,3 @@
+GIMP plugin to read/write JPEG XL images
+
+WWW: https://jpeg.org/jpegxl/
diff --git a/graphics/libjxl/Makefile b/graphics/libjxl/Makefile
index eb3f09e2f210..ef51f97e982f 100644
--- a/graphics/libjxl/Makefile
+++ b/graphics/libjxl/Makefile
@@ -1,7 +1,7 @@
 PORTNAME=	libjxl
 DISTVERSIONPREFIX=	v
 DISTVERSION=	0.6.1
-PORTREVISION=	4
+PORTREVISION=	5
 CATEGORIES=	graphics
 
 PATCH_SITES=	https://github.com/${GH_ACCOUNT}/${GH_PROJECT}/commit/
@@ -36,10 +36,10 @@ CMAKE_ON=	JPEGXL_ENABLE_PLUGINS
 CMAKE_OFF=	JPEGXL_WARNINGS_AS_ERRORS ${BENCHMARK FUZZERS TCMALLOC:L:S/^/JPEGXL_ENABLE_/}
 CMAKE_OFF+=	${OpenGL GLUT:L:S/^/CMAKE_DISABLE_FIND_PACKAGE_/} # sjpeg
 CMAKE_OFF+=	${CMAKE_TESTING_ON}
-LDFLAGS+=	-Wl,--as-needed # brotlicommon, GIMP/OPENEXR/PNG deps
+LDFLAGS+=	-Wl,--as-needed # brotlicommon, OPENEXR/PNG deps
 
-OPTIONS_DEFINE=	GIF GIMP JPEG LTO MANPAGES OPENEXR PIXBUF PNG
-OPTIONS_DEFAULT=GIF GIMP JPEG LTO MANPAGES OPENEXR PIXBUF PNG
+OPTIONS_DEFINE=	GIF JPEG LTO MANPAGES OPENEXR PIXBUF PNG
+OPTIONS_DEFAULT=GIF JPEG LTO MANPAGES OPENEXR PIXBUF PNG
 OPTIONS_EXCLUDE_i386=	LTO # ConvolutionWithTranspose(): JXL_CHECK: out->xsize() == in.ysize()
 OPTIONS_EXCLUDE_powerpc64=	${"${/usr/bin/ld:L:tA}"==/usr/bin/ld.lld:?LTO:} # https://github.com/llvm/llvm-project/issues/46697
 OPTIONS_SUB=	yes
@@ -47,13 +47,6 @@ OPTIONS_SUB=	yes
 GIF_LIB_DEPENDS=	libgif.so:graphics/giflib
 GIF_CMAKE_BOOL_OFF=	CMAKE_DISABLE_FIND_PACKAGE_GIF
 
-GIMP_DESC=		GIMP plugin support
-GIMP_USES=		gnome
-GIMP_USE=		GNOME=gtk20
-GIMP_LIB_DEPENDS=	libgegl-0.4.so:graphics/gegl \
-			libgimp-2.0.so:graphics/gimp-app \
-			libbabl-0.1.so:x11/babl
-
 JPEG_USES=		jpeg
 JPEG_CMAKE_BOOL_OFF=	CMAKE_DISABLE_FIND_PACKAGE_JPEG
 
@@ -78,9 +71,6 @@ post-patch:
 	@${REINPLACE_CMD} 's,/usr,${LOCALBASE},' \
 		${WRKSRC}/plugins/gdk-pixbuf/jxl.thumbnailer
 
-# pkg_check_modules doesn't support CMAKE_DISABLE_*
-post-patch-GIMP-off:
-	@${REINPLACE_CMD} -i.nogimp '/gimp/d' ${WRKSRC}/plugins/CMakeLists.txt
 post-patch-PIXBUF-off:
 	@${REINPLACE_CMD} -i.nopixbuf '/gdk-pixbuf/d' ${WRKSRC}/plugins/CMakeLists.txt
 
diff --git a/graphics/libjxl/pkg-message b/graphics/libjxl/pkg-message
new file mode 100644
index 000000000000..5c116d337e6f
--- /dev/null
+++ b/graphics/libjxl/pkg-message
@@ -0,0 +1,8 @@
+[
+{ type: upgrade
+  maximum_version: "0.6.1_4"
+  message: <<EOD
+If you use GIMP to read/write .jxl files install gimp-jxl-plugin after upgrade.
+EOD
+}
+]
diff --git a/graphics/libjxl/pkg-plist b/graphics/libjxl/pkg-plist
index 0bef6b83e6bd..77bfe896e4c8 100644
--- a/graphics/libjxl/pkg-plist
+++ b/graphics/libjxl/pkg-plist
@@ -29,7 +29,6 @@ lib/libjxl_threads.so.0.6
 lib/libjxl_threads.so.0.6.1
 libdata/pkgconfig/libjxl.pc
 libdata/pkgconfig/libjxl_threads.pc
-%%GIMP%%libexec/gimp/2.2/plug-ins/file-jxl/file-jxl
 %%MANPAGES%%share/man/man1/cjxl.1.gz
 %%MANPAGES%%share/man/man1/djxl.1.gz
 share/mime/packages/image-jxl.xml