kiwix-tools and dependencies (#7491)

This commit is contained in:
Schrijvers Luc
2022-12-03 08:28:27 +01:00
committed by GitHub
parent 50ef5a86d9
commit 7d18b6061f
7 changed files with 400 additions and 0 deletions

View File

@@ -0,0 +1,91 @@
SUMMARY="Reference implementation of the ZIM specification"
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"
COPYRIGHT="2016-2022 openZIM and contributors"
LICENSE="GNU GPL v2"
REVISION="1"
SOURCE_URI="$HOMEPAGE/archive/refs/tags/$portVersion.tar.gz"
CHECKSUM_SHA256="5cce7a572a06c55f0c651553426fc51e579cd2078a85a00cb2f377390b420eac"
SOURCE_URI_2="https://github.com/openzim/zim-testing-suite/archive/refs/tags/v0.4.tar.gz"
CHECKSUM_SHA256_2="7a4f0c773e65be6fe49d3b2159bd9c0f051e8319932ebd3474db0f77f7ea9b27"
PATCHES="libzim-$portVersion.patchset"
ARCHITECTURES="all !x86_gcc2"
SECONDARY_ARCHITECTURES="x86"
libVersion="$portVersion"
libVersionCompat="$libVersion compat >= ${libVersion%%.*}"
PROVIDES="
libzim$secondaryArchSuffix = $portVersion
lib:libzim$secondaryArchSuffix = $libVersionCompat
"
REQUIRES="
haiku$secondaryArchSuffix
lib:libgtest$secondaryArchSuffix
lib:libicui18n$secondaryArchSuffix
lib:liblzma$secondaryArchSuffix
lib:libxapian$secondaryArchSuffix
lib:libzstd$secondaryArchSuffix
"
PROVIDES_devel="
libzim${secondaryArchSuffix}_devel = $portVersion
devel:libzim$secondaryArchSuffix = $libVersionCompat
"
REQUIRES_devel="
libzim$secondaryArchSuffix == $portVersion base
devel:libicui18n$secondaryArchSuffix
devel:libicuuc$secondaryArchSuffix
devel:libicudata$secondaryArchSuffix
devel:liblzma$secondaryArchSuffix
devel:libxapian$secondaryArchSuffix
devel:libzstd$secondaryArchSuffix
"
BUILD_REQUIRES="
haiku${secondaryArchSuffix}_devel
devel:libgtest$secondaryArchSuffix
devel:libicui18n$secondaryArchSuffix
devel:libicuuc$secondaryArchSuffix
devel:libicudata$secondaryArchSuffix
devel:liblzma$secondaryArchSuffix
devel:libxapian$secondaryArchSuffix
devel:libzstd$secondaryArchSuffix
"
BUILD_PREREQUIRES="
cmd:cmake
cmd:gcc$secondaryArchSuffix
cmd:meson
cmd:ninja
cmd:pkg_config$secondaryArchSuffix
"
BUILD()
{
meson . build --buildtype=release \
--prefix=$prefix \
--includedir=$includeDir \
--libdir=$libDir #--reconfigure
ninja -C build
}
INSTALL()
{
ninja -C build install
prepareInstalledDevelLib \
libzim
fixPkgconfig
packageEntries devel \
$developDir
}
TEST()
{
cp -r $sourceDir2/zim-testing-suite-0.4/data $sourceDir/build/test
ninja -C build test
}

View File

@@ -0,0 +1,35 @@
From aad157df88c450203cd2ca6ca803dba6a11590d8 Mon Sep 17 00:00:00 2001
From: begasus <begasus@gmail.com>
Date: Sat, 26 Nov 2022 16:39:47 +0100
Subject: Fix build for Haiku
diff --git a/src/file_reader.cpp b/src/file_reader.cpp
index 74cbc3a..cfabe33 100644
--- a/src/file_reader.cpp
+++ b/src/file_reader.cpp
@@ -134,7 +134,7 @@ class MMapException : std::exception {};
char*
mmapReadOnly(int fd, offset_type offset, size_type size)
{
-#if defined(__APPLE__) || defined(__OpenBSD__)
+#if defined(__APPLE__) || defined(__OpenBSD__) || defined(__HAIKU__)
const auto MAP_FLAGS = MAP_PRIVATE;
#elif defined(__FreeBSD__)
const auto MAP_FLAGS = MAP_PRIVATE|MAP_PREFAULT_READ;
diff --git a/src/fs_unix.cpp b/src/fs_unix.cpp
index e5f404f..6ac0767 100644
--- a/src/fs_unix.cpp
+++ b/src/fs_unix.cpp
@@ -37,7 +37,7 @@ namespace unix {
zsize_t FD::readAt(char* dest, zsize_t size, offset_t offset) const
{
-#if defined(__APPLE__) || defined(__OpenBSD__) || defined(__FreeBSD__)
+#if defined(__APPLE__) || defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__HAIKU__)
# define PREAD pread
#else
# define PREAD pread64
--
2.37.3

View File

@@ -0,0 +1,25 @@
Boost Software License - Version 1.0
Copyright 2015-2020 Kevin Wojniak
Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
this license (the "Software") to use, reproduce, display, distribute,
execute, and transmit the Software, and to prepare derivative works of the
Software, and to permit third-parties to whom the Software is furnished to
do so, all subject to the following:
The copyright notices in the Software and this entire statement, including
the above license grant, this restriction and the following disclaimer,
must be included in all copies of the Software, in whole or in part, and
all derivative works of the Software, unless such copies or derivative
works are solely in the form of machine-executable object code generated by
a source language processor.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.

View File

@@ -0,0 +1,36 @@
SUMMARY="Implementation for modern C++"
DESCRIPTION="* Header only
* Zero dependencies
* Templated string type for compatibility with any STL-like string (std::string, std::wstring, etc)."
HOMEPAGE="https://github.com/kainjow/Mustache"
COPYRIGHT="2015-2020 Kevin Wojniak"
LICENSE="Boost v1.0"
REVISION="1"
SOURCE_URI="$HOMEPAGE/archive/refs/tags/v$portVersion.tar.gz"
CHECKSUM_SHA256="acd66359feb4318b421f9574cfc5a511133a77d916d0b13c7caa3783c0bfe167"
SOURCE_DIR="Mustache-$portVersion"
ARCHITECTURES="all !x86_gcc2"
SECONDARY_ARCHITECTURES="x86"
PROVIDES="
mustache$secondaryArchSuffix = $portVersion
devel:mustache$secondaryArchSuffix = $portVersion
"
TEST_REQUIRES="
haiku${secondaryArchSuffix}_devel
cmd:make
cmd:gcc$secondaryArchSuffix
"
INSTALL()
{
mkdir -p $includeDir
cp mustache.hpp $includeDir
}
TEST()
{
make $jobArgs
}

View File

@@ -0,0 +1,71 @@
SUMMARY="Kiwix command line tools"
DESCRIPTION="The Kiwix tools is a collection of Kiwix related command line tools:
* kiwix-manage: Manage XML based library of ZIM files
* kiwix-read: Read ZIM file content
* kiwix-search: Fulltext search in ZIM files
* kiwix-serve: HTTP daemon serving ZIM files"
HOMEPAGE="https://github.com/kiwix/kiwix-tools"
COPYRIGHT="2022 Kiwix contributors"
LICENSE="GNU GPL v3"
REVISION="1"
SOURCE_URI="$HOMEPAGE/archive/refs/tags/3.3.0.tar.gz"
CHECKSUM_SHA256="15b318080d72373eeb584f2d1b1e4d932d1300191eb8ef919f2536a2e685b413"
SOURCE_DIR="kiwix-tools-$portVersion"
ARCHITECTURES="all !x86_gcc2"
SECONDARY_ARCHITECTURES="x86"
PROVIDES="
kiwix_tools$secondaryArchSuffix = $portVersion
cmd:kiwix_manage = $portVersion
cmd:kiwix_search = $portVersion
cmd:kiwix_serve = $portVersion
"
REQUIRES="
haiku$secondaryArchSuffix
lib:libcurl$secondaryArchSuffix
lib:libgnutls$secondaryArchSuffix
lib:libicui18n$secondaryArchSuffix
lib:libkiwix$secondaryArchSuffix
lib:liblzma$secondaryArchSuffix
lib:libmicrohttpd$secondaryArchSuffix
lib:libpugixml$secondaryArchSuffix
lib:libxapian$secondaryArchSuffix
lib:libzim$secondaryArchSuffix
lib:libzstd$secondaryArchSuffix
"
BUILD_REQUIRES="
haiku${secondaryArchSuffix}_devel
devel:libcurl$secondaryArchSuffix
devel:libgnutls$secondaryArchSuffix
devel:libicui18n$secondaryArchSuffix
devel:libkiwix$secondaryArchSuffix
devel:liblzma$secondaryArchSuffix
devel:libmicrohttpd$secondaryArchSuffix
devel:libpugixml$secondaryArchSuffix
devel:libxapian$secondaryArchSuffix
devel:libzim$secondaryArchSuffix
devel:libzstd$secondaryArchSuffix
"
BUILD_PREREQUIRES="
cmd:cmake
cmd:gcc$secondaryArchSuffix
cmd:make
cmd:meson
cmd:ninja
cmd:pkg_config$secondaryArchSuffix
"
BUILD()
{
meson --buildtype=release build \
--prefix=$prefix \
--mandir=$manDir
ninja -C build
}
INSTALL()
{
ninja -C build install
}

View File

@@ -0,0 +1,95 @@
SUMMARY="Common code base for all Kiwix ports"
DESCRIPTION="The Libkiwix provides the Kiwix software suite core. It contains the code shared by \
all Kiwix ports (Windows, GNU/Linux, macOS, Android, iOS, ...)."
HOMEPAGE="https://github.com/kiwix/libkiwix"
COPYRIGHT="2022 Kiwix contributors"
LICENSE="GNU GPL v3"
REVISION="1"
SOURCE_URI="$HOMEPAGE/archive/refs/tags/$portVersion.tar.gz"
CHECKSUM_SHA256="ec17342874e0444cc6585ab3f55447e139357128defb3f391b78bd3b24915123"
PATCHES="libkiwix-$portVersion.patchset"
ARCHITECTURES="all !x86_gcc2"
SECONDARY_ARCHITECTURES="x86"
libVersion="$portVersion"
libVersionCompat="$libVersion compat >= ${libVersion%%.*}"
PROVIDES="
libkiwix$secondaryArchSuffix = $portVersion
cmd:kiwix_compile_i18n = $portVersion
cmd:kiwix_compile_resources = $portVersion
lib:libkiwix$secondaryArchSuffix = $libVersionCompat
"
REQUIRES="
haiku$secondaryArchSuffix
lib:libcurl$secondaryArchSuffix
lib:libgnutls$secondaryArchSuffix
lib:libicui18n$secondaryArchSuffix
lib:liblzma$secondaryArchSuffix
lib:libmicrohttpd$secondaryArchSuffix
lib:libpugixml$secondaryArchSuffix
lib:libxapian$secondaryArchSuffix
lib:libz$secondaryArchSuffix
lib:libzim$secondaryArchSuffix
lib:libzstd$secondaryArchSuffix
"
PROVIDES_devel="
libkiwix${secondaryArchSuffix}_devel = $portVersion
devel:libkiwix$secondaryArchSuffix = $libVersionCompat
"
REQUIRES_devel="
libkiwix$secondaryArchSuffix == $portVersion base
"
BUILD_REQUIRES="
haiku${secondaryArchSuffix}_devel
devel:mustache$secondaryArchSuffix
devel:libcurl$secondaryArchSuffix
devel:libgnutls$secondaryArchSuffix
devel:libgtest$secondaryArchSuffix
devel:libicui18n$secondaryArchSuffix
devel:liblzma$secondaryArchSuffix
devel:libmicrohttpd$secondaryArchSuffix
devel:libpugixml$secondaryArchSuffix
devel:libxapian$secondaryArchSuffix
devel:libzim$secondaryArchSuffix
devel:libzstd$secondaryArchSuffix
"
BUILD_PREREQUIRES="
cmd:cmake
cmd:gcc$secondaryArchSuffix
cmd:make
cmd:meson
cmd:ninja
cmd:pkg_config$secondaryArchSuffix
cmd:python3
"
BUILD()
{
export LDFLAGS="-lnetwork"
meson --buildtype=release build \
--prefix=$prefix \
--includedir=$includeDir \
--libdir=$libDir \
--mandir=$manDir
ninja -C build
}
INSTALL()
{
ninja -C build install
prepareInstalledDevelLib libkiwix
fixPkgconfig
packageEntries devel \
$developDir
}
TEST()
{
ninja -C build test
}

View File

@@ -0,0 +1,47 @@
From 01e99cadf10d3a60377bc22f0ccf42c6a2b7441f Mon Sep 17 00:00:00 2001
From: begasus <begasus@gmail.com>
Date: Sun, 27 Nov 2022 12:27:09 +0100
Subject: Fix undeclared SIOCGIFCONF
diff --git a/src/tools/networkTools.cpp b/src/tools/networkTools.cpp
index 01c3e95..191eb85 100644
--- a/src/tools/networkTools.cpp
+++ b/src/tools/networkTools.cpp
@@ -43,6 +43,10 @@
#include <netdb.h>
#endif
+#ifdef __HAIKU__
+#include <sys/sockio.h>
+#endif
+
size_t write_callback_to_iss(char* ptr, size_t size, size_t nmemb, void* userdata)
{
auto str = static_cast<std::stringstream*>(userdata);
--
2.37.3
From ebe718696234086fcc694b36bc4f65ae085f4a5b Mon Sep 17 00:00:00 2001
From: begasus <begasus@gmail.com>
Date: Sun, 27 Nov 2022 12:28:36 +0100
Subject: Fix for getifaddrs
diff --git a/test/httplib.h b/test/httplib.h
index 57b84ea..ca43408 100644
--- a/test/httplib.h
+++ b/test/httplib.h
@@ -1516,7 +1516,7 @@ inline bool bind_ip_address(socket_t sock, const char *host) {
}
inline std::string if2ip(const std::string &ifn) {
-#ifndef _WIN32
+#if !defined(_WIN32) && !defined(__HAIKU__)
struct ifaddrs *ifap;
getifaddrs(&ifap);
for (auto ifa = ifap; ifa; ifa = ifa->ifa_next) {
--
2.37.3