netpbm-10.76.00.ebuild 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. # Copyright 1999-2016 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI="5"
  4. inherit toolchain-funcs eutils multilib
  5. DESCRIPTION="A set of utilities for converting to/from the netpbm (and related) formats"
  6. HOMEPAGE="http://netpbm.sourceforge.net/"
  7. SRC_URI="mirror://gentoo/${P}.tar.xz"
  8. LICENSE="GPL-2"
  9. SLOT="0"
  10. KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x86-linux"
  11. IUSE="doc jbig jpeg jpeg2k png postscript rle cpu_flags_x86_sse2 static-libs svga tiff X xml zlib"
  12. RDEPEND="jbig? ( media-libs/jbigkit )
  13. jpeg? ( virtual/jpeg:0 )
  14. jpeg2k? ( media-libs/jasper )
  15. png? ( >=media-libs/libpng-1.4:0 )
  16. postscript? ( app-text/ghostscript-gpl )
  17. rle? ( media-libs/urt )
  18. svga? ( media-libs/svgalib )
  19. tiff? ( >=media-libs/tiff-3.5.5:0 )
  20. xml? ( dev-libs/libxml2 )
  21. zlib? ( sys-libs/zlib )
  22. X? ( x11-libs/libX11 )"
  23. DEPEND="${RDEPEND}
  24. app-arch/xz-utils
  25. sys-devel/flex"
  26. netpbm_libtype() {
  27. case ${CHOST} in
  28. *-darwin*) echo dylib;;
  29. *) echo unixshared;;
  30. esac
  31. }
  32. netpbm_libsuffix() {
  33. local suffix=$(get_libname)
  34. echo ${suffix//\.}
  35. }
  36. netpbm_ldshlib() {
  37. case ${CHOST} in
  38. *-darwin*) echo '$(LDFLAGS) -dynamiclib -install_name $(SONAME)';;
  39. *) echo '$(LDFLAGS) -shared -Wl,-soname,$(SONAME)';;
  40. esac
  41. }
  42. netpbm_config() {
  43. if use $1 ; then
  44. [[ $2 != "!" ]] && echo -l${2:-$1}
  45. else
  46. echo NONE
  47. fi
  48. }
  49. src_prepare() {
  50. epatch "${FILESDIR}"/netpbm-10.76.00-build.patch
  51. epatch "${FILESDIR}"/netpbm-10.76.00-test.patch #450530
  52. epatch "${FILESDIR}"/netpbm-10.76.00-misc-deps.patch
  53. epatch "${FILESDIR}"/netpbm-10.76.00-pbmtext-test.patch #601012
  54. # make sure we use system libs
  55. sed -i '/SUPPORT_SUBDIRS/s:urt::' GNUmakefile || die
  56. rm -r urt converter/other/jbig/libjbig converter/other/jpeg2000/libjasper || die
  57. # take care of the importinc stuff ourselves by only doing it once
  58. # at the top level and having all subdirs use that one set #149843
  59. sed -i \
  60. -e '/^importinc:/s|^|importinc:\nmanual_|' \
  61. -e '/-Iimportinc/s|-Iimp|-I"$(BUILDDIR)"/imp|g'\
  62. common.mk || die
  63. sed -i \
  64. -e '/%.c/s: importinc$::' \
  65. common.mk lib/Makefile lib/util/Makefile || die
  66. sed -i \
  67. -e 's:pkg-config:$(PKG_CONFIG):' \
  68. GNUmakefile converter/other/Makefile other/pamx/Makefile || die
  69. # The postscript knob is currently bound up with a fork test.
  70. if ! use postscript ; then
  71. sed -i \
  72. -e 's:$(DONT_HAVE_PROCESS_MGMT):Y:' \
  73. converter/other/Makefile generator/Makefile || die
  74. sed -i -r \
  75. -e 's:(pbmtextps|pnmtops|pstopnm).*::' \
  76. test/all-in-place.{ok,test} || die
  77. sed -i -e '/^$/d' test/all-in-place.ok || die
  78. sed -i '2iexit 80' test/ps-{alt-,}roundtrip.test || die
  79. fi
  80. # avoid ugly depend.mk warnings
  81. touch $(find . -name Makefile | sed s:Makefile:depend.mk:g)
  82. }
  83. src_configure() {
  84. cat config.mk.in - >> config.mk <<-EOF
  85. # Misc crap
  86. BUILD_FIASCO = N
  87. SYMLINK = ln -sf
  88. # These vars let src_test work by default
  89. PKGDIR_DEFAULT = ${T}/netpbm
  90. RESULTDIR_DEFAULT = ${T}/netpbm-test
  91. # Toolchain options
  92. CC = $(tc-getCC) -Wall
  93. LD = \$(CC)
  94. CC_FOR_BUILD = $(tc-getBUILD_CC)
  95. LD_FOR_BUILD = \$(CC_FOR_BUILD)
  96. AR = $(tc-getAR)
  97. RANLIB = $(tc-getRANLIB)
  98. PKG_CONFIG = $(tc-getPKG_CONFIG)
  99. STRIPFLAG =
  100. CFLAGS_SHLIB = -fPIC
  101. LDRELOC = \$(LD) -r
  102. LDSHLIB = $(netpbm_ldshlib)
  103. LINKER_CAN_DO_EXPLICIT_LIBRARY = N # we can, but dont want to
  104. LINKERISCOMPILER = Y
  105. NETPBMLIBSUFFIX = $(netpbm_libsuffix)
  106. NETPBMLIBTYPE = $(netpbm_libtype)
  107. STATICLIB_TOO = $(usex static-libs Y N)
  108. # The var is called SSE, but the code is actually SSE2.
  109. WANT_SSE = $(usex cpu_flags_x86_sse2 Y N)
  110. # Gentoo build options
  111. TIFFLIB = $(netpbm_config tiff)
  112. # Let tiff worry about its own dependencies #395753
  113. TIFFLIB_NEEDS_JPEG = N
  114. TIFFLIB_NEEDS_Z = N
  115. JPEGLIB = $(netpbm_config jpeg)
  116. PNGLIB = $(netpbm_config png)
  117. ZLIB = $(netpbm_config zlib z)
  118. LINUXSVGALIB = $(netpbm_config svga vga)
  119. XML2_LIBS = $(netpbm_config xml xml2)
  120. JBIGLIB = $(netpbm_config jbig)
  121. JBIGHDR_DIR =
  122. JASPERLIB = $(netpbm_config jpeg2k jasper)
  123. JASPERHDR_DIR =
  124. URTLIB = $(netpbm_config rle)
  125. URTHDR_DIR =
  126. X11LIB = $(netpbm_config X X11)
  127. X11HDR_DIR =
  128. EOF
  129. # cannot chain the die with the heredoc above as bash-3
  130. # has a parser bug in that setup #282902
  131. [ $? -eq 0 ] || die "writing config.mk failed"
  132. }
  133. src_compile() {
  134. emake -j1 pm_config.h version.h manual_importinc #149843
  135. emake
  136. }
  137. src_test() {
  138. # The code wants to install everything first and then test the result.
  139. emake install.{bin,lib,data}
  140. emake check
  141. }
  142. src_install() {
  143. # Subdir make targets like to use `mkdir` all over the place
  144. # without any actual dependencies, thus the -j1.
  145. emake -j1 package pkgdir="${ED}"/usr
  146. [[ $(get_libdir) != "lib" ]] && mv "${ED}"/usr/lib "${ED}"/usr/$(get_libdir)
  147. # Remove cruft that we don't need, and move around stuff we want
  148. rm "${ED}"/usr/bin/{doc.url,manweb} || die
  149. rm -r "${ED}"/usr/man/web || die
  150. rm -r "${ED}"/usr/link || die
  151. rm "${ED}"/usr/{README,VERSION,{pkgconfig,config}_template,pkginfo} || die
  152. dodir /usr/share
  153. mv "${ED}"/usr/man "${ED}"/usr/share/ || die
  154. mv "${ED}"/usr/misc "${ED}"/usr/share/netpbm || die
  155. doman userguide/*.[0-9]
  156. use doc && dohtml -r userguide
  157. dodoc README
  158. cd doc
  159. dodoc HISTORY Netpbm.programming USERDOC
  160. dohtml -r .
  161. }