[baseline][libzim][xapian] Disable gtest, fix mingw and windows builds (#31383)

* [libzim] WIP

* Control gtest

* More fixes, test xapian

* [xapian] Fix windows and mingw

* dllexport

* Finish PR

* CI baseline

* [xapian] Update supports

* Fix arm64
This commit is contained in:
Kai Pastor 2023-05-13 18:45:03 +02:00 коммит произвёл GitHub
Родитель 49381cbd45
Коммит 3880056be4
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
14 изменённых файлов: 178 добавлений и 56 удалений

Просмотреть файл

@ -1,26 +0,0 @@
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

Просмотреть файл

@ -0,0 +1,42 @@
diff --git a/meson.build b/meson.build
index 85d8da7..7f97dbc 100644
--- a/meson.build
+++ b/meson.build
@@ -3,7 +3,7 @@ project('libzim', ['c', 'cpp'],
license : 'GPL2',
default_options : ['c_std=c11', 'cpp_std=c++11'])
-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
@@ -56,8 +56,8 @@ private_conf.set('ENABLE_XAPIAN', xapian_dep.found())
public_conf.set('LIBZIM_WITH_XAPIAN', xapian_dep.found())
pkg_requires = ['liblzma', 'libzstd']
-if build_machine.system() == 'windows'
- extra_link_args = ['-lRpcrt4', '-lWs2_32', '-lwinmm', '-licuuc', '-licuin']
+if host_machine.system() == 'windows'
+ extra_link_args = ['-lrpcrt4', '-lws2_32', '-lwinmm']
extra_cpp_args = ['-DSORTPP_PASS']
else
extra_link_args = []
@@ -65,7 +65,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
@@ -74,6 +74,8 @@ endif
if xapian_dep.found()
pkg_requires += ['xapian-core']
+endif
+if true
icu_dep = dependency('icu-i18n', static:static_linkage)
pkg_requires += ['icu-i18n']
else

Просмотреть файл

@ -0,0 +1,13 @@
diff --git a/meson.build b/meson.build
index d887f9a..270413d 100644
--- a/meson.build
+++ b/meson.build
@@ -81,7 +81,7 @@ else
icu_dep = dependency('icu-i18n', required:false, static:static_linkage)
endif
-gtest_dep = dependency('gtest', main:true, fallback:['gtest', 'gtest_main_dep'], required:false)
+gtest_dep = dependency('', required:false)
inc = include_directories('include')

Просмотреть файл

@ -0,0 +1,52 @@
diff --git a/include/zim/zim.h b/include/zim/zim.h
index 5d1af80..6171f56 100644
--- a/include/zim/zim.h
+++ b/include/zim/zim.h
@@ -33,14 +33,16 @@
#define DEPRECATED
#endif
-#if (defined _WIN32 || defined __CYGWIN__) && defined LIBZIM_EXPORT_DLL
+#include <zim/zim_config.h>
+
+#if defined(LIBZIM_DLL) && defined(LIBZIM_BUILDING_LIBRARY)
#define LIBZIM_API __declspec(dllexport)
+#elif defined(LIBZIM_DLL)
+ #define LIBZIM_API __declspec(dllimport)
#else
#define LIBZIM_API
#endif
-#include <zim/zim_config.h>
-
namespace zim
{
// An index of an entry (in a zim file)
diff --git a/meson.build b/meson.build
index 7f97dbc..8fd13d7 100644
--- a/meson.build
+++ b/meson.build
@@ -14,6 +14,10 @@ sizeof_size_t = cpp.sizeof('size_t')
private_conf = configuration_data()
public_conf = configuration_data()
+if host_machine.system() == 'windows' and get_option('default_library') == 'shared'
+ public_conf.set('LIBZIM_DLL', true)
+endif
+
private_conf.set('VERSION', '"@0@"'.format(meson.project_version()))
public_conf.set('LIBZIM_VERSION', '"@0@"'.format(meson.project_version()))
private_conf.set('DIRENT_CACHE_SIZE', get_option('DIRENT_CACHE_SIZE'))
diff --git a/src/meson.build b/src/meson.build
index 4529b7c..956b145 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -75,7 +75,7 @@ libzim = library('zim',
include_directories : inc,
dependencies : deps,
link_args : extra_link_args,
- cpp_args : extra_cpp_args,
+ cpp_args : extra_cpp_args + '-DLIBZIM_BUILDING_LIBRARY',
version: meson.project_version(),
install : true)
libzim_dep = declare_dependency(link_with: libzim,

Просмотреть файл

@ -1,11 +1,13 @@
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO openzim/libzim
REF ${VERSION}
REF "${VERSION}"
SHA512 4554a9237f5167f6f94aad76ef0e847e949c47c6ee2a89bbd6e587da3b3a3e2d0a8b2d03f7a0fbde0e0dc96fb61bf8c115b3ef3cbd7eff5e880f152bee9b29f0
HEAD_REF main
PATCHES
0001-build-share-library.patch
cross-builds.diff
dllexport.diff
disable-gtest.diff
)
set(EXTRA_OPTIONS "")
@ -14,12 +16,6 @@ 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
@ -27,7 +23,7 @@ vcpkg_configure_meson(
${EXTRA_OPTIONS}
)
vcpkg_install_meson(ADD_BIN_TO_PATH)
vcpkg_install_meson()
vcpkg_copy_pdbs()

Просмотреть файл

@ -1,6 +1,7 @@
{
"name": "libzim",
"version": "8.2.0",
"port-version": 1,
"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",
@ -17,7 +18,6 @@
"features": {
"xapian": {
"description": "Enable xapian support",
"supports": "!(windows & !mingw)",
"dependencies": [
"xapian"
]

Просмотреть файл

@ -0,0 +1,23 @@
diff --git a/configure.ac b/configure.ac
index ca5b7b2..b059402 100644
--- a/configure.ac
+++ b/configure.ac
@@ -870,6 +870,7 @@ case $enable_backend_chert$enable_backend_glass in
dnl
dnl Similarly for uuid support.
+ if false; then
dnl Check for zlib.h.
AC_CHECK_HEADERS([zlib.h], [], [
AC_MSG_ERROR([zlib.h not found - required for chert and glass (you may need to install the zlib1g-dev or zlib-devel package)])
@@ -879,6 +880,10 @@ case $enable_backend_chert$enable_backend_glass in
AC_SEARCH_LIBS([zlibVersion], [z zlib zdll], [], [
AC_MSG_ERROR([zlibVersion() not found in -lz, -lzlib, or -lzdll - required for chert and glass (you may need to install the zlib1g-dev or zlib-devel package)])
])
+ fi
+ PKG_CHECK_MODULES([ZLIB], [zlib], [],[AC_MSG_ERROR([zlib library not found])])
+ CFLAGS="$LIBS $ZLIB_CFLAGS"
+ LIBS="$ZLIB_LIBS $LIBS"
dnl Find a way to generate UUIDs.

Просмотреть файл

@ -0,0 +1,13 @@
diff --git a/include/xapian/version_h.cc b/include/xapian/version_h.cc
index b36ae4d..c61e31a 100644
--- a/include/xapian/version_h.cc
+++ b/include/xapian/version_h.cc
@@ -75,7 +75,7 @@ const char * dummy[] = {
"#endif",
"#endif",
"",
-#elif defined _MSC_VER
+#elif 0
// When building the library with MSVC, generate preprocessor code to check
// that the same setting of _DEBUG is used for building applications as was
// used for building the library.

Просмотреть файл

@ -1,30 +1,31 @@
vcpkg_download_distfile(ARCHIVE
URLS https://oligarchy.co.uk/xapian/1.4.22/xapian-core-1.4.22.tar.xz
FILENAME xapian-core-1.4.22.tar.xz
URLS "https://oligarchy.co.uk/xapian/${VERSION}/xapian-core-${VERSION}.tar.xz"
FILENAME "xapian-core-${VERSION}.tar.xz"
SHA512 60d66adbacbd59622d25e392060984bd1dc6c870f9031765f54cb335fb29f72f6d006d27af82a50c8da2cfbebd08dac4503a8afa8ad51bc4e6fa9cb367a59d29
)
vcpkg_extract_source_archive(
SOURCE_PATH
ARCHIVE "${ARCHIVE}"
PATCHES
configure.diff
msvc-no-debug.diff
)
if(WIN32)
vcpkg_replace_string("${SOURCE_PATH}/configure.ac" "z zlib zdll" "z zlib zdll zlibd")
if(MSVC)
# xapian.h has _DEBUG macro detection which will make the vcpkg check fail,replace #error with #warning
vcpkg_replace_string("${SOURCE_PATH}/include/xapian/version_h.cc" "#error" "#warning")
set(OPTIONS "CXXFLAGS=-EHsc")
endif()
set(OPTIONS "")
if(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64")
list(APPEND OPTIONS
ac_cv_have_decl___popcnt=no
ac_cv_have_decl___popcnt64=no
)
endif()
vcpkg_configure_make(
SOURCE_PATH "${SOURCE_PATH}"
AUTOCONFIG
USE_WRAPPERS
OPTIONS ${OPTIONS}
OPTIONS
${OPTIONS}
)
vcpkg_install_make()
@ -32,7 +33,7 @@ vcpkg_install_make()
vcpkg_fixup_pkgconfig()
vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/xapian)
if (NOT VCPKG_TARGET_IS_WINDOWS)
if(NOT VCPKG_TARGET_IS_WINDOWS OR VCPKG_TARGET_IS_MINGW)
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/tools/${PORT}/bin/xapian-config" "\"${CURRENT_INSTALLED_DIR}\"" "`dirname $0`/../../..")
if(NOT VCPKG_BUILD_TYPE)
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/tools/${PORT}/debug/bin/xapian-config" "\"${CURRENT_INSTALLED_DIR}/debug\"" "`dirname $0`/../../../../debug")
@ -40,4 +41,4 @@ if (NOT VCPKG_TARGET_IS_WINDOWS)
endif()
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
configure_file("${SOURCE_PATH}/COPYING" "${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright" COPYONLY)
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/COPYING")

Просмотреть файл

@ -1,10 +1,11 @@
{
"name": "xapian",
"version": "1.4.22",
"port-version": 1,
"description": "Xapian is an Open Source Search Engine Library, released under the GPL v2+. It's written in C++, with bindings to allow use from Perl, Python 2, Python 3, PHP 5, PHP 7, Java, Tcl, C#, Ruby, Lua, Erlang, Node.js and R (so far!)",
"homepage": "https://xapian.org/",
"license": "GPL-2.0-or-later",
"supports": "!(windows & arm) & !uwp",
"supports": "(!arm | arm64) & !uwp",
"dependencies": [
{
"name": "vcpkg-cmake-config",

Просмотреть файл

@ -1710,10 +1710,7 @@ x265:arm64-windows=fail
x265:arm-uwp=fail
x265:x64-android=fail
x265:x64-uwp=fail
xalan-c:x64-windows-static=fail
xalan-c:arm64-windows=fail
# No xorg-macros available on osx
xapian:arm-neon-android=fail
xbitmaps:arm-neon-android=fail
xbitmaps:arm64-android=fail
xbitmaps:x64-android=fail

Просмотреть файл

@ -4838,7 +4838,7 @@
},
"libzim": {
"baseline": "8.2.0",
"port-version": 0
"port-version": 1
},
"libzip": {
"baseline": "1.9.2",
@ -8602,7 +8602,7 @@
},
"xapian": {
"baseline": "1.4.22",
"port-version": 0
"port-version": 1
},
"xaudio2redist": {
"baseline": "1.2.11",

Просмотреть файл

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "1488a183ad98b3610343e68c207554492b1e8c8e",
"version": "8.2.0",
"port-version": 1
},
{
"git-tree": "93b2790850e120148daf03563e24e6ed3ee9e02e",
"version": "8.2.0",

Просмотреть файл

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "0a050725d62e180539040589c1691a5ec3974a30",
"version": "1.4.22",
"port-version": 1
},
{
"git-tree": "f2da71ae6ceb7c0d2317c1d06f11a302f48f89dd",
"version": "1.4.22",