diff options
author | 2020-10-22 23:37:01 +0200 | |
---|---|---|
committer | 2020-10-22 23:59:47 +0200 | |
commit | ea10335f350501cef119c15fb680762f9a55086a (patch) | |
tree | 8ec8593253bafe97447851d8ffdec77c2f16a6e9 /app-text | |
parent | kde-plasma/xembed-sni-proxy: 5.20.1.1 version (tarball only) bump (diff) | |
download | gentoo-ea10335f350501cef119c15fb680762f9a55086a.tar.gz gentoo-ea10335f350501cef119c15fb680762f9a55086a.tar.bz2 gentoo-ea10335f350501cef119c15fb680762f9a55086a.zip |
app-text/ebook-tools: EAPI-7, cmake.eclass, crashfix
Package-Manager: Portage-3.0.8, Repoman-3.0.2
Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
Diffstat (limited to 'app-text')
4 files changed, 189 insertions, 0 deletions
diff --git a/app-text/ebook-tools/ebook-tools-0.2.2-r2.ebuild b/app-text/ebook-tools/ebook-tools-0.2.2-r2.ebuild new file mode 100644 index 000000000000..b8b20f0bdac3 --- /dev/null +++ b/app-text/ebook-tools/ebook-tools-0.2.2-r2.ebuild @@ -0,0 +1,34 @@ +# Copyright 1999-2020 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +inherit cmake + +DESCRIPTION="Tools for accessing and converting various ebook file formats" +HOMEPAGE="https://sourceforge.net/projects/ebook-tools/" +SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz" + +LICENSE="MIT" +SLOT="0" +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~ppc ~ppc64 ~x86" +IUSE="+lit2epub" + +DEPEND=" + dev-libs/libxml2 + >=dev-libs/libzip-1.7.2:= +" +RDEPEND="${DEPEND} + lit2epub? ( app-text/convertlit ) +" + +PATCHES=( + "${FILESDIR}/${P}-crashfix.patch" + "${FILESDIR}/${P}-fvisibility-hidden.patch" + "${FILESDIR}/${P}-libzip-cmake.patch" +) + +src_prepare() { + cmake_src_prepare + use lit2epub || sed -e "\|lit2epub|d" -i src/tools/CMakeLists.txt || die +} diff --git a/app-text/ebook-tools/files/ebook-tools-0.2.2-crashfix.patch b/app-text/ebook-tools/files/ebook-tools-0.2.2-crashfix.patch new file mode 100644 index 000000000000..1ca8dd4902f2 --- /dev/null +++ b/app-text/ebook-tools/files/ebook-tools-0.2.2-crashfix.patch @@ -0,0 +1,50 @@ +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. +--- + src/libepub/epub.c | 5 +++-- + src/libepub/opf.c | 4 ++++ + 2 files changed, 7 insertions(+), 2 deletions(-) + +diff --git a/src/libepub/epub.c b/src/libepub/epub.c +index d085503..a259d9d 100644 +--- a/src/libepub/epub.c ++++ b/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/src/libepub/opf.c b/src/libepub/opf.c +index 6851db2..09bce9e 100644 +--- a/src/libepub/opf.c ++++ b/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 diff --git a/app-text/ebook-tools/files/ebook-tools-0.2.2-fvisibility-hidden.patch b/app-text/ebook-tools/files/ebook-tools-0.2.2-fvisibility-hidden.patch new file mode 100644 index 000000000000..933ecb878810 --- /dev/null +++ b/app-text/ebook-tools/files/ebook-tools-0.2.2-fvisibility-hidden.patch @@ -0,0 +1,22 @@ +--- a/src/libepub/epub_shared.h ++++ b/src/libepub/epub_shared.h +@@ -8,7 +8,7 @@ + # define EPUB_EXPORT __declspec(dllimport) + # endif + #else +-# define EPUB_EXPORT ++# define EPUB_EXPORT __attribute__ ((visibility ("default"))) + #endif + + /** +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -15,7 +15,7 @@ find_package(LibXml2 REQUIRED) + find_package(LibZip REQUIRED) + + if(CMAKE_C_COMPILER_ID MATCHES GNU) +- set(CMAKE_C_FLAGS "-Wall -W -Wno-long-long -Wundef -Wcast-align -Werror-implicit-function-declaration -Wchar-subscripts -Wpointer-arith -Wwrite-strings -Wformat-security -Wmissing-format-attribute -Wshadow -fno-common ${CMAKE_C_FLAGS}") ++ set(CMAKE_C_FLAGS "-Wall -W -Wno-long-long -Wundef -Wcast-align -Werror-implicit-function-declaration -Wchar-subscripts -Wpointer-arith -Wwrite-strings -Wformat-security -Wmissing-format-attribute -Wshadow -fno-common -fvisibility=hidden ${CMAKE_C_FLAGS}") + endif(CMAKE_C_COMPILER_ID MATCHES GNU) + if(MSVC) + add_definitions(-D_CRT_SECURE_NO_WARNINGS) diff --git a/app-text/ebook-tools/files/ebook-tools-0.2.2-libzip-cmake.patch b/app-text/ebook-tools/files/ebook-tools-0.2.2-libzip-cmake.patch new file mode 100644 index 000000000000..d1a560f1a5da --- /dev/null +++ b/app-text/ebook-tools/files/ebook-tools-0.2.2-libzip-cmake.patch @@ -0,0 +1,83 @@ +From fa125b4223bc8995ed60befbed757ec23eed72e7 Mon Sep 17 00:00:00 2001 +From: Andreas Sturmlechner <asturm@gentoo.org> +Date: Thu, 22 Oct 2020 23:32:33 +0200 +Subject: [PATCH] Use >=dev-libs/libzip-1.7.2 cmake config + +Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org> +--- + CMakeLists.txt | 2 +- + cmake/FindLibZip.cmake | 36 ------------------------------------ + src/libepub/CMakeLists.txt | 2 +- + 3 files changed, 2 insertions(+), 38 deletions(-) + delete mode 100644 cmake/FindLibZip.cmake + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index fc141c2..691cf2b 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -11,7 +11,7 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake) + set(LIB_SUFFIX "" CACHE STRING "Define suffix of library directory name (32/64)") + + find_package(LibXml2 REQUIRED) +-find_package(LibZip REQUIRED) ++find_package(LibZip 1.7.2 CONFIG REQUIRED) + + if(CMAKE_C_COMPILER_ID MATCHES GNU) + set(CMAKE_C_FLAGS "-Wall -W -Wno-long-long -Wundef -Wcast-align -Werror-implicit-function-declaration -Wchar-subscripts -Wpointer-arith -Wwrite-strings -Wformat-security -Wmissing-format-attribute -Wshadow -fno-common ${CMAKE_C_FLAGS}") +diff --git a/cmake/FindLibZip.cmake b/cmake/FindLibZip.cmake +deleted file mode 100644 +index c873092..0000000 +--- a/cmake/FindLibZip.cmake ++++ /dev/null +@@ -1,36 +0,0 @@ +-# - Try to find libzip +-# Once done this will define +-# +-# LIBZIP_FOUND - system has the zip library +-# LIBZIP_INCLUDE_DIR - the zip include directory +-# LIBZIP_LIBRARY - Link this to use the zip library +-# +-# Copyright (c) 2006, Pino Toscano, <toscano.pino@tiscali.it> +-# +-# Redistribution and use is allowed according to the terms of the BSD license. +-# For details see the accompanying COPYING-CMAKE-SCRIPTS file. +- +-if (LIBZIP_LIBRARY AND LIBZIP_INCLUDE_DIR) +- # in cache already +- set(LIBZIP_FOUND TRUE) +-else (LIBZIP_LIBRARY AND LIBZIP_INCLUDE_DIR) +- +- find_path(LIBZIP_INCLUDE_DIR zip.h +- ${GNUWIN32_DIR}/include +- ) +- +- find_library(LIBZIP_LIBRARY NAMES zip +- PATHS +- ${GNUWIN32_DIR}/lib +- ) +- +- include(FindPackageHandleStandardArgs) +- FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibZip DEFAULT_MSG LIBZIP_LIBRARY LIBZIP_INCLUDE_DIR) +- +- # ensure that they are cached +- set(LIBZIP_INCLUDE_DIR ${LIBZIP_INCLUDE_DIR} CACHE INTERNAL "The libzip include path") +- set(LIBZIP_LIBRARY ${LIBZIP_LIBRARY} CACHE INTERNAL "The libraries needed to use libzip") +- +-endif (LIBZIP_LIBRARY AND LIBZIP_INCLUDE_DIR) +- +-mark_as_advanced(LIBZIP_INCLUDE_DIR LIBZIP_LIBRARY) +diff --git a/src/libepub/CMakeLists.txt b/src/libepub/CMakeLists.txt +index a3208b7..460270c 100644 +--- a/src/libepub/CMakeLists.txt ++++ b/src/libepub/CMakeLists.txt +@@ -1,6 +1,6 @@ + include_directories (${EBOOK-TOOLS_SOURCE_DIR}/src/libepub ${LIBXML2_INCLUDE_DIR} ${LIBZIP_INCLUDE_DIR}) + add_library (epub SHARED epub.c ocf.c opf.c linklist.c list.c) +-target_link_libraries (epub ${LIBZIP_LIBRARY} ${LIBXML2_LIBRARIES}) ++target_link_libraries (epub libzip::zip ${LIBXML2_LIBRARIES}) + + set_target_properties (epub PROPERTIES VERSION 0.2.1 SOVERSION 0) + +-- +2.29.0 + |