podofo-0.9.4.ebuild 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. # Copyright 1999-2016 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=6
  4. inherit cmake-utils flag-o-matic multilib toolchain-funcs
  5. DESCRIPTION="PoDoFo is a C++ library to work with the PDF file format"
  6. HOMEPAGE="https://sourceforge.net/projects/podofo/"
  7. SRC_URI="mirror://sourceforge/podofo/${P}.tar.gz"
  8. LICENSE="GPL-2 LGPL-2.1"
  9. SLOT="0"
  10. KEYWORDS="~amd64 ~arm ~hppa ~ppc ~ppc64 ~sparc ~x86"
  11. IUSE="+boost idn libressl debug test"
  12. RDEPEND="dev-lang/lua:=
  13. idn? ( net-dns/libidn:= )
  14. !libressl? ( dev-libs/openssl:0= )
  15. libressl? ( dev-libs/libressl:0= )
  16. media-libs/fontconfig:=
  17. media-libs/freetype:2=
  18. virtual/jpeg:0=
  19. media-libs/libpng:0=
  20. media-libs/tiff:0=
  21. sys-libs/zlib:="
  22. DEPEND="${RDEPEND}
  23. virtual/pkgconfig
  24. boost? ( dev-util/boost-build )
  25. test? ( dev-util/cppunit )"
  26. DOCS="AUTHORS ChangeLog TODO"
  27. src_prepare() {
  28. local x sed_args
  29. # bug 556962
  30. sed -i -e 's|Decrypt( pEncryptedBuffer, nOutputLen, pDecryptedBuffer, m_lLen );|Decrypt( pEncryptedBuffer, (pdf_long)nOutputLen, pDecryptedBuffer, (pdf_long\&)m_lLen );|' \
  31. test/unit/EncryptTest.cpp || die
  32. sed -i \
  33. -e "s:LIBDIRNAME \"lib\":LIBDIRNAME \"$(get_libdir)\":" \
  34. -e "s:LIBIDN_FOUND:HAVE_LIBIDN:g" \
  35. CMakeLists.txt || die
  36. # Use pkg-config to find headers for bug #459404.
  37. sed_args=
  38. for x in $($(tc-getPKG_CONFIG) --cflags freetype2) ; do
  39. [[ ${x} == -I* ]] || continue
  40. x=${x#-I}
  41. if [[ -f ${x}/ft2build.h ]] ; then
  42. sed_args+=" -e s:/usr/include/\\r\$:${x}:"
  43. elif [[ -f ${x}/freetype/config/ftheader.h ]] ; then
  44. sed_args+=" -e s:/usr/include/freetype2\\r\$:${x}:"
  45. fi
  46. done
  47. [[ -n ${sed_args} ]] && \
  48. { sed -i ${sed_args} cmake/modules/FindFREETYPE.cmake || die; }
  49. # Bug #439784: Add missing unistd include for close() and unlink().
  50. sed -i 's:^#include <stdio.h>$:#include <unistd.h>\n\0:' -i \
  51. test/unit/TestUtils.cpp || die
  52. # TODO: fix these test cases
  53. # ColorTest.cpp:62:Assertion
  54. # Test name: ColorTest::testDefaultConstructor
  55. # expected exception not thrown
  56. # - Expected: PdfError
  57. sed -e 's:CPPUNIT_TEST( testDefaultConstructor ://\0:' \
  58. -e 's:CPPUNIT_TEST( testGreyConstructor ://\0:' \
  59. -e 's:CPPUNIT_TEST( testRGBConstructor ://\0:' \
  60. -e 's:CPPUNIT_TEST( testCMYKConstructor ://\0:' \
  61. -e 's:CPPUNIT_TEST( testColorSeparationAllConstructor ://\0:' \
  62. -e 's:CPPUNIT_TEST( testColorSeparationNoneConstructor ://\0:' \
  63. -e 's:CPPUNIT_TEST( testColorSeparationConstructor ://\0:' \
  64. -e 's:CPPUNIT_TEST( testColorCieLabConstructor ://\0:' \
  65. -i test/unit/ColorTest.h || die
  66. # ColorTest.cpp:42:Assertion
  67. # Test name: ColorTest::testHexNames
  68. # assertion failed
  69. # - Expression: static_cast<int>(rgb.GetGreen() * 255.0) == 0x0A
  70. sed -e 's:CPPUNIT_TEST( testHexNames ://\0:' \
  71. -i test/unit/ColorTest.h || die
  72. # Bug #352125: test failure, depending on installed fonts
  73. # ##Failure Location unknown## : Error
  74. # Test name: FontTest::testFonts
  75. # uncaught exception of type PoDoFo::PdfError
  76. # - ePdfError_UnsupportedFontFormat
  77. sed -e 's:CPPUNIT_TEST( testFonts ://\0:' \
  78. -i test/unit/FontTest.h || die
  79. # Test name: EncodingTest::testDifferencesEncoding
  80. # equality assertion failed
  81. # - Expected: 1
  82. # - Actual : 0
  83. sed -e 's:CPPUNIT_TEST( testDifferencesEncoding ://\0:' \
  84. -i test/unit/EncodingTest.h || die
  85. # Bug #407015: fix to compile with Lua 5.2
  86. if has_version '>=dev-lang/lua-5.2' ; then
  87. sed -e 's: lua_open(: luaL_newstate(:' \
  88. -e 's: luaL_getn(: lua_rawlen(:' -i \
  89. tools/podofocolor/luaconverter.cpp \
  90. tools/podofoimpose/planreader_lua.cpp || die
  91. fi
  92. eapply_user
  93. }
  94. src_configure() {
  95. # Bug #381359: undefined reference to `PoDoFo::PdfVariant::DelayedLoadImpl()'
  96. filter-flags -fvisibility-inlines-hidden
  97. mycmakeargs+=(
  98. "-DPODOFO_BUILD_SHARED=1"
  99. "-DPODOFO_HAVE_JPEG_LIB=1"
  100. "-DPODOFO_HAVE_PNG_LIB=1"
  101. "-DPODOFO_HAVE_TIFF_LIB=1"
  102. "-DWANT_FONTCONFIG=1"
  103. "-DUSE_STLPORT=0"
  104. -DWANT_BOOST=$(usex boost ON OFF)
  105. -DHAVE_LIBIDN=$(usex idn ON OFF)
  106. -DHAVE_CPPUNIT=$(usex test ON OFF)
  107. )
  108. cmake-utils_src_configure
  109. }
  110. src_test() {
  111. cd "${CMAKE_BUILD_DIR}"/test/unit
  112. ./podofo-test --selftest || die "self test failed"
  113. }