From d4bd8c4c0b2ef4c9ae253e09102ab074ba27ce5c Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Mon, 16 Sep 2019 16:59:52 +0100 Subject: [PATCH 01/11] fix make dist for 8.8.3 --- configure.ac | 1 + libvips/colour/Makefile.am | 3 ++- libvips/colour/profiles/Makefile.am | 3 +++ 3 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 libvips/colour/profiles/Makefile.am diff --git a/configure.ac b/configure.ac index 19e87735..9ff10adc 100644 --- a/configure.ac +++ b/configure.ac @@ -1324,6 +1324,7 @@ AC_OUTPUT([ libvips/Makefile libvips/arithmetic/Makefile libvips/colour/Makefile + libvips/colour/profiles/Makefile libvips/conversion/Makefile libvips/convolution/Makefile libvips/deprecated/Makefile diff --git a/libvips/colour/Makefile.am b/libvips/colour/Makefile.am index 52a4f594..b8ced977 100644 --- a/libvips/colour/Makefile.am +++ b/libvips/colour/Makefile.am @@ -1,5 +1,7 @@ noinst_LTLIBRARIES = libcolour.la +SUBDIRS = profiles + libcolour_la_SOURCES = \ profiles.c \ profiles.h \ @@ -42,7 +44,6 @@ profiles.c: ./wrap-profiles.sh profiles profiles.c EXTRA_DIST = \ - profiles \ wrap-profiles.sh AM_CPPFLAGS = -I${top_srcdir}/libvips/include @VIPS_CFLAGS@ @VIPS_INCLUDES@ diff --git a/libvips/colour/profiles/Makefile.am b/libvips/colour/profiles/Makefile.am new file mode 100644 index 00000000..fc8f9734 --- /dev/null +++ b/libvips/colour/profiles/Makefile.am @@ -0,0 +1,3 @@ +EXTRA_DIST = \ + cmyk.icm \ + sRGB.icm From f2319da762186c00056899f17664ea6607dfadda Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Tue, 17 Sep 2019 16:26:23 +0100 Subject: [PATCH 02/11] remove svg test from test_formats.sh It was very unreliable -- the output of librsvg varies too much between librsvg versions. This is still tested by the Python test suite. --- test/test_formats.sh | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/test/test_formats.sh b/test/test_formats.sh index 60a4cccc..80cc0f15 100755 --- a/test/test_formats.sh +++ b/test/test_formats.sh @@ -12,10 +12,6 @@ set -e poppler=$test_images/blankpage.pdf poppler_ref=$test_images/blankpage.pdf.png -# rsvg / svgload reference image -rsvg=$test_images/blankpage.svg -rsvg_ref=$test_images/blankpage.svg.png - # giflib / gifload reference image giflib=$test_images/trans-x.gif giflib_ref=$test_images/trans-x.png @@ -234,10 +230,7 @@ if test_supported pdfload; then test_loader $poppler_ref $poppler pdfload 0 fi -if test_supported svgload; then - # librsvg can give small differences on some platforms - test_loader $rsvg_ref $rsvg svgload 10 -fi +# don't test SVG --- the output varies too much between librsvg versions if test_supported gifload; then test_loader $giflib_ref $giflib gifload 0 From c9a7b92eebdb628c54a27b0a7e56c21991c8b987 Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Tue, 17 Sep 2019 17:16:26 +0100 Subject: [PATCH 03/11] version bump --- ChangeLog | 2 ++ configure.ac | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index c9e05a6f..778e5f8d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,5 @@ +17/9/19 started 8.8.4 + 31/8/19 started 8.8.3 - revert sharpen restoring the input colourspace - xres/yres tiffsave params were in pixels/cm [f--f] diff --git a/configure.ac b/configure.ac index 9ff10adc..6d43b009 100644 --- a/configure.ac +++ b/configure.ac @@ -2,7 +2,7 @@ # also update the version number in the m4 macros below -AC_INIT([vips], [8.8.3], [vipsip@jiscmail.ac.uk]) +AC_INIT([vips], [8.8.4], [vipsip@jiscmail.ac.uk]) # required for gobject-introspection AC_PREREQ(2.62) @@ -18,7 +18,7 @@ AC_CONFIG_MACRO_DIR([m4]) # user-visible library versioning m4_define([vips_major_version], [8]) m4_define([vips_minor_version], [8]) -m4_define([vips_micro_version], [3]) +m4_define([vips_micro_version], [4]) m4_define([vips_version], [vips_major_version.vips_minor_version.vips_micro_version]) @@ -38,7 +38,7 @@ VIPS_VERSION_STRING=$VIPS_VERSION-`date -u -r ChangeLog` # binary interface changes not backwards compatible?: reset age to 0 LIBRARY_CURRENT=53 -LIBRARY_REVISION=2 +LIBRARY_REVISION=3 LIBRARY_AGE=11 # patched into include/vips/version.h From 04280fd8372f1a1fd9e95d773df106dc8b56f118 Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Wed, 6 Nov 2019 23:22:17 +0000 Subject: [PATCH 04/11] test for orc 0.4.31 the version that should start working again, hopefully --- configure.ac | 13 +++++++++++++ libvips/include/vips/vector.h | 6 ++++-- libvips/iofuncs/vector.c | 7 ++++++- 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index f61de972..45ca5662 100644 --- a/configure.ac +++ b/configure.ac @@ -778,6 +778,19 @@ if test x"$with_orc" != x"no"; then ) fi +# orc 0.4.30+ works with cf-protection, but 0.4.30 has a bug with multiple +# definitions of OrcTargetPowerPCFlags, so insist on 0.4.31 +if test x"$with_orc" = x"yes"; then + PKG_CHECK_MODULES(ORC_CF_PROTECTION, orc-0.4 >= 0.4.31, + [AC_DEFINE(HAVE_ORC_CF_PROTECTION,1, + [define if your orc works with cf-protection.] + ) + ], + [: + ] + ) +fi + # lcms ... refuse to use lcms1 AC_ARG_WITH([lcms], AS_HELP_STRING([--without-lcms], [build without lcms (default: test)])) diff --git a/libvips/include/vips/vector.h b/libvips/include/vips/vector.h index 0bbe3504..3752395a 100644 --- a/libvips/include/vips/vector.h +++ b/libvips/include/vips/vector.h @@ -37,15 +37,17 @@ /* If we are building with -fcf-protection (run-time checking of * indirect jumps) then Orc won't work. Make sure it's off. * - * Orc may support -fcf-protection in the future, but does not in June 2019. - * * https://gcc.gnu.org/onlinedocs/gcc/\ * Instrumentation-Options.html#index-fcf-protection * https://gitlab.freedesktop.org/gstreamer/orc/issues/17 + * + * orc 0.4.30 and later work with cf-protection. */ #ifdef __CET__ +#ifndef HAVE_ORC_CF_PROTECTION #undef HAVE_ORC #endif +#endif #ifdef HAVE_ORC #include diff --git a/libvips/iofuncs/vector.c b/libvips/iofuncs/vector.c index 1595b13d..6f624fec 100644 --- a/libvips/iofuncs/vector.c +++ b/libvips/iofuncs/vector.c @@ -44,8 +44,8 @@ */ /* -#define DEBUG */ +#define DEBUG /* Trace all orc calls, handy for debugging. #define DEBUG_TRACE @@ -54,6 +54,7 @@ #ifdef HAVE_CONFIG_H #include #endif /*HAVE_CONFIG_H*/ + #include #include @@ -83,6 +84,10 @@ vips_vector_error( VipsVector *vector ) void vips_vector_init( void ) { +#ifdef HAVE_ORC + printf( "HAVE_ORC\n" ); +#endif /*HAVE_ORC*/ + #ifdef HAVE_ORC #ifdef DEBUG_TRACE printf( "orc_init();\n" ); From 4cf82463120c46b9c5e2fb51fc75d09f6510f619 Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Thu, 7 Nov 2019 07:29:44 +0000 Subject: [PATCH 05/11] remove some dbg code --- libvips/iofuncs/vector.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/libvips/iofuncs/vector.c b/libvips/iofuncs/vector.c index 6f624fec..95b9a8aa 100644 --- a/libvips/iofuncs/vector.c +++ b/libvips/iofuncs/vector.c @@ -44,8 +44,8 @@ */ /* - */ #define DEBUG + */ /* Trace all orc calls, handy for debugging. #define DEBUG_TRACE @@ -84,10 +84,6 @@ vips_vector_error( VipsVector *vector ) void vips_vector_init( void ) { -#ifdef HAVE_ORC - printf( "HAVE_ORC\n" ); -#endif /*HAVE_ORC*/ - #ifdef HAVE_ORC #ifdef DEBUG_TRACE printf( "orc_init();\n" ); From f499cefb0e4b4673bb220638108bb634e3f3a511 Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Sat, 9 Nov 2019 20:40:39 +0000 Subject: [PATCH 06/11] add iiif layout to dzsave --- ChangeLog | 1 + libvips/foreign/dzsave.c | 133 ++++++++++++++++++++++++++++++++- libvips/include/vips/foreign.h | 2 + libvips/iofuncs/enumtypes.c | 1 + 4 files changed, 135 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5cb415a2..7061949a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -17,6 +17,7 @@ - nifti load/save uses double for all floating point metadata - add vips_error_buffer_copy() - add @no_strip option to dzsave [kalozka1] +- add iiif layout to dzsave 31/8/19 started 8.8.3 - revert sharpen restoring the input colourspace diff --git a/libvips/foreign/dzsave.c b/libvips/foreign/dzsave.c index 5a4c95d7..9f1bf5cb 100644 --- a/libvips/foreign/dzsave.c +++ b/libvips/foreign/dzsave.c @@ -83,6 +83,8 @@ * - add @skip_blanks * 21/10/19 * - add @no_strip + * 9/11/19 + * - add IIIF layout */ /* @@ -937,6 +939,86 @@ write_blank( VipsForeignSaveDz *dz ) return( 0 ); } +/* Write IIIF JSON metadata. + */ +static int +write_json( VipsForeignSaveDz *dz ) +{ + GsfOutput *out; + char buf[VIPS_PATH_MAX]; + int i; + + out = vips_gsf_path( dz->tree, "info.json", NULL ); + + gsf_output_printf( out, + "{\n" + " \"@context\": \"http://iiif.io/api/image/2/context.json\",\n" + " \"@id\": \"https://example.com/iiif/apple\",\n" + " \"profile\": [\n" + " \"http://iiif.io/api/image/2/level0.json\",\n" + " {\n" + " \"formats\": [\n" + " \"jpg\"\n" + " ],\n" + " \"qualities\": [\n" + " \"default\"\n" + " ]\n" + " }\n" + " ],\n" + " \"protocol\": \"http://iiif.io/api/image\",\n" + " \"sizes\": [\n" ); + + for( i = 0; i < dz->layer->n + 5; i++ ) { + gsf_output_printf( out, + " {\n" + " \"width\": %d,\n" + " \"height\": \"full\"\n" + " }", + 1 << (i + 4) ); + if( i != dz->layer->n - 4 ) + gsf_output_printf( out, "," ); + gsf_output_printf( out, "\n" ); + } + + gsf_output_printf( out, + " ],\n" ); + + gsf_output_printf( out, + " \"tiles\": [\n" + " {\n" + " \"scalefactors\": [\n" ); + + for( i = 0; i < dz->layer->n; i++ ) { + gsf_output_printf( out, + " %d", + 1 << i ); + if( i != dz->layer->n - 1 ) + gsf_output_printf( out, "," ); + gsf_output_printf( out, "\n" ); + } + + gsf_output_printf( out, + " ],\n" + " \"width\": %d\n" + " }\n" + " ],\n", dz->tile_size ); + + gsf_output_printf( out, + " \"width\": %d,\n" + " \"height\": %d\n", + dz->layer->image->Xsize, + dz->layer->image->Ysize ); + + gsf_output_printf( out, + "}\n" ); + + (void) gsf_output_close( out ); + g_object_unref( out ); + + return( 0 ); +} + + static int write_vips_meta( VipsForeignSaveDz *dz ) { @@ -1306,6 +1388,40 @@ tile_name( Layer *layer, int x, int y ) break; + case VIPS_FOREIGN_DZ_LAYOUT_IIIF: +{ + /* Tiles are addressed in full resolution coordinates, so + * scale up by layer->sub and dz->tile_size + */ + int left = x * dz->tile_size * layer->sub; + int top = y * dz->tile_size * layer->sub; + int width = VIPS_MIN( dz->tile_size * layer->sub, + layer->width * layer->sub - left ); + int height = VIPS_MIN( dz->tile_size * layer->sub, + layer->height * layer->sub - top ); + + /* IIIF "size" is just real tile width, I think. + * + * TODO .. .is this right? shouldn't it be the smaller of + * width and height? + */ + int size = VIPS_MIN( dz->tile_size, + layer->width - x * dz->tile_size ); + + vips_snprintf( dirname, VIPS_PATH_MAX, "%d,%d,%d,%d", + left, top, width, height ); + vips_snprintf( dirname2, VIPS_PATH_MAX, "%d,", size ); + vips_snprintf( name, VIPS_PATH_MAX, "default%s", + dz->file_suffix ); + + /* "0" is rotation and is always 0. + */ + out = vips_gsf_path( dz->tree, + name, dirname, dirname2, "0", NULL ); +} + + break; + default: g_assert_not_reached(); @@ -1814,10 +1930,11 @@ vips_foreign_save_dz_build( VipsObject *object ) VipsObjectClass *class = VIPS_OBJECT_GET_CLASS( dz ); VipsRect real_pixels; - /* Google and zoomify default to zero overlap, ".jpg". + /* Google, zoomify and iiif default to zero overlap, ".jpg". */ if( dz->layout == VIPS_FOREIGN_DZ_LAYOUT_ZOOMIFY || - dz->layout == VIPS_FOREIGN_DZ_LAYOUT_GOOGLE ) { + dz->layout == VIPS_FOREIGN_DZ_LAYOUT_GOOGLE || + dz->layout == VIPS_FOREIGN_DZ_LAYOUT_IIIF ) { if( !vips_object_argument_isset( object, "overlap" ) ) dz->overlap = 0; if( !vips_object_argument_isset( object, "suffix" ) ) @@ -1832,6 +1949,13 @@ vips_foreign_save_dz_build( VipsObject *object ) dz->tile_size = 256; } + /* Some iif writers default to 256, some to 512. We pick 512. + */ + if( dz->layout == VIPS_FOREIGN_DZ_LAYOUT_IIIF ) { + if( !vips_object_argument_isset( object, "tile_size" ) ) + dz->tile_size = 512; + } + /* skip_blanks defaults to 5 in google mode. */ if( dz->layout == VIPS_FOREIGN_DZ_LAYOUT_GOOGLE && @@ -2136,6 +2260,11 @@ vips_foreign_save_dz_build( VipsObject *object ) return( -1 ); break; + case VIPS_FOREIGN_DZ_LAYOUT_IIIF: + if( write_json( dz ) ) + return( -1 ); + break; + default: g_assert_not_reached(); } diff --git a/libvips/include/vips/foreign.h b/libvips/include/vips/foreign.h index 432394fc..32200780 100644 --- a/libvips/include/vips/foreign.h +++ b/libvips/include/vips/foreign.h @@ -588,6 +588,7 @@ int vips_niftisave( VipsImage *in, const char *filename, ... ) * @VIPS_FOREIGN_DZ_LAYOUT_DZ: use DeepZoom directory layout * @VIPS_FOREIGN_DZ_LAYOUT_ZOOMIFY: use Zoomify directory layout * @VIPS_FOREIGN_DZ_LAYOUT_GOOGLE: use Google maps directory layout + * @VIPS_FOREIGN_DZ_LAYOUT_IIIF: use IIIF directory layout * * What directory layout and metadata standard to use. */ @@ -595,6 +596,7 @@ typedef enum { VIPS_FOREIGN_DZ_LAYOUT_DZ, VIPS_FOREIGN_DZ_LAYOUT_ZOOMIFY, VIPS_FOREIGN_DZ_LAYOUT_GOOGLE, + VIPS_FOREIGN_DZ_LAYOUT_IIIF, VIPS_FOREIGN_DZ_LAYOUT_LAST } VipsForeignDzLayout; diff --git a/libvips/iofuncs/enumtypes.c b/libvips/iofuncs/enumtypes.c index a79b0bb8..c22f1ff7 100644 --- a/libvips/iofuncs/enumtypes.c +++ b/libvips/iofuncs/enumtypes.c @@ -612,6 +612,7 @@ vips_foreign_dz_layout_get_type( void ) {VIPS_FOREIGN_DZ_LAYOUT_DZ, "VIPS_FOREIGN_DZ_LAYOUT_DZ", "dz"}, {VIPS_FOREIGN_DZ_LAYOUT_ZOOMIFY, "VIPS_FOREIGN_DZ_LAYOUT_ZOOMIFY", "zoomify"}, {VIPS_FOREIGN_DZ_LAYOUT_GOOGLE, "VIPS_FOREIGN_DZ_LAYOUT_GOOGLE", "google"}, + {VIPS_FOREIGN_DZ_LAYOUT_IIIF, "VIPS_FOREIGN_DZ_LAYOUT_IIIF", "iiif"}, {VIPS_FOREIGN_DZ_LAYOUT_LAST, "VIPS_FOREIGN_DZ_LAYOUT_LAST", "last"}, {0, NULL, NULL} }; From b65a9d7328c77eb1481f53d08c8f5a4dd290cc40 Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Sun, 10 Nov 2019 10:26:13 +0000 Subject: [PATCH 07/11] oop, missing ! on tiff save resolution-unit metadata was not being checked correctly on tiff save, thanks @kayarre see https://github.com/libvips/pyvips/issues/133 --- ChangeLog | 1 + libvips/foreign/tiffsave.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 7061949a..58982a19 100644 --- a/ChangeLog +++ b/ChangeLog @@ -18,6 +18,7 @@ - add vips_error_buffer_copy() - add @no_strip option to dzsave [kalozka1] - add iiif layout to dzsave +- fix use of resolution-unit metadata on tiff save [kayarre] 31/8/19 started 8.8.3 - revert sharpen restoring the input colourspace diff --git a/libvips/foreign/tiffsave.c b/libvips/foreign/tiffsave.c index cf6ec9bc..5eeb35a2 100644 --- a/libvips/foreign/tiffsave.c +++ b/libvips/foreign/tiffsave.c @@ -159,7 +159,7 @@ vips_foreign_save_tiff_build( VipsObject *object ) /* resunit param overrides resunit metadata. */ - if( vips_object_argument_isset( object, "resunit" ) && + if( !vips_object_argument_isset( object, "resunit" ) && vips_image_get_typeof( save->ready, VIPS_META_RESOLUTION_UNIT ) && !vips_image_get_string( save->ready, From 74519a230b074650599e1ce11374d863770e9322 Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Mon, 11 Nov 2019 13:38:58 +0000 Subject: [PATCH 08/11] clean up iiif output a bit better info.json, but still not support for the full/ directory see https://github.com/libvips/libvips/issues/1465 --- libvips/foreign/dzsave.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/libvips/foreign/dzsave.c b/libvips/foreign/dzsave.c index 9f1bf5cb..ea55526e 100644 --- a/libvips/foreign/dzsave.c +++ b/libvips/foreign/dzsave.c @@ -944,6 +944,11 @@ write_blank( VipsForeignSaveDz *dz ) static int write_json( VipsForeignSaveDz *dz ) { + /* dz->file_suffix has a leading "." character. + */ + const char *suffix = dz->file_suffix[0] == '.' ? + dz->file_suffix + 1 : dz->file_suffix; + GsfOutput *out; char buf[VIPS_PATH_MAX]; int i; @@ -958,14 +963,19 @@ write_json( VipsForeignSaveDz *dz ) " \"http://iiif.io/api/image/2/level0.json\",\n" " {\n" " \"formats\": [\n" - " \"jpg\"\n" + " \"%s\"\n" " ],\n" " \"qualities\": [\n" " \"default\"\n" " ]\n" " }\n" " ],\n" - " \"protocol\": \"http://iiif.io/api/image\",\n" + " \"protocol\": \"http://iiif.io/api/image\",\n", suffix ); + + /* "sizes" is needed for the full/ set of untiled images, which we + * don't yet support. Leave this commented out for now. + + gsf_output_printf( out, " \"sizes\": [\n" ); for( i = 0; i < dz->layer->n + 5; i++ ) { @@ -983,6 +993,10 @@ write_json( VipsForeignSaveDz *dz ) gsf_output_printf( out, " ],\n" ); + */ + + /* The set of pyramid layers we have written. + */ gsf_output_printf( out, " \"tiles\": [\n" " {\n" @@ -1018,7 +1032,6 @@ write_json( VipsForeignSaveDz *dz ) return( 0 ); } - static int write_vips_meta( VipsForeignSaveDz *dz ) { From 144a9c48f95e98eaf75088048902eb287da3d461 Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Mon, 11 Nov 2019 15:05:51 +0000 Subject: [PATCH 09/11] set name in info.json --- libvips/foreign/dzsave.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/libvips/foreign/dzsave.c b/libvips/foreign/dzsave.c index ea55526e..a4fe1aff 100644 --- a/libvips/foreign/dzsave.c +++ b/libvips/foreign/dzsave.c @@ -944,13 +944,16 @@ write_blank( VipsForeignSaveDz *dz ) static int write_json( VipsForeignSaveDz *dz ) { + /* Can be NULL for memory output. + */ + const char *name = dz->basename ? dz->basename : "untitled"; + /* dz->file_suffix has a leading "." character. */ const char *suffix = dz->file_suffix[0] == '.' ? dz->file_suffix + 1 : dz->file_suffix; GsfOutput *out; - char buf[VIPS_PATH_MAX]; int i; out = vips_gsf_path( dz->tree, "info.json", NULL ); @@ -958,7 +961,7 @@ write_json( VipsForeignSaveDz *dz ) gsf_output_printf( out, "{\n" " \"@context\": \"http://iiif.io/api/image/2/context.json\",\n" - " \"@id\": \"https://example.com/iiif/apple\",\n" + " \"@id\": \"https://example.com/iiif/%s\",\n" " \"profile\": [\n" " \"http://iiif.io/api/image/2/level0.json\",\n" " {\n" @@ -970,7 +973,8 @@ write_json( VipsForeignSaveDz *dz ) " ]\n" " }\n" " ],\n" - " \"protocol\": \"http://iiif.io/api/image\",\n", suffix ); + " \"protocol\": \"http://iiif.io/api/image\",\n", + name, suffix ); /* "sizes" is needed for the full/ set of untiled images, which we * don't yet support. Leave this commented out for now. From 3ba0b285d454bee8eeeda169b111e436bea25dce Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Mon, 11 Nov 2019 15:14:04 +0000 Subject: [PATCH 10/11] switch to GDateTime --- configure.ac | 10 ++++++++++ libvips/foreign/dzsave.c | 16 +++++++++++++++- libvips/iofuncs/vips.c | 18 ++++++++++++++++-- 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index 45ca5662..aaeacfde 100644 --- a/configure.ac +++ b/configure.ac @@ -485,6 +485,16 @@ PKG_CHECK_MODULES(MONOTONIC, glib-2.0 >= 2.28, ] ) +# from 2.62 we have datetime +PKG_CHECK_MODULES(DATE_TIME_FORMAT_ISO8601, glib-2.0 >= 2.62, + [AC_DEFINE(HAVE_DATE_TIME_FORMAT_ISO8601,1, + [define if your glib has g_date_time_format_iso8601().] + ) + ], + [: + ] +) + # the old threading system PKG_CHECK_MODULES(GTHREAD, gthread-2.0) PACKAGES_USED="$PACKAGES_USED gthread-2.0" diff --git a/libvips/foreign/dzsave.c b/libvips/foreign/dzsave.c index a4fe1aff..4ca05e20 100644 --- a/libvips/foreign/dzsave.c +++ b/libvips/foreign/dzsave.c @@ -1132,14 +1132,28 @@ char * build_scan_properties( VipsImage *image ) { VipsDbuf dbuf; - GTimeVal now; char *date; int i; vips_dbuf_init( &dbuf ); +#ifdef HAVE_DATE_TIME_FORMAT_ISO8601 +{ + GDateTime *now; + + now = g_date_time_new_now_local(); + date = g_date_time_format_iso8601( now ); + g_date_time_unref( now ); +} +#else /*!HAVE_DATE_TIME_FORMAT_ISO8601*/ +{ + GTimeVal now; + g_get_current_time( &now ); date = g_time_val_to_iso8601( &now ); +} +#endif /*HAVE_DATE_TIME_FORMAT_ISO8601*/ + vips_dbuf_writef( &dbuf, "\n" ); vips_dbuf_writef( &dbuf, "\n", date ); diff --git a/libvips/iofuncs/vips.c b/libvips/iofuncs/vips.c index 5b43f101..3379755a 100644 --- a/libvips/iofuncs/vips.c +++ b/libvips/iofuncs/vips.c @@ -955,13 +955,27 @@ char * vips__xml_properties( VipsImage *image ) { VipsDbuf dbuf; - GTimeVal now; char *date; vips_dbuf_init( &dbuf ); +#ifdef HAVE_DATE_TIME_FORMAT_ISO8601 +{ + GDateTime *now; + + now = g_date_time_new_now_local(); + date = g_date_time_format_iso8601( now ); + g_date_time_unref( now ); +} +#else /*!HAVE_DATE_TIME_FORMAT_ISO8601*/ +{ + GTimeVal now; + g_get_current_time( &now ); - date = g_time_val_to_iso8601( &now ); + date = g_time_val_to_iso8601( &now ); +} +#endif /*HAVE_DATE_TIME_FORMAT_ISO8601*/ + vips_dbuf_writef( &dbuf, "\n" ); vips_dbuf_writef( &dbuf, "\n", From 10183200433ecc726ba52658edcaf725e90c3e69 Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Mon, 11 Nov 2019 16:20:18 +0000 Subject: [PATCH 11/11] fix make dist in master --- Makefile.am | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Makefile.am b/Makefile.am index 4b622241..e5f6203c 100644 --- a/Makefile.am +++ b/Makefile.am @@ -14,8 +14,7 @@ EXTRA_DIST = \ autogen.sh \ vips.pc.in \ vips-cpp.pc.in \ - libvips.supp \ - lsan.supp \ + suppressions \ depcomp \ README.md