summaryrefslogtreecommitdiffstats
path: root/upstream.patch
blob: 1150e4ac5d5389569eba899f00e9263782b1095f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
From 57b759ff26257c956f799b5c1bfe276688913e88 Mon Sep 17 00:00:00 2001
From: Kleis Auke Wolthuizen <github@kleisauke.nl>
Date: Tue, 9 Dec 2025 20:20:06 +0100
Subject: [PATCH] Fix build against GraphicsMagick (#4798)

GraphicsMagick does not provide the `MagickPathExtent` definition,
use `MaxPathExtent` instead.

Resolves: #4796.
---
 libvips/foreign/magick6load.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libvips/foreign/magick6load.c b/libvips/foreign/magick6load.c
index b809fae301..83055b7492 100644
--- a/libvips/foreign/magick6load.c
+++ b/libvips/foreign/magick6load.c
@@ -1120,7 +1120,7 @@ vips_foreign_load_magick_source_header(VipsForeignLoad *load)
 		const char *filename =
 			vips_connection_filename(VIPS_CONNECTION(magick_source->source));
 
-		g_strlcpy(magick->image_info->filename, filename, MagickPathExtent);
+		g_strlcpy(magick->image_info->filename, filename, MaxPathExtent);
 		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)