git: fdd0ceeceefa - main - graphics/libjxl: switch to system highway

From: Jan Beich <jbeich_at_FreeBSD.org>
Date: Sat, 08 Jan 2022 20:25:36 UTC
The branch main has been updated by jbeich:

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

commit fdd0ceeceefafad3ce9bda41029ca4973e5fb71d
Author:     Jan Beich <jbeich@FreeBSD.org>
AuthorDate: 2022-01-08 20:17:09 +0000
Commit:     Jan Beich <jbeich@FreeBSD.org>
CommitDate: 2022-01-08 20:24:35 +0000

    graphics/libjxl: switch to system highway
    
    PR:             261003
---
 graphics/libjxl/Makefile                           |  4 +-
 graphics/libjxl/distinfo                           |  2 -
 graphics/libjxl/files/patch-private-libhwy         | 22 +++++++++++
 graphics/libjxl/files/patch-private-libs           | 45 ----------------------
 ...patch-third__party_highway_hwy_nanobenchmark.cc | 40 -------------------
 5 files changed, 24 insertions(+), 89 deletions(-)

diff --git a/graphics/libjxl/Makefile b/graphics/libjxl/Makefile
index 2bc9513c9222..1b3bd1c71576 100644
--- a/graphics/libjxl/Makefile
+++ b/graphics/libjxl/Makefile
@@ -1,7 +1,7 @@
 PORTNAME=	libjxl
 DISTVERSIONPREFIX=	v
 DISTVERSION=	0.6.1
-PORTREVISION=	1
+PORTREVISION=	2
 CATEGORIES=	graphics
 
 PATCH_SITES=	https://github.com/${GH_ACCOUNT}/${GH_PROJECT}/commit/
@@ -16,6 +16,7 @@ LICENSE_COMB=	multi
 LICENSE_FILE_BSD3CLAUSE=${WRKSRC}/LICENSE
 LICENSE_FILE_ZLIB=	${WRKSRC}/third_party/lodepng/LICENSE
 
+BUILD_DEPENDS=	highway>0:devel/highway
 LIB_DEPENDS=	libbrotlienc.so:archivers/brotli
 TEST_DEPENDS=	googletest>0:devel/googletest
 
@@ -24,7 +25,6 @@ CPE_VENDOR=	${PORTNAME}_project
 USE_GITHUB=	yes
 USE_LDCONFIG=	yes
 GH_TUPLE=	barmco:skcms:6437475:skcms/third_party/skcms \
-		google:highway:0.12.2-4-ge239774:highway/third_party/highway \
 		lvandeve:lodepng:48e5364:lodepng/third_party/lodepng \
 		webmproject:sjpeg:868ab55:sjpeg/third_party/sjpeg \
 		${NULL}
diff --git a/graphics/libjxl/distinfo b/graphics/libjxl/distinfo
index e8589da7cf24..dc9bc3ff7b74 100644
--- a/graphics/libjxl/distinfo
+++ b/graphics/libjxl/distinfo
@@ -3,8 +3,6 @@ SHA256 (libjxl-libjxl-v0.6.1_GH0.tar.gz) = ccbd5a729d730152303be399f033b905e6083
 SIZE (libjxl-libjxl-v0.6.1_GH0.tar.gz) = 16953185
 SHA256 (barmco-skcms-6437475_GH0.tar.gz) = 6818ea7aa053a964d1795d6d1d3c5e2aad5d30dff9817c8e604e324ef643ec01
 SIZE (barmco-skcms-6437475_GH0.tar.gz) = 9200034
-SHA256 (google-highway-0.12.2-4-ge239774_GH0.tar.gz) = 27ae8a40f82874cb30bd62ef8f5567cc27838ee258ed0af47745685a15b23a8e
-SIZE (google-highway-0.12.2-4-ge239774_GH0.tar.gz) = 1488138
 SHA256 (lvandeve-lodepng-48e5364_GH0.tar.gz) = 41e0bcc686e31ee2d51a6c87c0089045f4805e4053d39026ad02e8aa90c782c1
 SIZE (lvandeve-lodepng-48e5364_GH0.tar.gz) = 239988
 SHA256 (webmproject-sjpeg-868ab55_GH0.tar.gz) = ffe757b376fed2fd94473f8625c25f82a3a23aa317fb1bbf1ac8159b6e0a7726
