diff --git a/ports/openslide/cross-build.diff b/ports/openslide/cross-build.diff index 7adf018de3..3b9d14b7a2 100644 --- a/ports/openslide/cross-build.diff +++ b/ports/openslide/cross-build.diff @@ -1,18 +1,17 @@ diff --git a/meson.build b/meson.build -index 0b4d7d4..de8773c 100644 +index 1a0f194155a7..fa121a9fec2c 100644 --- a/meson.build +++ b/meson.build -@@ -45,7 +45,7 @@ versions = { - - # Compiler flags +@@ -49,7 +49,6 @@ versions = { cc = meson.get_compiler('c') --cc_native = meson.get_compiler('c', native : true) -+cc_native = meson.get_compiler('c') - add_project_arguments( - cc.get_supported_arguments( - '-Wstrict-prototypes', + cc_native = meson.get_compiler( + 'c', +- native : true, + ) + if host_machine.system() == 'darwin' and not cc.has_header('stdio.h') + # Certain compiler checks fail with -arch x86_64 -arch arm64, which could diff --git a/src/meson.build b/src/meson.build -index e886eea..97309e5 100644 +index 889fbb9224cc..5b76fbb13bdd 100644 --- a/src/meson.build +++ b/src/meson.build @@ -1,3 +1,6 @@ @@ -21,8 +20,8 @@ index e886eea..97309e5 100644 +else # generate openslide-tables.c make_tables = executable( - 'make-tables', 'make-tables.c', -@@ -9,6 +12,7 @@ openslide_tables_c = custom_target( + 'make-tables', +@@ -10,6 +13,7 @@ openslide_tables_c = custom_target( output : 'openslide-tables.c', command : [make_tables, '@OUTPUT@'], ) diff --git a/ports/openslide/fix-win-build.patch b/ports/openslide/fix-win-build.patch deleted file mode 100644 index 3fc1ed84de..0000000000 --- a/ports/openslide/fix-win-build.patch +++ /dev/null @@ -1,248 +0,0 @@ -diff --git a/common/openslide-common-fd.c b/common/openslide-common-fd.c -index 3d3ce955f3c1..20127ce4bdd9 100644 ---- a/common/openslide-common-fd.c -+++ b/common/openslide-common-fd.c -@@ -27,10 +27,13 @@ - - #include - #include --#include - #include - #include - -+#ifndef _WIN32 -+#include -+#endif -+ - #ifdef __APPLE__ - #include // MAXPATHLEN - #include -diff --git a/meson.build b/meson.build -index 0b4d7d47b695..ac106fb1001f 100644 ---- a/meson.build -+++ b/meson.build -@@ -59,6 +59,17 @@ add_project_arguments( - '-DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_MIN_REQUIRED', - language : 'c' - ) -+if host_machine.system() == 'windows' -+ # Windows likes to warn about C and POSIX functions -+ foreach native : [false, true] -+ add_project_arguments( -+ '-D_CRT_NONSTDC_NO_DEPRECATE', -+ '-D_CRT_SECURE_NO_WARNINGS', -+ language : 'c', -+ native : native, -+ ) -+ endforeach -+endif - add_project_link_arguments( - cc.get_supported_link_arguments( - '-Wl,--no-undefined', -@@ -66,6 +77,13 @@ add_project_link_arguments( - language : 'c' - ) - -+# Functions -+foreach f : ['fseeko', 'ftello'] -+ if cc.has_function(f) -+ conf.set('HAVE_' + f.to_upper(), 1) -+ endif -+endforeach -+ - # fopen cloexec flag - if host_machine.system() in ['dragonfly', 'freebsd', 'linux', 'netbsd', 'openbsd'] - message('Using "e" flag for close-on-exec') -diff --git a/src/meson.build b/src/meson.build -index e886eea4b5c4..4be22f64aef7 100644 ---- a/src/meson.build -+++ b/src/meson.build -@@ -24,6 +24,8 @@ openslide_dll_rc = configure_file( - if host_machine.system() == 'windows' - openslide_dll_o = import('windows').compile_resources( - openslide_dll_rc, -+ # https://github.com/llvm/llvm-project/issues/63426 -+ args : [cc.get_argument_syntax() == 'msvc' ? '/c' : '-c', '65001'], - depend_files : [openslide_dll_manifest], - ) - else -diff --git a/src/openslide-decode-dicom.c b/src/openslide-decode-dicom.c -index 24dcfbfe4568..d5fa053e94ef 100644 ---- a/src/openslide-decode-dicom.c -+++ b/src/openslide-decode-dicom.c -@@ -88,7 +88,7 @@ static int64_t vfs_seek(DcmError **dcm_error, DcmIO *io, - - // libdicom uses lseek(2) semantics, so it must always return the new file - // pointer -- off_t new_position = _openslide_ftell(dio->file, &err); -+ int64_t new_position = _openslide_ftell(dio->file, &err); - if (new_position < 0) { - propagate_gerror(dcm_error, err); - } -diff --git a/src/openslide-decode-tifflike.c b/src/openslide-decode-tifflike.c -index 626cd4039110..3ca3e374f208 100644 ---- a/src/openslide-decode-tifflike.c -+++ b/src/openslide-decode-tifflike.c -@@ -470,8 +470,9 @@ static struct tiff_directory *read_directory(struct _openslide_file *f, - return NULL; - } - -- // check for overflow -- if (count > SSIZE_MAX / value_size) { -+ // compute total size -+ size_t value_len; -+ if (!g_size_checked_mul(&value_len, value_size, count)) { - g_set_error(err, OPENSLIDE_ERROR, OPENSLIDE_ERROR_FAILED, - "Value count too large"); - return NULL; -@@ -486,7 +487,7 @@ static struct tiff_directory *read_directory(struct _openslide_file *f, - } - - // does value/offset contain the value? -- if (value_size * count <= sizeof(value)) { -+ if (value_len <= sizeof(value)) { - // yes - fix_byte_order(value, value_size, count, big_endian); - if (!set_item_values(item, value, err)) { -diff --git a/src/openslide-dll.rc.in b/src/openslide-dll.rc.in -index 0670ee539e02..47e4d729e2bd 100644 ---- a/src/openslide-dll.rc.in -+++ b/src/openslide-dll.rc.in -@@ -10,16 +10,16 @@ FILETYPE VFT_DLL - BEGIN - BLOCK "StringFileInfo" - BEGIN -- BLOCK "040904e4" -+ BLOCK "040904b0" - BEGIN - VALUE "FileDescription", "OpenSlide library" - VALUE "FileVersion", "@SUFFIXED_VERSION@" - VALUE "InternalName", "OpenSlide" -- VALUE "LegalCopyright", "Copyright \251 2007-2023 Carnegie Mellon University and others. OpenSlide is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License, version 2.1." -+ VALUE "LegalCopyright", "Copyright © 2007-2023 Carnegie Mellon University and others. OpenSlide is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License, version 2.1." - END - END - BLOCK "VarFileInfo" - BEGIN -- VALUE "Translation", 0x0409, 0x04e4 -+ VALUE "Translation", 0x0409, 0x04b0 - END - END -diff --git a/src/openslide-file.c b/src/openslide-file.c -index 2763f38071dc..11b568913cfe 100644 ---- a/src/openslide-file.c -+++ b/src/openslide-file.c -@@ -36,6 +36,13 @@ - #include - #endif - -+#if !defined(HAVE_FSEEKO) && defined(_WIN32) -+#define fseeko _fseeki64 -+#endif -+#if !defined(HAVE_FTELLO) && defined(_WIN32) -+#define ftello _ftelli64 -+#endif -+ - struct _openslide_file { - FILE *fp; - }; -@@ -141,7 +148,7 @@ size_t _openslide_fread(struct _openslide_file *file, void *buf, size_t size) { - return total; - } - --bool _openslide_fseek(struct _openslide_file *file, off_t offset, int whence, -+bool _openslide_fseek(struct _openslide_file *file, int64_t offset, int whence, - GError **err) { - if (fseeko(file->fp, offset, whence)) { - g_set_error(err, G_FILE_ERROR, g_file_error_from_errno(errno), -@@ -151,8 +158,8 @@ bool _openslide_fseek(struct _openslide_file *file, off_t offset, int whence, - return true; - } - --off_t _openslide_ftell(struct _openslide_file *file, GError **err) { -- off_t ret = ftello(file->fp); -+int64_t _openslide_ftell(struct _openslide_file *file, GError **err) { -+ int64_t ret = ftello(file->fp); - if (ret == -1) { - g_set_error(err, G_FILE_ERROR, g_file_error_from_errno(errno), - "%s", g_strerror(errno)); -@@ -160,15 +167,15 @@ off_t _openslide_ftell(struct _openslide_file *file, GError **err) { - return ret; - } - --off_t _openslide_fsize(struct _openslide_file *file, GError **err) { -- off_t orig = _openslide_ftell(file, err); -+int64_t _openslide_fsize(struct _openslide_file *file, GError **err) { -+ int64_t orig = _openslide_ftell(file, err); - if (orig == -1) { - return -1; - } - if (!_openslide_fseek(file, 0, SEEK_END, err)) { - return -1; - } -- off_t ret = _openslide_ftell(file, err); -+ int64_t ret = _openslide_ftell(file, err); - if (ret == -1) { - return -1; - } -diff --git a/src/openslide-private.h b/src/openslide-private.h -index 5ae36939b048..eb670427f6e4 100644 ---- a/src/openslide-private.h -+++ b/src/openslide-private.h -@@ -186,10 +186,10 @@ struct _openslide_file; - - struct _openslide_file *_openslide_fopen(const char *path, GError **err); - size_t _openslide_fread(struct _openslide_file *file, void *buf, size_t size); --bool _openslide_fseek(struct _openslide_file *file, off_t offset, int whence, -+bool _openslide_fseek(struct _openslide_file *file, int64_t offset, int whence, - GError **err); --off_t _openslide_ftell(struct _openslide_file *file, GError **err); --off_t _openslide_fsize(struct _openslide_file *file, GError **err); -+int64_t _openslide_ftell(struct _openslide_file *file, GError **err); -+int64_t _openslide_fsize(struct _openslide_file *file, GError **err); - void _openslide_fclose(struct _openslide_file *file); - bool _openslide_fexists(const char *path, GError **err); - -diff --git a/src/openslide-vendor-synthetic.c b/src/openslide-vendor-synthetic.c -index e3a44056900a..2966803ae6e8 100644 ---- a/src/openslide-vendor-synthetic.c -+++ b/src/openslide-vendor-synthetic.c -@@ -156,13 +156,13 @@ static bool decode_png(const void *data, uint32_t len, - - struct mem_tiff { - const uint8_t *data; -- ssize_t offset; -- ssize_t size; -+ int64_t offset; -+ int64_t size; - }; - - static tsize_t mem_tiff_read(thandle_t th, tdata_t buf, tsize_t size) { - struct mem_tiff *mem = th; -- ssize_t count = MIN(mem->size - mem->offset, size); -+ int64_t count = MIN(mem->size - mem->offset, size); - memcpy(buf, mem->data + mem->offset, count); - mem->offset += count; - return count; -diff --git a/tools/slidetool-util.c b/tools/slidetool-util.c -index 28901eda611c..7a0de731245f 100644 ---- a/tools/slidetool-util.c -+++ b/tools/slidetool-util.c -@@ -20,11 +20,16 @@ - */ - - #include --#include - #include - #include "openslide-common.h" - #include "slidetool.h" - -+#ifdef _WIN32 -+#include -+#else -+#include -+#endif -+ - struct output open_output(const char *filename) { - struct output out; - if (filename) { diff --git a/ports/openslide/portfile.cmake b/ports/openslide/portfile.cmake index 56ba5e0231..4373aff03f 100644 --- a/ports/openslide/portfile.cmake +++ b/ports/openslide/portfile.cmake @@ -2,13 +2,11 @@ vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO openslide/openslide REF "v${VERSION}" - SHA512 98822994dd437f5a7d40e0a769fc9c63eda46823ede0547f530390b78b256631a50f66ac0d63d32a8875fc38283f96bc2f624f1023fe98772e9a89a8d6afb514 + SHA512 52e6fc203d5ba81f332925aace61b29caacb430f9a09455392dfddd084d91994e85326c469e94769050695b47781c6aeaf06136bf8124cef5f9b92d60f5d8509 HEAD_REF main PATCHES cross-build.diff - fix-win-build.patch - slidetool-unicode.patch - windows-dll-name.patch + slidetool-test-deps.diff ) if(VCPKG_CROSSCOMPILING) file(COPY diff --git a/ports/openslide/slidetool-test-deps.diff b/ports/openslide/slidetool-test-deps.diff new file mode 100644 index 0000000000..ae4560949f --- /dev/null +++ b/ports/openslide/slidetool-test-deps.diff @@ -0,0 +1,33 @@ +commit 65777538e6f853b43caa5f998dc19fde033eaa46 +Author: Benjamin Gilbert +Date: Mon Jun 8 14:29:57 2026 -0500 + + tools: fix `slidetool test deps` on Windows + + Have g_spawn_sync() leave our file descriptors alone. This is harmless + for us and lets g_spawn_sync() avoid invoking gspawn-win64-helper.exe, + which openslide-bin doesn't ship. + + Fixes error: + + slidetool.exe: Spawning child failed: Failed to execute helper program (No such file or directory) + + Signed-off-by: Benjamin Gilbert + +diff --git a/tools/slidetool-test.c b/tools/slidetool-test.c +index eb588b8a25e3..48d7f8b83615 100644 +--- a/tools/slidetool-test.c ++++ b/tools/slidetool-test.c +@@ -38,7 +38,11 @@ static int do_test_deps(int narg, char **args) { + g_environ_setenv(child_env, "OPENSLIDE_DEBUG", "synthetic", true); + GError *tmp_err = NULL; + int status; +- if (!g_spawn_sync(NULL, child_argv, child_env, G_SPAWN_SEARCH_PATH, ++ if (!g_spawn_sync(NULL, child_argv, child_env, ++ G_SPAWN_SEARCH_PATH | ++ // avoid requiring gspawn-win64-helper.exe on Windows ++ G_SPAWN_LEAVE_DESCRIPTORS_OPEN | ++ G_SPAWN_CHILD_INHERITS_STDIN, + NULL, NULL, NULL, NULL, &status, &tmp_err)) { + common_fail("Spawning child failed: %s", tmp_err->message); + } diff --git a/ports/openslide/slidetool-unicode.patch b/ports/openslide/slidetool-unicode.patch deleted file mode 100644 index 07f50c745d..0000000000 --- a/ports/openslide/slidetool-unicode.patch +++ /dev/null @@ -1,33 +0,0 @@ -commit 93c479edf1b12accd3291ad7cddd064f85c3a522 -Author: Benjamin Gilbert -Date: Fri Jul 4 06:58:21 2025 -0700 - - tools: open output files using Unicode paths on Windows - - We receive filename arguments in Unicode. Don't open them in the ANSI - code page, mangling the filenames. - - Signed-off-by: Benjamin Gilbert - -diff --git a/tools/slidetool-util.c b/tools/slidetool-util.c -index 7a0de731245f..041df9c29163 100644 ---- a/tools/slidetool-util.c -+++ b/tools/slidetool-util.c -@@ -33,7 +33,17 @@ - struct output open_output(const char *filename) { - struct output out; - if (filename) { -+#ifdef _WIN32 -+ GError *tmp_err = NULL; -+ g_autofree wchar_t *filename16 = -+ (wchar_t *) g_utf8_to_utf16(filename, -1, NULL, NULL, &tmp_err); -+ if (filename16 == NULL) { -+ common_fail("Couldn't open %s: %s", filename, tmp_err->message); -+ } -+ FILE *fp = _wfopen(filename16, L"wb"); -+#else - FILE *fp = fopen(filename, "wb"); -+#endif - if (!fp) { - common_fail("Can't open %s for writing: %s", filename, strerror(errno)); - } diff --git a/ports/openslide/vcpkg.json b/ports/openslide/vcpkg.json index 6257b3586b..a3e4e4e3f4 100644 --- a/ports/openslide/vcpkg.json +++ b/ports/openslide/vcpkg.json @@ -1,7 +1,6 @@ { "name": "openslide", - "version": "4.0.0", - "port-version": 4, + "version": "4.0.1", "description": "OpenSlide is a C library for reading whole slide image files (also known as virtual slides). It provides a consistent and simple API for reading files from multiple vendors.", "homepage": "https://openslide.org/", "license": "LGPL-2.1-only", @@ -11,13 +10,6 @@ "name": "cairo", "default-features": false }, - { - "name": "gdk-pixbuf", - "default-features": false, - "features": [ - "others" - ] - }, "glib", "libdicom", "libjpeg-turbo", @@ -46,6 +38,7 @@ "name": "vcpkg-tool-meson", "host": true }, - "zlib" + "zlib", + "zstd" ] } diff --git a/ports/openslide/windows-dll-name.patch b/ports/openslide/windows-dll-name.patch deleted file mode 100644 index ea863a6eaa..0000000000 --- a/ports/openslide/windows-dll-name.patch +++ /dev/null @@ -1,27 +0,0 @@ -commit 6d80b9db41810eb316d81cd2149265b89f5dc35f -Author: Benjamin Gilbert -Date: Mon Aug 4 21:32:06 2025 -0600 - - meson: use `lib` library prefix when building on Windows - - Meson defaults to omitting the `lib` library prefix on Windows except when - building with MinGW, producing openslide-1.dll. OpenSlide Java, OpenSlide - Python, and other bindings assume the library is libopenslide-1.dll, since - that's what openslide-bin ships. Ensure we use that name. - - Signed-off-by: Benjamin Gilbert - -diff --git a/src/meson.build b/src/meson.build -index 676e5feb3f56..821fc3b938fc 100644 ---- a/src/meson.build -+++ b/src/meson.build -@@ -81,6 +81,9 @@ libopenslide = library( - openslide_sources, - version : soversion, - c_args : ['-D_OPENSLIDE_BUILDING_DLL', '-DG_LOG_DOMAIN="OpenSlide"'], -+ # Meson omits 'lib' by default on Windows except on MinGW. Maintain -+ # compatibility with the MinGW build, since it was here first. -+ name_prefix : host_machine.system() == 'windows' ? 'lib' : [], - gnu_symbol_visibility : visibility, - include_directories : config_h_include, - dependencies : [ diff --git a/versions/baseline.json b/versions/baseline.json index 4ef6c8add0..b51c33acee 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -7445,8 +7445,8 @@ "port-version": 0 }, "openslide": { - "baseline": "4.0.0", - "port-version": 4 + "baseline": "4.0.1", + "port-version": 0 }, "openssl": { "baseline": "3.6.2", diff --git a/versions/o-/openslide.json b/versions/o-/openslide.json index e26f97f8ec..86a2bdf3d0 100644 --- a/versions/o-/openslide.json +++ b/versions/o-/openslide.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "891f00acd32ba0bbc0c2e1d3ffb353bd1bb270a5", + "version": "4.0.1", + "port-version": 0 + }, { "git-tree": "b567364c9a7a35be645762c75647b9a27509429d", "version": "4.0.0",