ebook-tools: Add package
This commit is contained in:
56
mingw-w64-ebook-tools/PKGBUILD
Normal file
56
mingw-w64-ebook-tools/PKGBUILD
Normal file
@@ -0,0 +1,56 @@
|
||||
# Maintainer: Biswapriyo Nath <nathbappai@gmail.com>
|
||||
|
||||
_realname=ebook-tools
|
||||
pkgbase=mingw-w64-${_realname}
|
||||
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
|
||||
pkgver=0.2.2
|
||||
pkgrel=1
|
||||
pkgdesc="Tools for accessing and converting various ebook file formats (mingw-w64)"
|
||||
arch=('any')
|
||||
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clang32')
|
||||
url="https://sourceforge.net/projects/ebook-tools/"
|
||||
license=('spdx:MIT')
|
||||
depends=("${MINGW_PACKAGE_PREFIX}-libzip"
|
||||
"${MINGW_PACKAGE_PREFIX}-libxml2")
|
||||
makedepends=("${MINGW_PACKAGE_PREFIX}-cc"
|
||||
"${MINGW_PACKAGE_PREFIX}-cmake"
|
||||
"${MINGW_PACKAGE_PREFIX}-ninja")
|
||||
source=("https://downloads.sourceforge.net/${_realname}/${_realname}-${pkgver}.tar.gz"
|
||||
crash-fix.patch)
|
||||
sha256sums=('cbc35996e911144fa62925366ad6a6212d6af2588f1e39075954973bbee627ae'
|
||||
'ad556ce08909727a6022c9f1632086ccb8623a81a4f39cd34722e22116e14527')
|
||||
|
||||
prepare() {
|
||||
cd "${_realname}-${pkgver}"
|
||||
|
||||
# https://sourceforge.net/p/ebook-tools/bugs/8/
|
||||
patch -p2 -i "${srcdir}/crash-fix.patch"
|
||||
}
|
||||
|
||||
build() {
|
||||
declare -a _extra_config
|
||||
if check_option "debug" "n"; then
|
||||
_extra_config+=("-DCMAKE_BUILD_TYPE=Release")
|
||||
else
|
||||
_extra_config+=("-DCMAKE_BUILD_TYPE=Debug")
|
||||
fi
|
||||
|
||||
[[ -d "${srcdir}/build-${MSYSTEM}" ]] && rm -rf "${srcdir}/build-${MSYSTEM}"
|
||||
mkdir -p "${srcdir}/build-${MSYSTEM}" && cd "${srcdir}/build-${MSYSTEM}"
|
||||
|
||||
MSYS2_ARG_CONV_EXCL="-DCMAKE_INSTALL_PREFIX=" \
|
||||
${MINGW_PREFIX}/bin/cmake.exe \
|
||||
-G "Ninja" \
|
||||
"${_extra_config[@]}" \
|
||||
-DCMAKE_INSTALL_PREFIX=${MINGW_PREFIX} \
|
||||
../${_realname}-${pkgver}
|
||||
|
||||
${MINGW_PREFIX}/bin/cmake.exe --build ./
|
||||
}
|
||||
|
||||
package() {
|
||||
cd "${srcdir}/build-${MSYSTEM}"
|
||||
DESTDIR="${pkgdir}" ${MINGW_PREFIX}/bin/cmake.exe --install ./
|
||||
|
||||
install -Dm644 "${srcdir}/${_realname}-${pkgver}/LICENSE" "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/LICENSE"
|
||||
}
|
||||
51
mingw-w64-ebook-tools/crash-fix.patch
Normal file
51
mingw-w64-ebook-tools/crash-fix.patch
Normal file
@@ -0,0 +1,51 @@
|
||||
From 93ebf942a90f9c95797838f9adab94bc0378671c Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Stefan=20Br=C3=BCns?= <stefan.bruens@rwth-aachen.de>
|
||||
Date: Tue, 30 Apr 2019 16:36:09 +0200
|
||||
Subject: [PATCH] Avoid crash on toc.ncx navPoint without navLabel
|
||||
|
||||
Althoug at least one navLabel is required per navPoint, there is no
|
||||
guarantee it actually exists.
|
||||
|
||||
Avoid crashes due to invalid accesses of a null label in case the toc is
|
||||
broken, and spew a warning.
|
||||
|
||||
Fixes #8 epub_tit_next crashes on navPoint without navLabel.
|
||||
---
|
||||
ebook-tools/src/libepub/epub.c | 5 +++--
|
||||
ebook-tools/src/libepub/opf.c | 4 ++++
|
||||
2 files changed, 7 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/ebook-tools/src/libepub/epub.c b/ebook-tools/src/libepub/epub.c
|
||||
index d085503..a259d9d 100644
|
||||
--- a/ebook-tools/src/libepub/epub.c
|
||||
+++ b/ebook-tools/src/libepub/epub.c
|
||||
@@ -469,8 +469,9 @@ int epub_tit_next(struct titerator *tit) {
|
||||
case TITERATOR_NAVMAP:
|
||||
case TITERATOR_PAGES:
|
||||
ti = GetNodeData(curr);
|
||||
- tit->cache.label =
|
||||
- (char *)_opf_label_get_by_doc_lang(tit->epub->opf, ti->label);
|
||||
+ if (ti->label)
|
||||
+ tit->cache.label =
|
||||
+ (char *)_opf_label_get_by_doc_lang(tit->epub->opf, ti->label);
|
||||
|
||||
if (! tit->cache.label)
|
||||
tit->cache.label = (char *)ti->id;
|
||||
diff --git a/ebook-tools/src/libepub/opf.c b/ebook-tools/src/libepub/opf.c
|
||||
index 6851db2..09bce9e 100644
|
||||
--- a/ebook-tools/src/libepub/opf.c
|
||||
+++ b/ebook-tools/src/libepub/opf.c
|
||||
@@ -398,6 +398,10 @@ void _opf_parse_navmap(struct opf *opf, xmlTextReaderPtr reader) {
|
||||
|
||||
} else if (xmlTextReaderNodeType(reader) == 15) {
|
||||
if (item) {
|
||||
+ if (! item->label) {
|
||||
+ _epub_print_debug(opf->epub, DEBUG_WARNING,
|
||||
+ "- missing navlabel for nav point element");
|
||||
+ }
|
||||
_epub_print_debug(opf->epub, DEBUG_INFO,
|
||||
"adding nav point item->%s %s (d:%d,p:%d)",
|
||||
item->id, item->src, item->depth, item->playOrder);
|
||||
--
|
||||
2.21.0
|
||||
|
||||
Reference in New Issue
Block a user