git: 5ce6ee9b773c - 2024Q4 - graphics/libjxl: expose LCMS2 support (disabled by default)

From: Jan Beich <jbeich_at_FreeBSD.org>
Date: Sat, 23 Nov 2024 05:29:35 UTC
The branch 2024Q4 has been updated by jbeich:

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

commit 5ce6ee9b773c528098e33e2be881d7511d4651f0
Author:     Jan Beich <jbeich@FreeBSD.org>
AuthorDate: 2024-11-23 04:48:33 +0000
Commit:     Jan Beich <jbeich@FreeBSD.org>
CommitDate: 2024-11-23 05:29:21 +0000

    graphics/libjxl: expose LCMS2 support (disabled by default)
    
    lcms2 and skcms interpret color profiles differently. Upstream
    default seems to be optimized for rendering in Chromium and Firefox.
    
    https://github.com/libjxl/libjxl/blob/v0.11.0/doc/color_management.md#cms-library
    https://github.com/libjxl/libjxl/issues/1579#issuecomment-1180561564
    (cherry picked from commit cafd30223ccd019bf6abdf5cdba35f0726dfcb9b)
---
 graphics/libjxl/Makefile | 20 +++++++++++---------
 graphics/libjxl/distinfo |  4 ++--
 2 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/graphics/libjxl/Makefile b/graphics/libjxl/Makefile
index 86c00cac5f92..7ea4140b60af 100644
--- a/graphics/libjxl/Makefile
+++ b/graphics/libjxl/Makefile
@@ -18,8 +18,7 @@ USES=		cmake:testing compiler:c++11-lib cpe localbase:ldflags pkgconfig shared-m
 CPE_VENDOR=	${PORTNAME}_project
 USE_GITHUB=	yes
 USE_LDCONFIG=	yes
-GH_TUPLE=	jbeich:skcms:42030a7:skcms/third_party/skcms \
-		libjxl:testdata:ff8d743:testdata/testdata \
+GH_TUPLE=	libjxl:testdata:ff8d743:testdata/testdata \
 		webmproject:sjpeg:e5ab130:sjpeg/third_party/sjpeg \
 		${NULL}
 CMAKE_ON=	JPEGXL_ENABLE_PLUGINS
@@ -29,8 +28,10 @@ CMAKE_OFF+=	${CMAKE_TESTING_ON}
 LDFLAGS+=	-Wl,--as-needed # brotlicommon, OPENEXR/PNG deps
 PLIST_SUB=	VERSION=${PORTVERSION}
 
-OPTIONS_DEFINE=	GIF JPEG LTO MANPAGES OPENEXR PIXBUF PNG
+OPTIONS_DEFINE=	GIF JPEG LCMS2 LTO MANPAGES OPENEXR PIXBUF PNG
 OPTIONS_DEFAULT=GIF JPEG LTO MANPAGES OPENEXR PIXBUF PNG
+OPTIONS_DEFAULT_powerpc=	LCMS2
+OPTIONS_DEFAULT_powerpc64=	LCMS2
 OPTIONS_EXCLUDE_i386=	LTO # ConvolutionWithTranspose(): JXL_CHECK: out->xsize() == in.ysize()
 OPTIONS_EXCLUDE_riscv64=	LTO # bug 262871
 OPTIONS_SUB=	yes
@@ -43,6 +44,13 @@ JPEG_CMAKE_BOOL=	JPEGXL_ENABLE_JPEGLI
 JPEG_CMAKE_BOOL_OFF=	CMAKE_DISABLE_FIND_PACKAGE_JPEG
 JPEG_CMAKE_BOOL_OFF+=	JPEGXL_ENABLE_JPEGLI_LIBJPEG # XXX WITH_JPEG8, libmap.conf(5)
 
+LCMS2_LIB_DEPENDS=	liblcms2.so:graphics/lcms2
+LCMS2_GH_TUPLE_OFF=	jbeich:skcms:42030a7:skcms/third_party/skcms
+LCMS2_CMAKE_BOOL_OFF=	JPEGXL_ENABLE_SKCMS
+.if make(makesum)
+GH_TUPLE+=		${LCMS2_GH_TUPLE_OFF}
+.endif
+
 LTO_CMAKE_BOOL=		CMAKE_INTERPROCEDURAL_OPTIMIZATION
 LTO_CMAKE_ON=		-DCMAKE_POLICY_DEFAULT_CMP0069:STRING=NEW
 
@@ -60,12 +68,6 @@ PIXBUF_CMAKE_BOOL=	JPEGXL_ENABLE_PLUGIN_GDKPIXBUF
 PNG_LIB_DEPENDS=	libpng.so:graphics/png
 PNG_CMAKE_BOOL_OFF=	CMAKE_DISABLE_FIND_PACKAGE_PNG
 
-.include <bsd.port.options.mk>
-
-.if ${ARCH} == powerpc || ${ARCH} == powerpc64
-LIB_DEPENDS+=	liblcms2.so:graphics/lcms2
-.endif
-
 post-patch:
 	@${REINPLACE_CMD} 's,/usr,${LOCALBASE},' \
 		${WRKSRC}/plugins/gdk-pixbuf/jxl.thumbnailer
diff --git a/graphics/libjxl/distinfo b/graphics/libjxl/distinfo
index 058647bcdd37..c30f2f05e263 100644
--- a/graphics/libjxl/distinfo
+++ b/graphics/libjxl/distinfo
@@ -1,9 +1,9 @@
 TIMESTAMP = 1726205465
 SHA256 (libjxl-libjxl-v0.11.0_GH0.tar.gz) = 7ce4ec8bb37a435a73ac18c4c9ff56c2dc6c98892bf3f53a328e3eca42efb9cf
 SIZE (libjxl-libjxl-v0.11.0_GH0.tar.gz) = 1873614
-SHA256 (jbeich-skcms-42030a7_GH0.tar.gz) = b7537267dd0fda80a98939cc4e4d15614d2d6f433cc8421b797e0f47078c2979
-SIZE (jbeich-skcms-42030a7_GH0.tar.gz) = 10050433
 SHA256 (libjxl-testdata-ff8d743_GH0.tar.gz) = d225523e0576f21b6f8de106d2eac4e07650522bae7b65011993792a4dbc3eda
 SIZE (libjxl-testdata-ff8d743_GH0.tar.gz) = 69102242
 SHA256 (webmproject-sjpeg-e5ab130_GH0.tar.gz) = 89d706381311af14e1124276266aebf41977f5facfd2a984cd365835e4bb55ff
 SIZE (webmproject-sjpeg-e5ab130_GH0.tar.gz) = 2481141
+SHA256 (jbeich-skcms-42030a7_GH0.tar.gz) = b7537267dd0fda80a98939cc4e4d15614d2d6f433cc8421b797e0f47078c2979
+SIZE (jbeich-skcms-42030a7_GH0.tar.gz) = 10050433