summaryrefslogtreecommitdiffstats
path: root/upstream.patch
diff options
context:
space:
mode:
authorRemi Collet <remi@remirepo.net>2025-12-10 16:24:55 +0100
committerRemi Collet <remi@php.net>2025-12-10 16:24:55 +0100
commitcc428e15c618d7fe5d4ab6923f78085490068d44 (patch)
treedd03819b86b37c04f48d507149a1b392b62c411b /upstream.patch
parent00602bd5665c187ecd200bfd9e4e1b12ae142888 (diff)
add upstream fix for libraw < 0.21
add upstream fix for GraphicsMagick
Diffstat (limited to 'upstream.patch')
-rw-r--r--upstream.patch93
1 files changed, 93 insertions, 0 deletions
diff --git a/upstream.patch b/upstream.patch
index 8ce691c..1150e4a 100644
--- a/upstream.patch
+++ b/upstream.patch
@@ -24,3 +24,96 @@ index b809fae301..83055b7492 100644
magick_sniff_file(magick->image_info, filename);
magick->image = ReadImage(magick->image_info, magick->exception);
}
+From 7470eb84b060eea0c6ece9b6f4add1f262b50445 Mon Sep 17 00:00:00 2001
+From: Kleis Auke Wolthuizen <github@kleisauke.nl>
+Date: Tue, 9 Dec 2025 16:52:22 +0100
+Subject: [PATCH] Ensure compatibility with libraw < 0.21
+
+Resolves: #4795.
+---
+ libvips/foreign/dcrawload.c | 19 +++++++++++++++++++
+ meson.build | 3 ++-
+ 2 files changed, 21 insertions(+), 1 deletion(-)
+
+diff --git a/libvips/foreign/dcrawload.c b/libvips/foreign/dcrawload.c
+index 74bc5067be..c2c710937e 100644
+--- a/libvips/foreign/dcrawload.c
++++ b/libvips/foreign/dcrawload.c
+@@ -133,8 +133,10 @@ vips_foreign_load_dcraw_set_metadata(VipsForeignLoadDcRaw *raw,
+ raw->raw_processor->idata.make);
+ vips_image_set_string(image, "raw-model",
+ raw->raw_processor->idata.model);
++#if LIBRAW_COMPILE_CHECK_VERSION_NOTLESS(0, 17)
+ vips_image_set_string(image, "raw-software",
+ raw->raw_processor->idata.software);
++#endif /*LIBRAW_COMPILE_CHECK_VERSION_NOTLESS(0, 17)*/
+ vips_image_set_double(image, "raw-iso",
+ raw->raw_processor->other.iso_speed);
+ vips_image_set_double(image, "raw-shutter",
+@@ -144,6 +146,9 @@ vips_foreign_load_dcraw_set_metadata(VipsForeignLoadDcRaw *raw,
+ vips_image_set_double(image, "raw-focal-length",
+ raw->raw_processor->other.focal_len);
+
++ /* See also: vips__get_iso8601()
++ */
++#if GLIB_CHECK_VERSION(2, 62, 0)
+ GDateTime *dt =
+ g_date_time_new_from_unix_utc(raw->raw_processor->other.timestamp);
+ if (dt) {
+@@ -156,7 +161,18 @@ vips_foreign_load_dcraw_set_metadata(VipsForeignLoadDcRaw *raw,
+
+ g_date_time_unref(dt);
+ }
++#else /*!GLIB_CHECK_VERSION(2, 62, 0)*/
++ GTimeVal val = { raw->raw_processor->other.timestamp, 0 };
++
++ char *str = g_time_val_to_iso8601(&val);
++ if (str) {
++ vips_image_set_string(image, "raw-timestamp", str);
++
++ g_free(str);
++ }
++#endif /*GLIB_CHECK_VERSION(2, 62, 0)*/
+
++#if LIBRAW_COMPILE_CHECK_VERSION_NOTLESS(0, 17)
+ if (raw->raw_processor->idata.xmpdata)
+ vips_image_set_blob_copy(image, VIPS_META_XMP_NAME,
+ raw->raw_processor->idata.xmpdata,
+@@ -164,6 +180,7 @@ vips_foreign_load_dcraw_set_metadata(VipsForeignLoadDcRaw *raw,
+
+ vips_image_set_string(image, "raw-lens",
+ raw->raw_processor->lens.Lens);
++#endif /*LIBRAW_COMPILE_CHECK_VERSION_NOTLESS(0, 17)*/
+
+ if (raw->raw_processor->color.profile)
+ vips_image_set_blob_copy(image, VIPS_META_ICC_NAME,
+@@ -197,6 +214,7 @@ vips_foreign_load_dcraw_set_metadata(VipsForeignLoadDcRaw *raw,
+ }
+ vips_image_set_int(image, VIPS_META_ORIENTATION, orientation);
+
++#if LIBRAW_COMPILE_CHECK_VERSION_NOTLESS(0, 21)
+ /* Search the available thumbnails for the largest that's smaller than
+ * the main image and has a known type.
+ */
+@@ -251,6 +269,7 @@ vips_foreign_load_dcraw_set_metadata(VipsForeignLoadDcRaw *raw,
+ raw->raw_processor->thumbnail.thumb,
+ raw->raw_processor->thumbnail.tlength);
+ }
++#endif /*LIBRAW_COMPILE_CHECK_VERSION_NOTLESS(0, 21)*/
+
+ return 0;
+ }
+diff --git a/meson.build b/meson.build
+index 6f2f8c02f1..7b3705a33d 100644
+--- a/meson.build
++++ b/meson.build
+@@ -455,7 +455,8 @@ if openexr_dep.found()
+ cfg_var.set('HAVE_OPENEXR', true)
+ endif
+
+-libraw_dep = dependency('libraw_r', required: get_option('raw'))
++# require 0.14 for LIBRAW_COMPILE_CHECK_VERSION_NOTLESS
++libraw_dep = dependency('libraw_r', version: '>=0.14', required: get_option('raw'))
+ if libraw_dep.found()
+ external_deps += libraw_dep
+ cfg_var.set('HAVE_LIBRAW', true)