Please find below a Christmas diff to update libraw. As usually upstream
has broken ABI.

 - Update libraw to 0.21.0
  - Changelog: https://www.libraw.org/news/libraw-0-21-release
 - fix gegl04, gthumb, krita and libkdcraw with patches from upstream.
   Maintainer CC'ed.
 - Rename swap24 and swap32 to unbreak the build

OK, Comments?

Rafael


Index: graphics/gegl04/Makefile
===================================================================
RCS file: /cvs/ports/graphics/gegl04/Makefile,v
retrieving revision 1.36
diff -u -p -u -p -r1.36 Makefile
--- graphics/gegl04/Makefile    14 Nov 2022 08:03:34 -0000      1.36
+++ graphics/gegl04/Makefile    24 Dec 2022 12:34:05 -0000
@@ -4,6 +4,7 @@ V=                      0.4.40
 DISTNAME=              gegl-${V}
 PKGNAME=               gegl04-${V}
 EXTRACT_SUFX=          .tar.xz
+REVISION=              0
 
 SHARED_LIBS += gegl-0.4                  0.5 # 0.439.1
 
Index: graphics/gegl04/patches/patch-operations_external_raw-load_c
===================================================================
RCS file: graphics/gegl04/patches/patch-operations_external_raw-load_c
diff -N graphics/gegl04/patches/patch-operations_external_raw-load_c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ graphics/gegl04/patches/patch-operations_external_raw-load_c        24 Dec 
2022 12:34:05 -0000
@@ -0,0 +1,17 @@
+https://gitlab.gnome.org/GNOME/gegl/-/merge_requests/133
+Index: operations/external/raw-load.c
+--- operations/external/raw-load.c.orig
++++ operations/external/raw-load.c
+@@ -114,8 +114,12 @@ prepare (GeglOperation *operation)
+         g_warning ("raw-load: Error Initializing raw library");
+       else
+         {
++#if LIBRAW_COMPILE_CHECK_VERSION_NOTLESS(0, 21)
++          p->LibRaw->rawparams.shot_select = o->image_num;
++#else
+           p->LibRaw->params.shot_select = o->image_num;
+     
++#endif
+           p->LibRaw->params.aber[0] = 1.0;
+           p->LibRaw->params.aber[2] = 1.0;
+           //p->LibRaw->params.gamm[0] = 1.0 / 2.4;
Index: graphics/gthumb/Makefile
===================================================================
RCS file: /cvs/ports/graphics/gthumb/Makefile,v
retrieving revision 1.129
diff -u -p -u -p -r1.129 Makefile
--- graphics/gthumb/Makefile    4 Nov 2022 09:14:23 -0000       1.129
+++ graphics/gthumb/Makefile    24 Dec 2022 12:34:05 -0000
@@ -2,7 +2,7 @@ COMMENT=        image viewer and browser for GN
 
 GNOME_PROJECT= gthumb
 GNOME_VERSION= 3.12.2
-REVISION=      1
+REVISION=      2
 
 CATEGORIES=    graphics
 
Index: 
graphics/gthumb/patches/patch-extensions_raw_files_gth-metadata-provider-raw_c
===================================================================
RCS file: 
graphics/gthumb/patches/patch-extensions_raw_files_gth-metadata-provider-raw_c
diff -N 
graphics/gthumb/patches/patch-extensions_raw_files_gth-metadata-provider-raw_c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ 
graphics/gthumb/patches/patch-extensions_raw_files_gth-metadata-provider-raw_c  
    24 Dec 2022 12:34:05 -0000
@@ -0,0 +1,13 @@
+https://gitlab.gnome.org/GNOME/gthumb/-/commit/da0d3f22a5c3a141211d943e7d963d14090011ec
+Index: extensions/raw_files/gth-metadata-provider-raw.c
+--- extensions/raw_files/gth-metadata-provider-raw.c.orig
++++ extensions/raw_files/gth-metadata-provider-raw.c
+@@ -62,7 +62,7 @@ gth_metadata_provider_raw_read (GthMetadataProvider *s
+       if (!_g_mime_type_is_raw (gth_file_data_get_mime_type (file_data)))
+               return;
+ 
+-      raw_data = libraw_init (LIBRAW_OPIONS_NO_MEMERR_CALLBACK | 
LIBRAW_OPIONS_NO_DATAERR_CALLBACK);
++      raw_data = libraw_init (GTH_LIBRAW_INIT_OPTIONS);
+       if (raw_data == NULL)
+               goto fatal_error;
+ 
Index: 
graphics/gthumb/patches/patch-extensions_raw_files_gth-metadata-provider-raw_h
===================================================================
RCS file: 
graphics/gthumb/patches/patch-extensions_raw_files_gth-metadata-provider-raw_h
diff -N 
graphics/gthumb/patches/patch-extensions_raw_files_gth-metadata-provider-raw_h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ 
graphics/gthumb/patches/patch-extensions_raw_files_gth-metadata-provider-raw_h  
    24 Dec 2022 12:34:05 -0000
@@ -0,0 +1,18 @@
+https://gitlab.gnome.org/GNOME/gthumb/-/commit/da0d3f22a5c3a141211d943e7d963d14090011ec
+Index: extensions/raw_files/gth-metadata-provider-raw.h
+--- extensions/raw_files/gth-metadata-provider-raw.h.orig
++++ extensions/raw_files/gth-metadata-provider-raw.h
+@@ -25,6 +25,13 @@
+ #include <glib.h>
+ #include <glib-object.h>
+ #include <gthumb.h>
++#include <libraw.h>
++
++#if LIBRAW_COMPILE_CHECK_VERSION_NOTLESS(0, 21)
++#define GTH_LIBRAW_INIT_OPTIONS (LIBRAW_OPIONS_NO_DATAERR_CALLBACK)
++#else
++#define GTH_LIBRAW_INIT_OPTIONS (LIBRAW_OPIONS_NO_MEMERR_CALLBACK | 
LIBRAW_OPIONS_NO_DATAERR_CALLBACK)
++#endif
+ 
+ #define GTH_TYPE_METADATA_PROVIDER_RAW         
(gth_metadata_provider_raw_get_type ())
+ #define GTH_METADATA_PROVIDER_RAW(o)           (G_TYPE_CHECK_INSTANCE_CAST 
((o), GTH_TYPE_METADATA_PROVIDER_RAW, GthMetadataProviderRaw))
Index: graphics/gthumb/patches/patch-extensions_raw_files_main_c
===================================================================
RCS file: graphics/gthumb/patches/patch-extensions_raw_files_main_c
diff -N graphics/gthumb/patches/patch-extensions_raw_files_main_c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ graphics/gthumb/patches/patch-extensions_raw_files_main_c   24 Dec 2022 
12:34:05 -0000
@@ -0,0 +1,22 @@
+https://gitlab.gnome.org/GNOME/gthumb/-/commit/da0d3f22a5c3a141211d943e7d963d14090011ec
+Index: extensions/raw_files/main.c
+--- extensions/raw_files/main.c.orig
++++ extensions/raw_files/main.c
+@@ -213,7 +213,7 @@ _cairo_image_surface_create_from_raw (GInputStream  *i
+       size_t         size;
+       GthImage      *image = NULL;
+ 
+-      raw_data = libraw_init (LIBRAW_OPIONS_NO_MEMERR_CALLBACK | 
LIBRAW_OPIONS_NO_DATAERR_CALLBACK);
++      raw_data = libraw_init (GTH_LIBRAW_INIT_OPTIONS);
+       if (raw_data == NULL) {
+               _libraw_set_gerror (error, errno);
+               goto fatal_error;
+@@ -300,7 +300,7 @@ _cairo_image_surface_create_from_raw (GInputStream  *i
+               if ((original_width != NULL) && (original_height != NULL)) {
+                       libraw_close (raw_data);
+ 
+-                      raw_data = libraw_init 
(LIBRAW_OPIONS_NO_MEMERR_CALLBACK | LIBRAW_OPIONS_NO_DATAERR_CALLBACK);
++                      raw_data = libraw_init (GTH_LIBRAW_INIT_OPTIONS);
+                       if (raw_data == NULL)
+                               goto fatal_error;
+ 
Index: graphics/krita/Makefile
===================================================================
RCS file: /cvs/ports/graphics/krita/Makefile,v
retrieving revision 1.64
diff -u -p -u -p -r1.64 Makefile
--- graphics/krita/Makefile     17 Dec 2022 10:01:45 -0000      1.64
+++ graphics/krita/Makefile     24 Dec 2022 12:34:05 -0000
@@ -2,6 +2,7 @@ COMMENT =       advanced drawing and image man
 
 VERSION =      5.1.4
 DISTNAME =     krita-${VERSION}
+REVISION =     0
 
 SHARED_LIBS +=  kritabasicflakes          4.1 # 16.0
 SHARED_LIBS +=  kritacolord               2.0 # 16.0
Index: 
graphics/krita/patches/patch-plugins_impex_raw_3rdparty_libkdcraw_src_kdcraw_cpp
===================================================================
RCS file: 
graphics/krita/patches/patch-plugins_impex_raw_3rdparty_libkdcraw_src_kdcraw_cpp
diff -N 
graphics/krita/patches/patch-plugins_impex_raw_3rdparty_libkdcraw_src_kdcraw_cpp
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ 
graphics/krita/patches/patch-plugins_impex_raw_3rdparty_libkdcraw_src_kdcraw_cpp
    24 Dec 2022 12:34:05 -0000
@@ -0,0 +1,15 @@
+Index: plugins/impex/raw/3rdparty/libkdcraw/src/kdcraw.cpp
+--- plugins/impex/raw/3rdparty/libkdcraw/src/kdcraw.cpp.orig
++++ plugins/impex/raw/3rdparty/libkdcraw/src/kdcraw.cpp
+@@ -383,7 +383,11 @@ bool KDcraw::extractRAWData(const QString& filePath, Q
+     d->setProgress(0.3);
+ 
+     raw.imgdata.params.output_bps  = 16;
++#if LIBRAW_COMPILE_CHECK_VERSION_NOTLESS(0, 21)
++    raw.imgdata.rawparams.shot_select = shotSelect;
++#else
+     raw.imgdata.params.shot_select = shotSelect;
++#endif
+     ret                            = raw.unpack();
+ 
+     if (ret != LIBRAW_SUCCESS)
Index: graphics/libraw/Makefile
===================================================================
RCS file: /cvs/ports/graphics/libraw/Makefile,v
retrieving revision 1.47
diff -u -p -u -p -r1.47 Makefile
--- graphics/libraw/Makefile    11 Mar 2022 19:22:45 -0000      1.47
+++ graphics/libraw/Makefile    24 Dec 2022 12:34:05 -0000
@@ -1,11 +1,11 @@
 COMMENT =              library for reading RAW files
 
-DISTNAME =             LibRaw-0.20.2
+DISTNAME =             LibRaw-0.21.0
 PKGNAME =              ${DISTNAME:L}
 CATEGORIES =           graphics
 
-SHARED_LIBS +=  raw                  4.1      # 15.0
-SHARED_LIBS +=  raw_r                4.1      # 15.0
+SHARED_LIBS +=  raw                  5.0 # 23.0
+SHARED_LIBS +=  raw_r                5.0 # 23.0
 
 HOMEPAGE =             https://www.libraw.org/
 
Index: graphics/libraw/distinfo
===================================================================
RCS file: /cvs/ports/graphics/libraw/distinfo,v
retrieving revision 1.18
diff -u -p -u -p -r1.18 distinfo
--- graphics/libraw/distinfo    26 Oct 2020 18:15:37 -0000      1.18
+++ graphics/libraw/distinfo    24 Dec 2022 12:34:05 -0000
@@ -1,2 +1,2 @@
-SHA256 (LibRaw-0.20.2.tar.gz) = 3BtIbCADQ1czBD5OBSc0dzJuUcPqVUxoZKTq+v8QBKY=
-SIZE (LibRaw-0.20.2.tar.gz) = 1432141
+SHA256 (LibRaw-0.21.0.tar.gz) = h0ezToU0zC3X74ySxDZBSzV4kE/Uv5uH6mDxeqmfsL0=
+SIZE (LibRaw-0.21.0.tar.gz) = 1638463
Index: graphics/libraw/patches/patch-libraw_pc_in
===================================================================
RCS file: /cvs/ports/graphics/libraw/patches/patch-libraw_pc_in,v
retrieving revision 1.4
diff -u -p -u -p -r1.4 patch-libraw_pc_in
--- graphics/libraw/patches/patch-libraw_pc_in  11 Mar 2022 19:22:45 -0000      
1.4
+++ graphics/libraw/patches/patch-libraw_pc_in  24 Dec 2022 12:34:05 -0000
@@ -3,10 +3,11 @@ Do not hardcode -lstdc++ (symbol mismatc
 Index: libraw.pc.in
 --- libraw.pc.in.orig
 +++ libraw.pc.in
-@@ -7,5 +7,5 @@ Name: libraw
+@@ -7,6 +7,6 @@ Name: libraw
  Description: Raw image decoder library (non-thread-safe)
  Requires: @PACKAGE_REQUIRES@
  Version: @PACKAGE_VERSION@
 -Libs: -L${libdir} -lraw -lstdc++@PC_OPENMP@
 +Libs: -L${libdir} -lraw@PC_OPENMP@
+ Libs.private: @PACKAGE_LIBS_PRIVATE@
  Cflags: -I${includedir}/libraw -I${includedir}
Index: graphics/libraw/patches/patch-libraw_r_pc_in
===================================================================
RCS file: /cvs/ports/graphics/libraw/patches/patch-libraw_r_pc_in,v
retrieving revision 1.3
diff -u -p -u -p -r1.3 patch-libraw_r_pc_in
--- graphics/libraw/patches/patch-libraw_r_pc_in        11 Mar 2022 19:22:45 
-0000      1.3
+++ graphics/libraw/patches/patch-libraw_r_pc_in        24 Dec 2022 12:34:05 
-0000
@@ -3,10 +3,11 @@ Do not hardcode -lstdc++ (symbol mismatc
 Index: libraw_r.pc.in
 --- libraw_r.pc.in.orig
 +++ libraw_r.pc.in
-@@ -7,5 +7,5 @@ Name: libraw
+@@ -7,6 +7,6 @@ Name: libraw
  Description: Raw image decoder library (thread-safe)
  Requires: @PACKAGE_REQUIRES@
  Version: @PACKAGE_VERSION@
 -Libs: -L${libdir} -lraw_r -lstdc++@PC_OPENMP@
 +Libs: -L${libdir} -lraw_r@PC_OPENMP@
+ Libs.private: @PACKAGE_LIBS_PRIVATE@
  Cflags: -I${includedir}/libraw -I${includedir}
Index: graphics/libraw/patches/patch-src_decoders_fp_dng_cpp
===================================================================
RCS file: graphics/libraw/patches/patch-src_decoders_fp_dng_cpp
diff -N graphics/libraw/patches/patch-src_decoders_fp_dng_cpp
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ graphics/libraw/patches/patch-src_decoders_fp_dng_cpp       24 Dec 2022 
12:34:05 -0000
@@ -0,0 +1,33 @@
+Index: src/decoders/fp_dng.cpp
+--- src/decoders/fp_dng.cpp.orig
++++ src/decoders/fp_dng.cpp
+@@ -556,7 +556,7 @@ _forceinline
+ #else
+ inline
+ #endif
+-void swap24(uchar *data, int len)
++void _swap24(uchar *data, int len)
+ {
+     for (int i = 0; i < len - 2; i += 3)
+     {
+@@ -572,7 +572,7 @@ _forceinline
+ #else
+ inline
+ #endif
+-void swap32(uchar *data, int len)
++void _swap32(uchar *data, int len)
+ {
+     unsigned *d = (unsigned*)data;
+     for (int i = 0; i < len / 4; i++)
+@@ -646,9 +646,9 @@ void LibRaw::uncompressed_fp_dng_load_raw()
+                 if (bytesps == 2 && difford)
+                     libraw_swab(dst, fullrowbytes);
+                 else if (bytesps == 3 && 
(libraw_internal_data.unpacker_data.order == 0x4949)) // II-16bit
+-                    swap24(dst, fullrowbytes);
++                    _swap24(dst, fullrowbytes);
+                 if (bytesps == 4 && difford)
+-                    swap32(dst, fullrowbytes);
++                    _swap32(dst, fullrowbytes);
+ 
+                 float lmax = expandFloats(
+                     dst,
Index: x11/kde-applications/libkdcraw/Makefile
===================================================================
RCS file: /cvs/ports/x11/kde-applications/libkdcraw/Makefile,v
retrieving revision 1.9
diff -u -p -u -p -r1.9 Makefile
--- x11/kde-applications/libkdcraw/Makefile     11 Mar 2022 20:16:29 -0000      
1.9
+++ x11/kde-applications/libkdcraw/Makefile     24 Dec 2022 12:34:27 -0000
@@ -2,6 +2,7 @@ COMMENT =       KDE wrapper around the LibRaw 
 DISTNAME =     libkdcraw-${VERSION}
 PKGNAME =      libkdcraw-kf5-${VERSION}
 CATEGORIES =   devel graphics
+REVISION =     0
 
 SHARED_LIBS +=  KF5KDcraw                 2.0 # 0.0
 
Index: x11/kde-applications/libkdcraw/patches/patch-src_kdcraw_cpp
===================================================================
RCS file: x11/kde-applications/libkdcraw/patches/patch-src_kdcraw_cpp
diff -N x11/kde-applications/libkdcraw/patches/patch-src_kdcraw_cpp
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ x11/kde-applications/libkdcraw/patches/patch-src_kdcraw_cpp 24 Dec 2022 
12:34:27 -0000
@@ -0,0 +1,17 @@
+https://invent.kde.org/graphics/libkdcraw/-/commit/0843c601cbb9a9bb5774ed01b7d90e68fd17950a
+
+Index: src/kdcraw.cpp
+--- src/kdcraw.cpp.orig
++++ src/kdcraw.cpp
+@@ -357,7 +357,11 @@ bool KDcraw::extractRAWData(const QString& filePath, Q
+     d->setProgress(0.3);
+ 
+     raw.imgdata.params.output_bps  = 16;
++#if LIBRAW_COMPILE_CHECK_VERSION_NOTLESS(0, 21)
++    raw.imgdata.rawparams.shot_select = shotSelect;
++#else
+     raw.imgdata.params.shot_select = shotSelect;
++#endif
+     ret                            = raw.unpack();
+ 
+     if (ret != LIBRAW_SUCCESS)

Reply via email to