Skip to content

Commit

Permalink
[libzim]add package (#30758)
Browse files Browse the repository at this point in the history
* libzim: add package

update libzim versions

libzim:meson ignore xapian

* Update ports/libzim/vcpkg.json

Co-authored-by: Mengna Li <95600143+Adela0814@users.noreply.github.com>

* Update ports/libzim/portfile.cmake

Co-authored-by: Mengna Li <95600143+Adela0814@users.noreply.github.com>

* support both static and dynamic library

* modify according to review

Update ports/libzim/portfile.cmake

Co-authored-by: Mengna Li <95600143+Adela0814@users.noreply.github.com>

add version

* only enable release library

* make xapian does not support on windows

* disable android platform

---------

Co-authored-by: Mengna Li <95600143+Adela0814@users.noreply.github.com>
  • Loading branch information
xiaoyifang and Adela0814 committed May 9, 2023
1 parent 8e591a9 commit e7250fe
Show file tree
Hide file tree
Showing 5 changed files with 102 additions and 0 deletions.
26 changes: 26 additions & 0 deletions ports/libzim/0001-build-share-library.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
diff --git a/meson.build b/meson.build
index 6862f75..d887f9a 100644
--- a/meson.build
+++ b/meson.build
@@ -37,8 +37,6 @@ static_linkage = static_linkage or get_option('default_library')=='static'
lzma_dep = dependency('liblzma', static:static_linkage)
if static_linkage
add_project_arguments('-DLZMA_API_STATIC', language: 'cpp')
-else
- private_conf.set('LIBZIM_EXPORT_DLL', true)
endif

zstd_dep = dependency('libzstd', static:static_linkage)
@@ -59,6 +57,9 @@ pkg_requires = ['liblzma', 'libzstd']
if build_machine.system() == 'windows'
extra_link_args = ['-lRpcrt4', '-lWs2_32', '-lwinmm', '-licuuc', '-licuin']
extra_cpp_args = ['-DSORTPP_PASS']
+ if not static_linkage
+ extra_cpp_args += ['-DLIBZIM_EXPORT_DLL']
+ endif
else
extra_link_args = []
extra_cpp_args = []
--
2.37.3.windows.1

37 changes: 37 additions & 0 deletions ports/libzim/portfile.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO openzim/libzim
REF ${VERSION}
SHA512 4554a9237f5167f6f94aad76ef0e847e949c47c6ee2a89bbd6e587da3b3a3e2d0a8b2d03f7a0fbde0e0dc96fb61bf8c115b3ef3cbd7eff5e880f152bee9b29f0
HEAD_REF main
PATCHES
0001-build-share-library.patch
)

set(EXTRA_OPTIONS "")

if(NOT "xapian" IN_LIST FEATURES)
list(APPEND EXTRA_OPTIONS "-Dwith_xapian=false")
endif()

if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
list(APPEND EXTRA_OPTIONS "-Dstatic-linkage=false")
else()
list(APPEND EXTRA_OPTIONS "-Dstatic-linkage=true")
endif()

vcpkg_configure_meson(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
-Dexamples=false
${EXTRA_OPTIONS}
)

vcpkg_install_meson(ADD_BIN_TO_PATH)

vcpkg_copy_pdbs()

vcpkg_fixup_pkgconfig()

file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/COPYING")
26 changes: 26 additions & 0 deletions ports/libzim/vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"name": "libzim",
"version": "8.2.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",
"dependencies": [
"icu",
"liblzma",
{
"name": "vcpkg-tool-meson",
"host": true
},
"zstd"
],
"features": {
"xapian": {
"description": "Enable xapian support",
"supports": "!(windows & !mingw)",
"dependencies": [
"xapian"
]
}
}
}
4 changes: 4 additions & 0 deletions versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -4836,6 +4836,10 @@
"baseline": "0.4.41",
"port-version": 0
},
"libzim": {
"baseline": "8.2.0",
"port-version": 0
},
"libzip": {
"baseline": "1.9.2",
"port-version": 1
Expand Down
9 changes: 9 additions & 0 deletions versions/l-/libzim.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"versions": [
{
"git-tree": "93b2790850e120148daf03563e24e6ed3ee9e02e",
"version": "8.2.0",
"port-version": 0
}
]
}

0 comments on commit e7250fe

Please sign in to comment.