forked from pool/libjxl
add skcms/gtk pieces from rq 1111631
wrap blocks in with(out)_bcond OBS-URL: https://build.opensuse.org/package/show/graphics/libjxl?expand=0&rev=26
This commit is contained in:
parent
648fa6c994
commit
1a02eb904a
2
.gitattributes
vendored
2
.gitattributes
vendored
@ -21,3 +21,5 @@
|
||||
*.xz filter=lfs diff=lfs merge=lfs -text
|
||||
*.zip filter=lfs diff=lfs merge=lfs -text
|
||||
*.zst filter=lfs diff=lfs merge=lfs -text
|
||||
## Specific LFS patterns
|
||||
skcms.tar filter=lfs diff=lfs merge=lfs -text
|
||||
|
@ -1,117 +0,0 @@
|
||||
From 057cd06c19875bcf8b5d34d41d92a8abdb856b7c Mon Sep 17 00:00:00 2001
|
||||
From: Kleis Auke Wolthuizen <github@kleisauke.nl>
|
||||
Date: Fri, 11 Mar 2022 21:11:24 +0100
|
||||
Subject: [PATCH] Remove LCMS mutex (#112)
|
||||
|
||||
* Remove LCMS mutex
|
||||
|
||||
Requires mm2/Little-CMS@a35bacd, which is released in LCMS v2.11.
|
||||
|
||||
* Use a threadsafe alternative of gmtime in LCMS
|
||||
|
||||
Requires mm2/Little-CMS@68ee2ff, which is released in LCMS v2.13.
|
||||
|
||||
LCMS submodule was updated to version 2.13.1 instead.
|
||||
---
|
||||
lib/jxl/enc_color_management.cc | 15 +++++++++++++++
|
||||
third_party/CMakeLists.txt | 2 +-
|
||||
third_party/lcms2.cmake | 14 --------------
|
||||
3 files changed, 16 insertions(+), 15 deletions(-)
|
||||
|
||||
Index: libjxl-0.8.1/lib/jxl/enc_color_management.cc
|
||||
===================================================================
|
||||
--- libjxl-0.8.1.orig/lib/jxl/enc_color_management.cc
|
||||
+++ libjxl-0.8.1/lib/jxl/enc_color_management.cc
|
||||
@@ -18,6 +18,7 @@
|
||||
#include <array>
|
||||
#include <atomic>
|
||||
#include <memory>
|
||||
+#include <mutex>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
@@ -308,6 +309,14 @@ int DoColorSpaceTransform(void* t, size_
|
||||
// Define to 1 on OS X as a workaround for older LCMS lacking MD5.
|
||||
#define JXL_CMS_OLD_VERSION 0
|
||||
|
||||
+// cms functions (even *THR) are not thread-safe, except cmsDoTransform.
|
||||
+// To ensure all functions are covered without frequent lock-taking nor risk of
|
||||
+// recursive lock, we lock in the top-level APIs.
|
||||
+static std::mutex& LcmsMutex() {
|
||||
+ static std::mutex m;
|
||||
+ return m;
|
||||
+}
|
||||
+
|
||||
#if JPEGXL_ENABLE_SKCMS
|
||||
|
||||
JXL_MUST_USE_RESULT CIExy CIExyFromXYZ(const float XYZ[3]) {
|
||||
@@ -871,6 +880,9 @@ bool ApplyCICP(const uint8_t color_prima
|
||||
|
||||
} // namespace
|
||||
|
||||
+// All functions that call lcms directly (except ColorSpaceTransform::Run) must
|
||||
+// lock LcmsMutex().
|
||||
+
|
||||
Status ColorEncoding::SetFieldsFromICC() {
|
||||
// In case parsing fails, mark the ColorEncoding as invalid.
|
||||
SetColorSpace(ColorSpace::kUnknown);
|
||||
@@ -917,6 +929,7 @@ Status ColorEncoding::SetFieldsFromICC()
|
||||
DetectTransferFunction(profile, this);
|
||||
#else // JPEGXL_ENABLE_SKCMS
|
||||
|
||||
+ std::lock_guard<std::mutex> guard(LcmsMutex());
|
||||
const cmsContext context = GetContext();
|
||||
|
||||
Profile profile;
|
||||
@@ -984,6 +997,7 @@ void JxlCmsDestroy(void* cms_data) {
|
||||
if (cms_data == nullptr) return;
|
||||
JxlCms* t = reinterpret_cast<JxlCms*>(cms_data);
|
||||
#if !JPEGXL_ENABLE_SKCMS
|
||||
+ std::lock_guard<std::mutex> guard(LcmsMutex());
|
||||
TransformDeleter()(t->lcms_transform);
|
||||
#endif
|
||||
delete t;
|
||||
@@ -1020,6 +1034,7 @@ void* JxlCmsInit(void* init_data, size_t
|
||||
return nullptr;
|
||||
}
|
||||
#else // JPEGXL_ENABLE_SKCMS
|
||||
+ std::lock_guard<std::mutex> guard(LcmsMutex());
|
||||
const cmsContext context = GetContext();
|
||||
Profile profile_src, profile_dst;
|
||||
if (!DecodeProfile(context, c_src.ICC(), &profile_src)) {
|
||||
Index: libjxl-0.8.1/third_party/CMakeLists.txt
|
||||
===================================================================
|
||||
--- libjxl-0.8.1.orig/third_party/CMakeLists.txt
|
||||
+++ libjxl-0.8.1/third_party/CMakeLists.txt
|
||||
@@ -111,7 +111,7 @@ if (JPEGXL_ENABLE_SKCMS OR JPEGXL_ENABLE
|
||||
endif ()
|
||||
if (JPEGXL_ENABLE_VIEWERS OR NOT JPEGXL_ENABLE_SKCMS)
|
||||
if( NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/lcms/.git" OR JPEGXL_FORCE_SYSTEM_LCMS2 )
|
||||
- find_package(LCMS2 2.13)
|
||||
+ find_package(LCMS2 2.10)
|
||||
if ( NOT LCMS2_FOUND )
|
||||
message(FATAL_ERROR "Please install lcms2 or run git submodule update --init")
|
||||
endif ()
|
||||
Index: libjxl-0.8.1/third_party/lcms2.cmake
|
||||
===================================================================
|
||||
--- libjxl-0.8.1.orig/third_party/lcms2.cmake
|
||||
+++ libjxl-0.8.1/third_party/lcms2.cmake
|
||||
@@ -60,18 +60,4 @@ target_compile_definitions(lcms2
|
||||
target_compile_definitions(lcms2
|
||||
PUBLIC "-DCMS_NO_REGISTER_KEYWORD=1")
|
||||
|
||||
-# Ensure that a thread safe alternative of gmtime is used in LCMS
|
||||
-include(CheckSymbolExists)
|
||||
-check_symbol_exists(gmtime_r "time.h" HAVE_GMTIME_R)
|
||||
-if (HAVE_GMTIME_R)
|
||||
- target_compile_definitions(lcms2
|
||||
- PUBLIC "-DHAVE_GMTIME_R=1")
|
||||
-else()
|
||||
- check_symbol_exists(gmtime_s "time.h" HAVE_GMTIME_S)
|
||||
- if (HAVE_GMTIME_S)
|
||||
- target_compile_definitions(lcms2
|
||||
- PUBLIC "-DHAVE_GMTIME_S=1")
|
||||
- endif()
|
||||
-endif()
|
||||
-
|
||||
set_property(TARGET lcms2 PROPERTY POSITION_INDEPENDENT_CODE ON)
|
11
_service
Normal file
11
_service
Normal file
@ -0,0 +1,11 @@
|
||||
<services>
|
||||
<service name="tar_scm" mode="manual">
|
||||
<param name="scm">git</param>
|
||||
<param name="url">https://github.com/libjxl/libjxl.git/</param>
|
||||
<param name="submodules">enable</param>
|
||||
<param name="subdir">third_party/skcms</param>
|
||||
<param name="revision">v0.8.2</param>
|
||||
<param name="filename">skcms</param>
|
||||
<param name="version">_none_</param>
|
||||
</service>
|
||||
</services>
|
@ -1,3 +1,23 @@
|
||||
-------------------------------------------------------------------
|
||||
Thu Sep 21 13:34:05 UTC 2023 - Jan Engelhardt <jengelh@inai.de>
|
||||
|
||||
- Switch from LCMS to SKCMS; delete 0001-Remove-LCMS-mutex.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Sat Sep 16 06:58:55 UTC 2023 - Atri Bhattacharya <badshah400@gmail.com>
|
||||
|
||||
- Build plugins:
|
||||
* Add _service file to generate skcms tarball (needed to build
|
||||
plugins).
|
||||
* Add skcms tarball as source and copy extracted dir to
|
||||
./third_party/ so cmake can find it.
|
||||
* Split out new packages:
|
||||
* gdk-pixbuf-loader-jxl: Pixbuf loader for supported apps.
|
||||
* gimp-plugin-jxl: Plugin to allow gimp to work with JPEG XL
|
||||
files.
|
||||
* jxl-thumbnailer: Thumbnailer and mime files to allow
|
||||
generating thumbnails for JPEG XL files.
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Jun 14 13:00:09 UTC 2023 - Jan Engelhardt <jengelh@inai.de>
|
||||
|
||||
|
73
libjxl.spec
73
libjxl.spec
@ -18,6 +18,7 @@
|
||||
|
||||
Name: libjxl
|
||||
%define lname libjxl0_8
|
||||
%bcond_without gtk
|
||||
Version: 0.8.2
|
||||
Release: 0
|
||||
Summary: JPEG XL reference implementation
|
||||
@ -26,11 +27,15 @@ URL: https://jpegxl.info/
|
||||
#Git-Clone: https://github.com/libjxl/libjxl
|
||||
Source: https://github.com/libjxl/libjxl/archive/refs/tags/v%version.tar.gz
|
||||
Source1: baselibs.conf
|
||||
Patch0: 0001-Remove-LCMS-mutex.patch
|
||||
Source2: skcms.tar
|
||||
BuildRequires: c++_compiler
|
||||
BuildRequires: cmake
|
||||
BuildRequires: pkg-config
|
||||
BuildRequires: pkgconfig(lcms2) >= 2.10
|
||||
%if %{with gtk}
|
||||
BuildRequires: pkgconfig(gdk-pixbuf-2.0) >= 2.36
|
||||
BuildRequires: pkgconfig(gimp-2.0) >= 2.10
|
||||
BuildRequires: pkgconfig(gimpui-2.0) >= 2.10
|
||||
%endif
|
||||
BuildRequires: pkgconfig(libbrotlicommon)
|
||||
BuildRequires: pkgconfig(libbrotlidec)
|
||||
BuildRequires: pkgconfig(libbrotlienc)
|
||||
@ -38,6 +43,9 @@ BuildRequires: pkgconfig(libhwy) >= 1.0
|
||||
BuildRequires: pkgconfig(libjpeg)
|
||||
BuildRequires: pkgconfig(libpng)
|
||||
%{?suse_build_hwcaps_libs}
|
||||
%if %{with gtk}
|
||||
Provides: bundled(skcms) = 0
|
||||
%endif
|
||||
|
||||
%description
|
||||
JPEG XL is a raster-graphics file format that supports both lossy and
|
||||
@ -68,23 +76,39 @@ Summary: Command-line utilities to convert from/to JPEG XL
|
||||
%description tools
|
||||
Command-line utilities to convert from/to JPEG XL.
|
||||
|
||||
%prep
|
||||
%setup -q
|
||||
%package -n gdk-pixbuf-loader-jxl
|
||||
Summary: A gdk-pixbuf loader for JPEG-XL using libjxl
|
||||
Supplements: (%lname and gdk-pixbuf)
|
||||
%gdk_pixbuf_loader_requires
|
||||
|
||||
%if %{pkg_vcmp liblcms2-2 < 2.13}
|
||||
# libjxl 0.7.0 requires lcms2 >= 2.13, so if we have an older version
|
||||
# (as in SLE15/Leap) just reverse the patch that adds that dependency
|
||||
%patch0 -p1
|
||||
%else
|
||||
# Make sure patch at least applies
|
||||
%patch0 -p1
|
||||
%patch0 -p1 -R
|
||||
%endif
|
||||
%description -n gdk-pixbuf-loader-jxl
|
||||
This package provides a libjxl-based gdk-pixbuf loader for JPEG XL files.
|
||||
|
||||
%package -n gimp-plugin-jxl
|
||||
Summary: Plugin for GIMP to enable working with JPEG XL files
|
||||
Supplements: (%lname and gimp)
|
||||
|
||||
%description -n gimp-plugin-jxl
|
||||
This package provides a plugin for GIMP 2.0 to enable it to work with JPEG XL files.
|
||||
|
||||
%package -n jxl-thumbnailer
|
||||
Summary: Generate thumbnails for JPEG XL files
|
||||
BuildArch: noarch
|
||||
|
||||
%description -n jxl-thumbnailer
|
||||
This package provides a thumbnailer to render for JPEG XL file thumbnails,
|
||||
for example, on file-browsers.
|
||||
|
||||
%prep
|
||||
%setup -a2
|
||||
mv skcms third_party/
|
||||
|
||||
%build
|
||||
%cmake -DJPEGXL_FORCE_SYSTEM_HWY=ON -DJPEGXL_FORCE_SYSTEM_BROTLI=ON \
|
||||
-DJPEGXL_FORCE_SYSTEM_LCMS2=ON -DBUILD_TESTING=OFF \
|
||||
-DJPEGXL_ENABLE_PLUGINS=OFF -DJPEGXL_ENABLE_SKCMS=OFF \
|
||||
-DJPEGXL_FORCE_SYSTEM_LCMS2=OFF -DBUILD_TESTING=OFF \
|
||||
%if %{with gtk}
|
||||
-DJPEGXL_ENABLE_PLUGINS=ON -DJPEGXL_ENABLE_SKCMS=ON \
|
||||
%endif
|
||||
-DJPEGXL_ENABLE_SJPEG=OFF
|
||||
%cmake_build
|
||||
|
||||
@ -94,6 +118,12 @@ rm -fv %buildroot/%_libdir/*.a
|
||||
|
||||
%ldconfig_scriptlets -n %lname
|
||||
|
||||
%post -n gdk-pixbuf-loader-jxl
|
||||
%gdk_pixbuf_loader_post
|
||||
|
||||
%postun -n gdk-pixbuf-loader-jxl
|
||||
%gdk_pixbuf_loader_postun
|
||||
|
||||
%files -n %lname
|
||||
%license LICENSE
|
||||
%_libdir/libjxl*.so.*
|
||||
@ -108,4 +138,17 @@ rm -fv %buildroot/%_libdir/*.a
|
||||
%_libdir/libjxl_threads.so
|
||||
%_libdir/pkgconfig/*.pc
|
||||
|
||||
%if %{with gtk}
|
||||
%files -n gdk-pixbuf-loader-jxl
|
||||
%_libdir/gdk-pixbuf-2.0/*/loaders/libpixbufloader-jxl.so
|
||||
|
||||
%files -n gimp-plugin-jxl
|
||||
%_libdir/gimp/2.0/plug-ins/file-jxl/
|
||||
|
||||
%files -n jxl-thumbnailer
|
||||
%dir %_datadir/thumbnailers
|
||||
%_datadir/thumbnailers/*.thumbnailer
|
||||
%_datadir/mime/packages/*.xml
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
|
Loading…
Reference in New Issue
Block a user