netpbm-10.70.00.ebuild 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. # Copyright 1999-2017 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI="4"
  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 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. rle? ( media-libs/urt )
  17. svga? ( media-libs/svgalib )
  18. tiff? ( >=media-libs/tiff-3.5.5:0 )
  19. xml? ( dev-libs/libxml2 )
  20. zlib? ( sys-libs/zlib )
  21. X? ( x11-libs/libX11 )"
  22. DEPEND="${RDEPEND}
  23. app-arch/xz-utils
  24. sys-devel/flex"
  25. netpbm_libtype() {
  26. case ${CHOST} in
  27. *-darwin*) echo dylib;;
  28. *) echo unixshared;;
  29. esac
  30. }
  31. netpbm_libsuffix() {
  32. local suffix=$(get_libname)
  33. echo ${suffix//\.}
  34. }
  35. netpbm_ldshlib() {
  36. case ${CHOST} in
  37. *-darwin*) echo '$(LDFLAGS) -dynamiclib -install_name $(SONAME)';;
  38. *) echo '$(LDFLAGS) -shared -Wl,-soname,$(SONAME)';;
  39. esac
  40. }
  41. netpbm_config() {
  42. if use $1 ; then
  43. [[ $2 != "!" ]] && echo -l${2:-$1}
  44. else
  45. echo NONE
  46. fi
  47. }
  48. src_prepare() {
  49. epatch "${FILESDIR}"/netpbm-10.31-build.patch
  50. epatch "${FILESDIR}"/netpbm-10.66-test.patch #450530
  51. epatch "${FILESDIR}"/netpbm-10.70-system-libs.patch
  52. # make sure we use system libs
  53. sed -i '/SUPPORT_SUBDIRS/s:urt::' GNUmakefile || die
  54. rm -r urt converter/other/jbig/libjbig converter/other/jpeg2000/libjasper || die
  55. # disable certain tests based on active USE flags
  56. local del=(
  57. $(usex jbig '' 'jbigtopnm pnmtojbig jbig-roundtrip')
  58. $(usex rle '' 'utahrle-roundtrip')
  59. $(usex tiff '' 'tiff-roundtrip')
  60. )
  61. if [[ ${#del[@]} -gt 0 ]] ; then
  62. sed -i -r $(printf -- ' -e /%s.test/d' "${del[@]}") test/Test-Order || die
  63. fi
  64. del=(
  65. pnmtofiasco fiascotopnm # We always disable fiasco
  66. $(usex jpeg '' 'jpegtopnm pnmtojpeg ppmtojpeg')
  67. $(usex jbig '' 'jbigtopnm pnmtojbig')
  68. $(usex jpeg2k '' 'jpeg2ktopam pamtojpeg2k')
  69. $(usex rle '' 'pnmtorle rletopnm')
  70. $(usex tiff '' 'pamtotiff pnmtotiff pnmtotiffcmyk tifftopnm')
  71. )
  72. if [[ ${#del[@]} -gt 0 ]] ; then
  73. sed -i -r $(printf -- ' -e s/\<%s\>(:.ok)?//' "${del[@]}") test/all-in-place.{ok,test} || die
  74. sed -i '/^$/d' test/all-in-place.ok || die
  75. fi
  76. # take care of the importinc stuff ourselves by only doing it once
  77. # at the top level and having all subdirs use that one set #149843
  78. sed -i \
  79. -e '/^importinc:/s|^|importinc:\nmanual_|' \
  80. -e '/-Iimportinc/s|-Iimp|-I"$(BUILDDIR)"/imp|g'\
  81. common.mk || die
  82. sed -i \
  83. -e '/%.c/s: importinc$::' \
  84. common.mk lib/Makefile lib/util/Makefile || die
  85. # avoid ugly depend.mk warnings
  86. touch $(find . -name Makefile | sed s:Makefile:depend.mk:g)
  87. }
  88. src_configure() {
  89. cat config.mk.in - >> config.mk <<-EOF
  90. # Misc crap
  91. BUILD_FIASCO = N
  92. SYMLINK = ln -sf
  93. # These vars let src_test work by default
  94. PKGDIR_DEFAULT = ${T}/netpbm
  95. RESULTDIR_DEFAULT = ${T}/netpbm-test
  96. # Toolchain options
  97. CC = $(tc-getCC) -Wall
  98. LD = \$(CC)
  99. CC_FOR_BUILD = $(tc-getBUILD_CC)
  100. LD_FOR_BUILD = \$(CC_FOR_BUILD)
  101. AR = $(tc-getAR)
  102. RANLIB = $(tc-getRANLIB)
  103. STRIPFLAG =
  104. CFLAGS_SHLIB = -fPIC
  105. LDRELOC = \$(LD) -r
  106. LDSHLIB = $(netpbm_ldshlib)
  107. LINKER_CAN_DO_EXPLICIT_LIBRARY = N # we can, but dont want to
  108. LINKERISCOMPILER = Y
  109. NETPBMLIBSUFFIX = $(netpbm_libsuffix)
  110. NETPBMLIBTYPE = $(netpbm_libtype)
  111. STATICLIB_TOO = $(usex static-libs Y N)
  112. # The var is called SSE, but the code is actually SSE2.
  113. WANT_SSE = $(usex cpu_flags_x86_sse2 Y N)
  114. # Gentoo build options
  115. TIFFLIB = $(netpbm_config tiff)
  116. # Let tiff worry about its own dependencies #395753
  117. TIFFLIB_NEEDS_JPEG = N
  118. TIFFLIB_NEEDS_Z = N
  119. JPEGLIB = $(netpbm_config jpeg)
  120. PNGLIB = $(netpbm_config png)
  121. ZLIB = $(netpbm_config zlib z)
  122. LINUXSVGALIB = $(netpbm_config svga vga)
  123. XML2_LIBS = $(netpbm_config xml xml2)
  124. JBIGLIB = $(netpbm_config jbig)
  125. JBIGHDR_DIR =
  126. JASPERLIB = $(netpbm_config jpeg2k jasper)
  127. JASPERHDR_DIR =
  128. URTLIB = $(netpbm_config rle)
  129. URTHDR_DIR =
  130. X11LIB = $(netpbm_config X X11)
  131. X11HDR_DIR =
  132. EOF
  133. # cannot chain the die with the heredoc above as bash-3
  134. # has a parser bug in that setup #282902
  135. [ $? -eq 0 ] || die "writing config.mk failed"
  136. }
  137. src_compile() {
  138. emake -j1 pm_config.h version.h manual_importinc #149843
  139. emake
  140. }
  141. src_test() {
  142. # The code wants to install everything first and then test the result.
  143. emake install.{bin,lib}
  144. emake check
  145. }
  146. src_install() {
  147. # Subdir make targets like to use `mkdir` all over the place
  148. # without any actual dependencies, thus the -j1.
  149. emake -j1 package pkgdir="${ED}"/usr
  150. [[ $(get_libdir) != "lib" ]] && mv "${ED}"/usr/lib "${ED}"/usr/$(get_libdir)
  151. # Remove cruft that we don't need, and move around stuff we want
  152. rm "${ED}"/usr/bin/{doc.url,manweb} || die
  153. rm -r "${ED}"/usr/man/web || die
  154. rm -r "${ED}"/usr/link || die
  155. rm "${ED}"/usr/{README,VERSION,{pkgconfig,config}_template,pkginfo} || die
  156. dodir /usr/share
  157. mv "${ED}"/usr/man "${ED}"/usr/share/ || die
  158. mv "${ED}"/usr/misc "${ED}"/usr/share/netpbm || die
  159. doman userguide/*.[0-9]
  160. use doc && dohtml -r userguide
  161. dodoc README
  162. cd doc
  163. dodoc HISTORY Netpbm.programming USERDOC
  164. dohtml -r .
  165. }