3 |
3 |
|
4 |
4 |
EAPI=8
|
5 |
5 |
|
6 |
|
LUA_COMPAT=( lua5-{1..4} )
|
7 |
|
|
8 |
|
inherit cmake flag-o-matic lua-single toolchain-funcs
|
|
6 |
inherit cmake flag-o-matic
|
9 |
7 |
|
10 |
8 |
DESCRIPTION="PoDoFo is a C++ library to work with the PDF file format"
|
11 |
|
HOMEPAGE="https://sourceforge.net/projects/podofo/"
|
12 |
|
SRC_URI="https://cfhcable.dl.sourceforge.net/project/podofo/podofo/${PV}/${P}.tar.gz
|
13 |
|
https://github.com/podofo/podofo/commit/d0e9f5d503b0cb79516ec9bff989f3d7d625b678.patch -> ${P}-bug-888463.patch"
|
14 |
|
|
15 |
|
LICENSE="GPL-2 LGPL-2.1"
|
16 |
|
SLOT="0/${PV}"
|
17 |
|
KEYWORDS="amd64 ~arm ~arm64 ~hppa ppc ppc64 ~sparc x86"
|
18 |
|
IUSE="+boost idn debug test +tools"
|
19 |
|
RESTRICT="test"
|
20 |
|
REQUIRED_USE="${LUA_REQUIRED_USE}
|
21 |
|
test? ( tools )"
|
|
9 |
HOMEPAGE="https://github.com/podofo/podofo"
|
|
10 |
# testsuite resources require separate download. Reported at https://github.com/podofo/podofo/issues/102
|
|
11 |
SRC_URI="https://github.com/podofo/podofo/archive/refs/tags/${PV}.tar.gz -> ${P}.tar.gz
|
|
12 |
test? (
|
|
13 |
https://github.com/podofo/podofo-resources/archive/4afe5c3fdb543a4347681b2e52252f1b10f12f24.tar.gz
|
|
14 |
-> ${P}-test-resources.tar.gz
|
|
15 |
)
|
|
16 |
"
|
|
17 |
|
|
18 |
LICENSE="LGPL-2+ tools? ( GPL-2+ )"
|
|
19 |
SLOT="0/2"
|
|
20 |
KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~ppc64 ~x86"
|
|
21 |
IUSE="idn jpeg tiff png fontconfig test tools"
|
|
22 |
RESTRICT="!test? ( test )"
|
22 |
23 |
|
23 |
|
RDEPEND="${LUA_DEPS}
|
|
24 |
RDEPEND="
|
24 |
25 |
idn? ( net-dns/libidn:= )
|
25 |
26 |
dev-libs/openssl:=
|
26 |
|
media-libs/fontconfig:=
|
|
27 |
fontconfig? ( media-libs/fontconfig:= )
|
27 |
28 |
media-libs/freetype:2=
|
28 |
|
media-libs/libjpeg-turbo:=
|
29 |
|
media-libs/libpng:=
|
30 |
|
media-libs/tiff:=
|
|
29 |
jpeg? ( media-libs/libjpeg-turbo:= )
|
|
30 |
png? ( media-libs/libpng:= )
|
|
31 |
dev-libs/libxml2
|
|
32 |
tiff? ( media-libs/tiff:= )
|
31 |
33 |
sys-libs/zlib:="
|
32 |
|
DEPEND="${RDEPEND}
|
33 |
|
test? ( dev-util/cppunit )
|
|
34 |
DEPEND="${RDEPEND}"
|
|
35 |
BDEPEND="
|
|
36 |
virtual/pkgconfig
|
|
37 |
test? ( fontconfig? ( media-fonts/liberation-fonts ) )
|
34 |
38 |
"
|
35 |
39 |
|
36 |
|
BDEPEND="virtual/pkgconfig
|
37 |
|
boost? ( dev-libs/boost )"
|
38 |
|
|
39 |
|
PATCHES=(
|
40 |
|
"${FILESDIR}"/${PN}-0.9.6_p20190928-cmake_lua_version.patch
|
41 |
|
"${DISTDIR}"/${P}-bug-888463.patch
|
42 |
|
)
|
43 |
|
|
44 |
|
DOCS="AUTHORS ChangeLog TODO"
|
45 |
|
|
46 |
40 |
src_prepare() {
|
47 |
41 |
cmake_src_prepare
|
48 |
|
local x sed_args
|
49 |
|
|
50 |
|
# bug 620934 - Disable linking with cppunit when possible, since it
|
51 |
|
# triggers errors with some older compilers.
|
52 |
|
use test || sed -e 's:^FIND_PACKAGE(CppUnit):#\0:' -i CMakeLists.txt || die
|
53 |
|
|
54 |
|
# bug 556962
|
55 |
|
sed -i -e 's|Decrypt( pEncryptedBuffer, nOutputLen, pDecryptedBuffer, m_lLen );|Decrypt( pEncryptedBuffer, (pdf_long)nOutputLen, pDecryptedBuffer, (pdf_long\&)m_lLen );|' \
|
56 |
|
test/unit/EncryptTest.cpp || die
|
57 |
|
|
58 |
|
sed -i \
|
59 |
|
-e "s:LIBDIRNAME \"lib\":LIBDIRNAME \"$(get_libdir)\":" \
|
60 |
|
-e "s:LIBIDN_FOUND:HAVE_LIBIDN:g" \
|
61 |
|
CMakeLists.txt || die
|
62 |
|
|
63 |
|
# Use pkg-config to find headers for bug #459404.
|
64 |
|
sed_args=
|
65 |
|
for x in $($(tc-getPKG_CONFIG) --cflags freetype2) ; do
|
66 |
|
[[ ${x} == -I* ]] || continue
|
67 |
|
x=${x#-I}
|
68 |
|
if [[ -f ${x}/ft2build.h ]] ; then
|
69 |
|
sed_args+=" -e s:/usr/include/\\r\$:${x}:"
|
70 |
|
elif [[ -f ${x}/freetype/config/ftheader.h ]] ; then
|
71 |
|
sed_args+=" -e s:/usr/include/freetype2\\r\$:${x}:"
|
72 |
|
fi
|
73 |
|
done
|
74 |
|
[[ -n ${sed_args} ]] && \
|
75 |
|
{ sed -i ${sed_args} cmake/modules/FindFREETYPE.cmake || die; }
|
76 |
|
|
77 |
|
# Bug #407015: fix to compile with Lua 5.2+
|
78 |
|
case "${ELUA}" in
|
79 |
|
lua5-1|luajit)
|
80 |
|
;;
|
81 |
|
*)
|
82 |
|
sed -e 's: lua_open(: luaL_newstate(:' \
|
83 |
|
-e 's: luaL_getn(: lua_rawlen(:' -i \
|
84 |
|
tools/podofocolor/luaconverter.cpp \
|
85 |
|
tools/podofoimpose/planreader_lua.cpp || die
|
86 |
|
;;
|
87 |
|
esac
|
|
42 |
if use test; then
|
|
43 |
rmdir extern/resources || die
|
|
44 |
mv "${WORKDIR}"/podofo-resources-4afe5c3fdb543a4347681b2e52252f1b10f12f24 extern/resources || die
|
|
45 |
fi
|
88 |
46 |
}
|
89 |
47 |
|
90 |
48 |
src_configure() {
|
91 |
|
|
92 |
|
# Bug #381359: undefined reference to `PoDoFo::PdfVariant::DelayedLoadImpl()'
|
93 |
|
filter-flags -fvisibility-inlines-hidden
|
94 |
|
|
95 |
|
mycmakeargs+=(
|
96 |
|
"-DPODOFO_BUILD_SHARED=1"
|
97 |
|
"-DPODOFO_HAVE_JPEG_LIB=1"
|
98 |
|
"-DPODOFO_HAVE_PNG_LIB=1"
|
99 |
|
"-DPODOFO_HAVE_TIFF_LIB=1"
|
100 |
|
"-DWANT_FONTCONFIG=1"
|
101 |
|
"-DUSE_STLPORT=0"
|
102 |
|
-DLUA_VERSION="$(lua_get_version)"
|
103 |
|
-DWANT_BOOST=$(usex boost ON OFF)
|
104 |
|
-DHAVE_LIBIDN=$(usex idn ON OFF)
|
105 |
|
# We use libidn for unicode support instead
|
106 |
|
-DCMAKE_DISABLE_FIND_PACKAGE_UNISTRING=ON
|
107 |
|
-DPODOFO_HAVE_CPPUNIT=$(usex test ON OFF)
|
108 |
|
-DPODOFO_BUILD_LIB_ONLY=$(usex tools OFF ON)
|
|
49 |
local mycmakeargs=(
|
|
50 |
-DPODOFO_BUILD_TEST=$(usex test ON OFF)
|
|
51 |
-DPODOFO_BUILD_TOOLS=$(usex tools ON OFF)
|
|
52 |
$(cmake_use_find_package idn Libidn)
|
|
53 |
$(cmake_use_find_package jpeg JPEG)
|
|
54 |
$(cmake_use_find_package tiff TIFF)
|
|
55 |
$(cmake_use_find_package png PNG)
|
|
56 |
$(cmake_use_find_package fontconfig Fontconfig)
|
109 |
57 |
)
|
110 |
58 |
|
|
59 |
# some optimizations cause testsuite failures which may indicate
|
|
60 |
# unsoundness with contraction. Be cautious for now. Reported
|
|
61 |
# upstream as https://github.com/podofo/podofo/issues/103
|
|
62 |
append-cxxflags $(test-flags-CXX -ffp-contract=off)
|
|
63 |
|
111 |
64 |
cmake_src_configure
|
112 |
|
mkdir -p "${S}/test/TokenizerTest/objects" || die
|
113 |
65 |
}
|
114 |
66 |
|
115 |
67 |
src_test() {
|
116 |
|
cd "${BUILD_DIR}"/test/unit || die
|
117 |
|
./podofo-test --selftest || die "self test failed"
|
|
68 |
local CMAKE_SKIP_TESTS=(
|
|
69 |
$(usev !png 'TestImage3')
|
|
70 |
$(usev !jpeg 'TestImage2 TestImage4 TestImage5')
|
|
71 |
# relies on finding arial font
|
|
72 |
$(usev !fontconfig 'testLoadEncrypedFilePdfMemDocument testLoadEncrypedFilePdfParser testCyclicTree testNestedArrayTree testEmptyKidsTree testNestedArrayTree testCreateDelete')
|
|
73 |
)
|
|
74 |
|
|
75 |
cmake_src_test
|
118 |
76 |
}
|