diff --git a/graphics/libjxl/files/patch-private-libhwy b/graphics/libjxl/files/patch-private-libhwy
new file mode 100644
index 000000000000..c9b5add67ac0
--- /dev/null
+++ b/graphics/libjxl/files/patch-private-libhwy
@@ -0,0 +1,22 @@
+Avoid depending on static libhwy for shared libjxl consumers
+
+--- lib/jxl.cmake.orig	2021-10-04 18:02:44 UTC
++++ lib/jxl.cmake
+@@ -557,7 +557,7 @@ endif()  # TARGET_SUPPORTS_SHARED_LIBS AND NOT JPEGXL_
+ 
+ # Add a pkg-config file for libjxl.
+ set(JPEGXL_LIBRARY_REQUIRES
+-    "libhwy libbrotlicommon libbrotlienc libbrotlidec")
++    "libbrotlicommon libbrotlienc libbrotlidec")
+ if(NOT JPEGXL_ENABLE_SKCMS)
+   set(JPEGXL_LIBRARY_REQUIRES "${JPEGXL_LIBRARY_REQUIRES} lcms2")
+ endif()
+--- lib/jxl/libjxl.pc.in.orig	2021-10-04 18:02:44 UTC
++++ lib/jxl/libjxl.pc.in
+@@ -8,5 +8,5 @@ Description: Loads and saves JPEG XL files
+ Version: @JPEGXL_LIBRARY_VERSION@
+ Requires.private: @JPEGXL_LIBRARY_REQUIRES@
+ Libs: -L${libdir} -ljxl
+-Libs.private: -lm
++Libs.private: -lhwy -lm
+ Cflags: -I${includedir}
diff --git a/graphics/libjxl/files/patch-private-libs b/graphics/libjxl/files/patch-private-libs
deleted file mode 100644
index b1b13b911f85..000000000000
--- a/graphics/libjxl/files/patch-private-libs
+++ /dev/null
@@ -1,45 +0,0 @@
-highway is untagged and have no other consumers. Keep it private to
-libjxl package for now.
-
---- lib/jxl.cmake.orig	2021-10-04 18:02:44 UTC
-+++ lib/jxl.cmake
-@@ -557,7 +557,7 @@ endif()  # TARGET_SUPPORTS_SHARED_LIBS AND NOT JPEGXL_
- 
- # Add a pkg-config file for libjxl.
- set(JPEGXL_LIBRARY_REQUIRES
--    "libhwy libbrotlicommon libbrotlienc libbrotlidec")
-+    "libbrotlicommon libbrotlienc libbrotlidec")
- if(NOT JPEGXL_ENABLE_SKCMS)
-   set(JPEGXL_LIBRARY_REQUIRES "${JPEGXL_LIBRARY_REQUIRES} lcms2")
- endif()
---- lib/jxl/libjxl.pc.in.orig	2021-10-04 18:02:44 UTC
-+++ lib/jxl/libjxl.pc.in
-@@ -8,5 +8,5 @@ Description: Loads and saves JPEG XL files
- Version: @JPEGXL_LIBRARY_VERSION@
- Requires.private: @JPEGXL_LIBRARY_REQUIRES@
- Libs: -L${libdir} -ljxl
--Libs.private: -lm
-+Libs.private: -lhwy -lm
- Cflags: -I${includedir}
---- third_party/CMakeLists.txt.orig	2020-11-14 00:52:03 UTC
-+++ third_party/CMakeLists.txt
-@@ -83,7 +83,7 @@ endif()  # BUILD_TESTING
- # Highway
- if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/highway/CMakeLists.txt" AND
-     NOT JPEGXL_FORCE_SYSTEM_HWY)
--  add_subdirectory(highway)
-+  add_subdirectory(highway EXCLUDE_FROM_ALL)
-   configure_file("${CMAKE_CURRENT_SOURCE_DIR}/highway/LICENSE"
-                  ${PROJECT_BINARY_DIR}/LICENSE.highway COPYONLY)
- else()
---- third_party/highway/CMakeLists.txt.orig	2020-12-02 19:39:56 UTC
-+++ third_party/highway/CMakeLists.txt
-@@ -230,7 +230,7 @@ set_target_properties(hwy_benchmark
- 
- include(CTest)
- 
--if(BUILD_TESTING)
-+if(HWY_BUILD_TESTING)
- enable_testing()
- include(GoogleTest)
- 
diff --git a/graphics/libjxl/files/patch-third__party_highway_hwy_nanobenchmark.cc b/graphics/libjxl/files/patch-third__party_highway_hwy_nanobenchmark.cc
deleted file mode 100644
index e6bcd6711d0f..000000000000
--- a/graphics/libjxl/files/patch-third__party_highway_hwy_nanobenchmark.cc
+++ /dev/null
@@ -1,40 +0,0 @@
-https://github.com/google/highway/commit/3769cb2c464c
-
---- third_party/highway/hwy/nanobenchmark.cc.orig	2021-06-09 08:56:32 UTC
-+++ third_party/highway/hwy/nanobenchmark.cc
-@@ -46,7 +46,7 @@
- #endif
- 
- #include "hwy/base.h"
--#if HWY_ARCH_PPC
-+#if HWY_ARCH_PPC && defined(__GLIBC__)
- #include <sys/platform/ppc.h>  // NOLINT __ppc_get_timebase_freq
- #elif HWY_ARCH_X86
- 
-@@ -119,7 +119,7 @@ using Ticks = uint64_t;
- // divide by InvariantTicksPerSecond.
- inline Ticks Start() {
-   Ticks t;
--#if HWY_ARCH_PPC
-+#if HWY_ARCH_PPC && defined(__GLIBC__)
-   asm volatile("mfspr %0, %1" : "=r"(t) : "i"(268));
- #elif HWY_ARCH_X86 && HWY_COMPILER_MSVC
-   _ReadWriteBarrier();
-@@ -161,7 +161,7 @@ inline Ticks Start() {
- 
- inline Ticks Stop() {
-   uint64_t t;
--#if HWY_ARCH_PPC
-+#if HWY_ARCH_PPC && defined(__GLIBC__)
-   asm volatile("mfspr %0, %1" : "=r"(t) : "i"(268));
- #elif HWY_ARCH_X86 && HWY_COMPILER_MSVC
-   _ReadWriteBarrier();
-@@ -399,7 +399,7 @@ double NominalClockRate() {
- }  // namespace
- 
- double InvariantTicksPerSecond() {
--#if HWY_ARCH_PPC
-+#if HWY_ARCH_PPC && defined(__GLIBC__)
-   return __ppc_get_timebase_freq();
- #elif HWY_ARCH_X86
-   // We assume the TSC is invariant; it is on all recent Intel/AMD CPUs.