diff options
| author | Ethan Morgan <ethan@gweithio.com> | 2026-02-14 16:44:06 +0000 |
|---|---|---|
| committer | Ethan Morgan <ethan@gweithio.com> | 2026-02-14 16:44:06 +0000 |
| commit | 54409423f767d8b1cf30cb7d0efca6b4ca138823 (patch) | |
| tree | d915ac7828703ce4b963efdd9728a1777ba18c1e /vcpkg/ports/libzim | |
Diffstat (limited to 'vcpkg/ports/libzim')
| -rw-r--r-- | vcpkg/ports/libzim/cross-builds.diff | 25 | ||||
| -rw-r--r-- | vcpkg/ports/libzim/dllexport.diff | 16 | ||||
| -rw-r--r-- | vcpkg/ports/libzim/portfile.cmake | 37 | ||||
| -rw-r--r-- | vcpkg/ports/libzim/subdirs.diff | 20 | ||||
| -rw-r--r-- | vcpkg/ports/libzim/vcpkg.json | 25 |
5 files changed, 123 insertions, 0 deletions
diff --git a/vcpkg/ports/libzim/cross-builds.diff b/vcpkg/ports/libzim/cross-builds.diff new file mode 100644 index 0000000..0b89ea9 --- /dev/null +++ b/vcpkg/ports/libzim/cross-builds.diff @@ -0,0 +1,25 @@ +diff --git a/meson.build b/meson.build +index 71300d3..25bbf9f 100644 +--- a/meson.build ++++ b/meson.build +@@ -1,9 +1,9 @@ + project('libzim', ['c', 'cpp'], + version : '9.4.0', + license : 'GPL2', +- default_options : ['c_std=c11', 'cpp_std=c++17', 'werror=true']) ++ default_options : ['c_std=c11', 'cpp_std=c++17']) + +-if build_machine.system() != 'windows' ++if host_machine.system() != 'windows' or meson.get_compiler('cpp').get_id() == 'gcc' + add_project_arguments('-D_LARGEFILE64_SOURCE=1', '-D_FILE_OFFSET_BITS=64', language: 'cpp') + endif + +@@ -69,7 +69,7 @@ else + endif + + compiler = meson.get_compiler('cpp') +-if (compiler.get_id() == 'gcc' and build_machine.system() == 'linux') or host_machine.system() == 'freebsd' ++if (compiler.get_id() == 'gcc' and host_machine.system() == 'linux') or host_machine.system() == 'freebsd' + # C++ std::thread is implemented using pthread on linux by gcc + thread_dep = dependency('threads') + else diff --git a/vcpkg/ports/libzim/dllexport.diff b/vcpkg/ports/libzim/dllexport.diff new file mode 100644 index 0000000..212eb9e --- /dev/null +++ b/vcpkg/ports/libzim/dllexport.diff @@ -0,0 +1,16 @@ +diff --git a/include/zim/zim.h b/include/zim/zim.h +index 80e8596..631cfab 100644 +--- a/include/zim/zim.h ++++ b/include/zim/zim.h +@@ -35,8 +35,10 @@ + + #include <zim/zim_config.h> + +-#if defined(_MSC_VER) && defined(LIBZIM_EXPORT_DLL) ++#if defined(_WIN32) && defined(LIBZIM_EXPORT_DLL) + #define LIBZIM_API __declspec(dllexport) ++#elif defined(_WIN32) && defined(LIBZIM_IMPORT_DLL) ++ #define LIBZIM_API __declspec(dllimport) + #else + #define LIBZIM_API + #endif diff --git a/vcpkg/ports/libzim/portfile.cmake b/vcpkg/ports/libzim/portfile.cmake new file mode 100644 index 0000000..b7447dd --- /dev/null +++ b/vcpkg/ports/libzim/portfile.cmake @@ -0,0 +1,37 @@ +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO openzim/libzim + REF "${VERSION}" + SHA512 de1588addec8b2398912a99cc5b46c1fa156d1ce01d2db1544b40c966bf305d859a52b51b8532d74cdba3c4e3392a3f4be68f4e8ac93392c56c3a24fa6b135c8 + HEAD_REF main + PATCHES + cross-builds.diff + dllexport.diff + subdirs.diff +) + +set(EXTRA_OPTIONS "") + +if(NOT "xapian" IN_LIST FEATURES) + list(APPEND EXTRA_OPTIONS "-Dwith_xapian=false") +endif() + +vcpkg_configure_meson( + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS + -Dexamples=false + ${EXTRA_OPTIONS} +) + +vcpkg_install_meson() + +vcpkg_copy_pdbs() + +vcpkg_fixup_pkgconfig() + +if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic") + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/zim/zim.h" "defined(LIBZIM_IMPORT_DLL)" "1") +endif() + +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share") +vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/COPYING") diff --git a/vcpkg/ports/libzim/subdirs.diff b/vcpkg/ports/libzim/subdirs.diff new file mode 100644 index 0000000..a30a144 --- /dev/null +++ b/vcpkg/ports/libzim/subdirs.diff @@ -0,0 +1,20 @@ +diff --git a/meson.build b/meson.build +index d946c49..eded01d 100644 +--- a/meson.build ++++ b/meson.build +@@ -90,6 +90,7 @@ subdir('include') + subdir('scripts') + subdir('static') + subdir('src') ++if false + if get_option('examples') + subdir('examples') + endif +@@ -97,6 +98,7 @@ subdir('test') + if get_option('doc') + subdir('docs') + endif ++endif + + pkg_mod = import('pkgconfig') + pkg_mod.generate(libraries : libzim, diff --git a/vcpkg/ports/libzim/vcpkg.json b/vcpkg/ports/libzim/vcpkg.json new file mode 100644 index 0000000..2fbdbab --- /dev/null +++ b/vcpkg/ports/libzim/vcpkg.json @@ -0,0 +1,25 @@ +{ + "name": "libzim", + "version": "9.4.0", + "description": "The Libzim is the reference implementation for the ZIM file format. It's a software library to read and write ZIM files on many systems and architectures. More information about the ZIM format and the openZIM project at https://openzim.org/.", + "homepage": "https://github.com/openzim/libzim", + "license": "GPL-2.0-or-later", + "supports": "!android & !uwp & !xbox", + "dependencies": [ + "icu", + "liblzma", + { + "name": "vcpkg-tool-meson", + "host": true + }, + "zstd" + ], + "features": { + "xapian": { + "description": "Enable xapian support", + "dependencies": [ + "xapian" + ] + } + } +} |