mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-27 02:11:58 +08:00
[openslide] add port (#29335)
* [openslide] add port * v db * don't buffer fixing triplets which are unsupported * v db * Apply suggestions from code review Co-authored-by: Cheney Wang <38240633+Cheney-W@users.noreply.github.com> * v db --------- Co-authored-by: Cheney Wang <38240633+Cheney-W@users.noreply.github.com>
This commit is contained in:
parent
0d0a01598c
commit
3c9f696806
125
ports/openslide/fix-win-build.patch
Normal file
125
ports/openslide/fix-win-build.patch
Normal file
@ -0,0 +1,125 @@
|
||||
diff --git a/src/openslide-decode-tifflike.c b/src/openslide-decode-tifflike.c
|
||||
index 63e0ad5f2..8de1abb38 100644
|
||||
--- a/src/openslide-decode-tifflike.c
|
||||
+++ b/src/openslide-decode-tifflike.c
|
||||
@@ -348,7 +348,7 @@ static bool populate_item(struct _openslide_tifflike *tl,
|
||||
uint64_t count = item->count;
|
||||
int32_t value_size = get_value_size(item->type, &count);
|
||||
g_assert(value_size);
|
||||
- ssize_t len = value_size * count;
|
||||
+ size_t len = value_size * count;
|
||||
|
||||
buf = g_try_malloc(len);
|
||||
if (buf == NULL) {
|
||||
@@ -485,7 +485,7 @@ static struct tiff_directory *read_directory(FILE *f, int64_t *diroff,
|
||||
}
|
||||
|
||||
// check for overflow
|
||||
- if (count > SSIZE_MAX / value_size) {
|
||||
+ if (count > PTRDIFF_MAX / value_size) {
|
||||
g_set_error(err, OPENSLIDE_ERROR, OPENSLIDE_ERROR_FAILED,
|
||||
"Value count too large");
|
||||
goto FAIL;
|
||||
diff --git a/src/openslide-features.h b/src/openslide-features.h
|
||||
index a5328fbf4..db7593d6f 100644
|
||||
--- a/src/openslide-features.h
|
||||
+++ b/src/openslide-features.h
|
||||
@@ -22,26 +22,7 @@
|
||||
#ifndef OPENSLIDE_OPENSLIDE_FEATURES_H_
|
||||
#define OPENSLIDE_OPENSLIDE_FEATURES_H_
|
||||
|
||||
-
|
||||
-#ifndef __cplusplus
|
||||
-# ifdef _MSC_VER
|
||||
-# ifndef bool
|
||||
-# define bool unsigned char
|
||||
-# endif
|
||||
-# ifndef true
|
||||
-# define true 1
|
||||
-# endif
|
||||
-# ifndef false
|
||||
-# define false 0
|
||||
-# endif
|
||||
-# ifndef __bool_true_false_are_defined
|
||||
-# define __bool_true_false_are_defined 1
|
||||
-# endif
|
||||
-# else
|
||||
-# include <stdbool.h>
|
||||
-# endif
|
||||
-#endif
|
||||
-
|
||||
+#include <stdbool.h>
|
||||
|
||||
// for exporting from shared libraries or DLLs
|
||||
#if defined _WIN32
|
||||
diff --git a/src/openslide-private.h b/src/openslide-private.h
|
||||
index a70bcba4a..e39f288ed 100644
|
||||
--- a/src/openslide-private.h
|
||||
+++ b/src/openslide-private.h
|
||||
@@ -34,6 +34,11 @@
|
||||
|
||||
#include <cairo.h>
|
||||
|
||||
+#ifdef _MSC_VER
|
||||
+#define fseeko fseek
|
||||
+#define ftello ftell
|
||||
+#endif
|
||||
+
|
||||
/* the associated image structure */
|
||||
struct _openslide_associated_image {
|
||||
const struct _openslide_associated_image_ops *ops;
|
||||
@@ -357,8 +362,8 @@ void openslide_cancel_prefetch_hint(openslide_t *osr, int prefetch_id);
|
||||
Every @p replacement must be unique to avoid conflicting-type errors. */
|
||||
#define _OPENSLIDE_POISON(replacement) error__use_ ## replacement ## _instead
|
||||
#define fopen _OPENSLIDE_POISON(_openslide_fopen)
|
||||
-#define fseek _OPENSLIDE_POISON(fseeko)
|
||||
-#define ftell _OPENSLIDE_POISON(ftello)
|
||||
+//#define fseek _OPENSLIDE_POISON(fseeko)
|
||||
+//#define ftell _OPENSLIDE_POISON(ftello)
|
||||
#define strtod _OPENSLIDE_POISON(_openslide_parse_double)
|
||||
#define g_ascii_strtod _OPENSLIDE_POISON(_openslide_parse_double_)
|
||||
#define sqlite3_open _OPENSLIDE_POISON(_openslide_sqlite_open)
|
||||
diff --git a/test/test-common.c b/test/test-common.c
|
||||
index 8003128c9..3f369435b 100644
|
||||
--- a/test/test-common.c
|
||||
+++ b/test/test-common.c
|
||||
@@ -22,11 +22,12 @@
|
||||
#ifdef WIN32
|
||||
#define _WIN32_WINNT 0x0600
|
||||
#include <windows.h>
|
||||
+#else
|
||||
+#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
-#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <glib.h>
|
||||
|
||||
diff --git a/test/test.c b/test/test.c
|
||||
index 50f0651d3..7fb192a57 100644
|
||||
--- a/test/test.c
|
||||
+++ b/test/test.c
|
||||
@@ -32,7 +32,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdbool.h>
|
||||
#include <inttypes.h>
|
||||
-#include <sys/time.h>
|
||||
+//#include <sys/time.h>
|
||||
|
||||
#include <glib.h>
|
||||
#include <cairo.h>
|
||||
diff --git a/test/try_open.c b/test/try_open.c
|
||||
index dd3a6a2f6..ad9233eb1 100644
|
||||
--- a/test/try_open.c
|
||||
+++ b/test/try_open.c
|
||||
@@ -24,7 +24,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
-#include <unistd.h>
|
||||
+//#include <unistd.h>
|
||||
#include <glib.h>
|
||||
#include "openslide.h"
|
||||
#include "test-common.h"
|
57
ports/openslide/portfile.cmake
Normal file
57
ports/openslide/portfile.cmake
Normal file
@ -0,0 +1,57 @@
|
||||
vcpkg_check_linkage(ONLY_DYNAMIC_LIBRARY)
|
||||
if(VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW)
|
||||
set(PATCHES fix-win-build.patch)
|
||||
endif()
|
||||
|
||||
vcpkg_from_github(
|
||||
OUT_SOURCE_PATH SOURCE_PATH
|
||||
REPO openslide/openslide
|
||||
REF "v${VERSION}"
|
||||
SHA512 1b6bc4722fd6901d7c929ec332177d4892ea15700133c1a1339c6bdcace174064b5e063d3bcb2044e2ca56801c044f7b3d1c774c0b29f9005361a8336e297e4b
|
||||
HEAD_REF master
|
||||
PATCHES remove-w-flags.patch
|
||||
${PATCHES}
|
||||
)
|
||||
|
||||
set(opts "")
|
||||
if(VCPKG_TARGET_IS_WINDOWS)
|
||||
list(APPEND opts "ac_cv_search_floor=none required")
|
||||
endif()
|
||||
|
||||
if(VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW)
|
||||
#switching to clang-cl due to __attribute__((constructor)) in openslide.c
|
||||
z_vcpkg_get_cmake_vars(cmake_vars_file)
|
||||
include("${cmake_vars_file}")
|
||||
if(VCPKG_DETECTED_CMAKE_C_COMPILER_ID STREQUAL "MSVC")
|
||||
vcpkg_find_acquire_program(CLANG)
|
||||
cmake_path(GET CLANG PARENT_PATH CLANG_PARENT_PATH)
|
||||
set(CLANG_CL "${CLANG_PARENT_PATH}/clang-cl.exe")
|
||||
file(READ "${cmake_vars_file}" contents)
|
||||
string(APPEND contents "\nset(VCPKG_DETECTED_CMAKE_C_COMPILER \"${CLANG_CL}\")")
|
||||
string(APPEND contents "\nset(VCPKG_DETECTED_CMAKE_CXX_COMPILER \"${CLANG_CL}\")")
|
||||
if(VCPKG_TARGET_ARCHITECTURE STREQUAL x86)
|
||||
string(APPEND contents "\nstring(APPEND VCPKG_DETECTED_CMAKE_C_FLAGS_DEBUG \" -m32\")")
|
||||
string(APPEND contents "\nstring(APPEND VCPKG_DETECTED_CMAKE_C_FLAGS_RELEASE \" -m32\")")
|
||||
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL arm64)
|
||||
string(APPEND contents "\nstring(PREPEND VCPKG_DETECTED_CMAKE_C_FLAGS_DEBUG \"--target=arm64-pc-win32 \")")
|
||||
string(APPEND contents "\nstring(PREPEND VCPKG_DETECTED_CMAKE_C_FLAGS_RELEASE \"--target=arm64-pc-win32 \")")
|
||||
endif()
|
||||
file(WRITE "${cmake_vars_file}" "${contents}")
|
||||
endif()
|
||||
set(cmake_vars_file "${cmake_vars_file}" CACHE INTERNAL "") # Don't run z_vcpkg_get_cmake_vars twice
|
||||
endif()
|
||||
|
||||
vcpkg_configure_make(
|
||||
SOURCE_PATH "${SOURCE_PATH}"
|
||||
AUTOCONFIG
|
||||
OPTIONS ${opts}
|
||||
)
|
||||
|
||||
vcpkg_install_make()
|
||||
vcpkg_fixup_pkgconfig()
|
||||
|
||||
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
|
||||
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
|
||||
|
||||
# Handle copyright
|
||||
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE.txt")
|
35
ports/openslide/remove-w-flags.patch
Normal file
35
ports/openslide/remove-w-flags.patch
Normal file
@ -0,0 +1,35 @@
|
||||
diff --git a/Makefile.am b/Makefile.am
|
||||
index d5fba9f80..5846768f5 100644
|
||||
--- a/Makefile.am
|
||||
+++ b/Makefile.am
|
||||
@@ -60,7 +60,7 @@ endif
|
||||
.rc.lo:
|
||||
$(AM_V_GEN)$(LIBTOOL) $(AM_V_lt) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --tag=RC --mode=compile $(RC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) -i "$<" -o "$@"
|
||||
|
||||
-src_libopenslide_la_CPPFLAGS = -pedantic -D_OPENSLIDE_BUILDING_DLL \
|
||||
+src_libopenslide_la_CPPFLAGS = -D_OPENSLIDE_BUILDING_DLL \
|
||||
$(GLIB2_CFLAGS) $(CAIRO_CFLAGS) $(SQLITE3_CFLAGS) $(LIBXML2_CFLAGS) \
|
||||
$(OPENJPEG_CFLAGS) $(LIBTIFF_CFLAGS) $(LIBPNG_CFLAGS) \
|
||||
$(GDKPIXBUF_CFLAGS) $(ZLIB_CFLAGS) -DG_LOG_DOMAIN=\"Openslide\" \
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index e401ae313..d4326ad96 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -195,7 +195,7 @@ AM_CONDITIONAL([CYGWIN_CROSS_TEST], [test -n "$CYGWIN_CROSS_TEST"])
|
||||
# Only enable this on MinGW, since otherwise gcc will complain about an
|
||||
# unknown option whenever it produces any *other* warnings
|
||||
if test "$host_os" = "mingw32"; then
|
||||
- CFLAG_MS_FORMAT=-Wno-pedantic-ms-format
|
||||
+ CFLAG_MS_FORMAT=""
|
||||
else
|
||||
CFLAG_MS_FORMAT=""
|
||||
fi
|
||||
@@ -203,7 +203,7 @@ AC_SUBST([CFLAG_MS_FORMAT])
|
||||
|
||||
# The min/max glib version is actually 2.16, but glib doesn't have special
|
||||
# handling for API changes that old
|
||||
-AC_SUBST(AM_CFLAGS, ['-Wall -Wextra -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wnested-externs $(CFLAG_MS_FORMAT) $(CFLAG_VISIBILITY) -DG_DISABLE_SINGLE_INCLUDES -DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_26 -DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_MIN_REQUIRED -fno-common'])
|
||||
+AC_SUBST(AM_CFLAGS, ['$(CFLAG_MS_FORMAT) $(CFLAG_VISIBILITY) -DG_DISABLE_SINGLE_INCLUDES -DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_26 -DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_MIN_REQUIRED -fno-common'])
|
||||
|
||||
AC_SUBST(FEATURE_FLAGS)
|
||||
|
24
ports/openslide/vcpkg.json
Normal file
24
ports/openslide/vcpkg.json
Normal file
@ -0,0 +1,24 @@
|
||||
{
|
||||
"name": "openslide",
|
||||
"version": "3.4.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-or-later",
|
||||
"supports": "native & !(windows & static) & !osx",
|
||||
"dependencies": [
|
||||
"cairo",
|
||||
"gdk-pixbuf",
|
||||
"glib",
|
||||
"libjpeg-turbo",
|
||||
"libpng",
|
||||
"libxml2",
|
||||
"openjpeg",
|
||||
"sqlite3",
|
||||
"tiff",
|
||||
{
|
||||
"name": "vcpkg-tool-meson",
|
||||
"host": true
|
||||
},
|
||||
"zlib"
|
||||
]
|
||||
}
|
@ -5692,6 +5692,10 @@
|
||||
"baseline": "1.3.1",
|
||||
"port-version": 4
|
||||
},
|
||||
"openslide": {
|
||||
"baseline": "3.4.1",
|
||||
"port-version": 0
|
||||
},
|
||||
"openssl": {
|
||||
"baseline": "3.0.7",
|
||||
"port-version": 2
|
||||
|
9
versions/o-/openslide.json
Normal file
9
versions/o-/openslide.json
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"versions": [
|
||||
{
|
||||
"git-tree": "e709084d5ff53f55afd332eac4b43ed9bf79e199",
|
||||
"version": "3.4.1",
|
||||
"port-version": 0
|
||||
}
|
||||
]
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user