1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
6 inherit toolchain-funcs eutils multilib
8 DESCRIPTION="A set of utilities for converting to/from the netpbm (and related) formats"
9 HOMEPAGE="http://netpbm.sourceforge.net/"
10 SRC_URI="mirror://gentoo/${P}.tar.xz"
14 KEYWORDS="~alpha amd64 arm arm64 hppa ia64 ~mips ppc ppc64 ~s390 sparc x86 ~amd64-linux ~x86-linux"
15 IUSE="doc jbig jpeg png rle cpu_flags_x86_sse2 static-libs svga tiff X xml zlib"
17 RDEPEND="jbig? ( media-libs/jbigkit )
18 jpeg? ( virtual/jpeg:0 )
19 png? ( >=media-libs/libpng-1.4:0 )
20 rle? ( media-libs/urt )
21 svga? ( media-libs/svgalib )
22 tiff? ( >=media-libs/tiff-3.5.5:0 )
23 xml? ( dev-libs/libxml2 )
24 zlib? ( sys-libs/zlib )
25 X? ( x11-libs/libX11 )"
32 *-darwin*) echo dylib;;
37 local suffix=$(get_libname)
42 *-darwin*) echo '$(LDFLAGS) -dynamiclib -install_name $(SONAME)';;
43 *) echo '$(LDFLAGS) -shared -Wl,-soname,$(SONAME)';;
48 [[ $2 != "!" ]] && echo -l${2:-$1}
55 epatch "${FILESDIR}"/netpbm-10.31-build.patch
56 epatch "${FILESDIR}"/netpbm-10.66-test.patch #450530
57 epatch "${FILESDIR}"/netpbm-10.70-system-libs.patch
59 # make sure we use system libs
60 sed -i '/SUPPORT_SUBDIRS/s:urt::' GNUmakefile || die
61 rm -r urt converter/other/jbig/libjbig converter/other/jpeg2000/libjasper || die
63 # disable certain tests based on active USE flags
65 $(usex jbig '' 'jbigtopnm pnmtojbig jbig-roundtrip')
66 $(usex rle '' 'utahrle-roundtrip')
67 $(usex tiff '' 'tiff-roundtrip')
69 if [[ ${#del[@]} -gt 0 ]] ; then
70 sed -i -r $(printf -- ' -e /%s.test/d' "${del[@]}") test/Test-Order || die
73 pnmtofiasco fiascotopnm # We always disable fiasco
74 $(usex jpeg '' 'jpegtopnm pnmtojpeg ppmtojpeg')
75 $(usex jbig '' 'jbigtopnm pnmtojbig')
76 jpeg2ktopam pamtojpeg2k # jasper has been removed
77 $(usex rle '' 'pnmtorle rletopnm')
78 $(usex tiff '' 'pamtotiff pnmtotiff pnmtotiffcmyk tifftopnm')
80 if [[ ${#del[@]} -gt 0 ]] ; then
81 sed -i -r $(printf -- ' -e s/\<%s\>(:.ok)?//' "${del[@]}") test/all-in-place.{ok,test} || die
82 sed -i '/^$/d' test/all-in-place.ok || die
85 # take care of the importinc stuff ourselves by only doing it once
86 # at the top level and having all subdirs use that one set #149843
88 -e '/^importinc:/s|^|importinc:\nmanual_|' \
89 -e '/-Iimportinc/s|-Iimp|-I"$(BUILDDIR)"/imp|g'\
92 -e '/%.c/s: importinc$::' \
93 common.mk lib/Makefile lib/util/Makefile || die
95 # avoid ugly depend.mk warnings
96 touch $(find . -name Makefile | sed s:Makefile:depend.mk:g)
100 cat config.mk.in - >> config.mk <<-EOF
105 # These vars let src_test work by default
106 PKGDIR_DEFAULT = ${T}/netpbm
107 RESULTDIR_DEFAULT = ${T}/netpbm-test
110 CC = $(tc-getCC) -Wall
112 CC_FOR_BUILD = $(tc-getBUILD_CC)
113 LD_FOR_BUILD = \$(CC_FOR_BUILD)
115 RANLIB = $(tc-getRANLIB)
121 LDSHLIB = $(netpbm_ldshlib)
122 LINKER_CAN_DO_EXPLICIT_LIBRARY = N # we can, but dont want to
124 NETPBMLIBSUFFIX = $(netpbm_libsuffix)
125 NETPBMLIBTYPE = $(netpbm_libtype)
126 STATICLIB_TOO = $(usex static-libs Y N)
128 # The var is called SSE, but the code is actually SSE2.
129 WANT_SSE = $(usex cpu_flags_x86_sse2 Y N)
131 # Gentoo build options
132 TIFFLIB = $(netpbm_config tiff)
133 # Let tiff worry about its own dependencies #395753
134 TIFFLIB_NEEDS_JPEG = N
136 JPEGLIB = $(netpbm_config jpeg)
137 PNGLIB = $(netpbm_config png)
138 ZLIB = $(netpbm_config zlib z)
139 LINUXSVGALIB = $(netpbm_config svga vga)
140 XML2_LIBS = $(netpbm_config xml xml2)
141 JBIGLIB = $(netpbm_config jbig)
145 URTLIB = $(netpbm_config rle)
147 X11LIB = $(netpbm_config X X11)
150 # cannot chain the die with the heredoc above as bash-3
151 # has a parser bug in that setup #282902
152 [ $? -eq 0 ] || die "writing config.mk failed"
156 emake -j1 pm_config.h version.h manual_importinc #149843
161 # The code wants to install everything first and then test the result.
162 emake install.{bin,lib}
167 # Subdir make targets like to use `mkdir` all over the place
168 # without any actual dependencies, thus the -j1.
169 emake -j1 package pkgdir="${ED}"/usr
171 [[ $(get_libdir) != "lib" ]] && mv "${ED}"/usr/lib "${ED}"/usr/$(get_libdir)
173 # Remove cruft that we don't need, and move around stuff we want
174 rm "${ED}"/usr/bin/{doc.url,manweb} || die
175 rm -r "${ED}"/usr/man/web || die
176 rm -r "${ED}"/usr/link || die
177 rm "${ED}"/usr/{README,VERSION,{pkgconfig,config}_template,pkginfo} || die
179 mv "${ED}"/usr/man "${ED}"/usr/share/ || die
180 mv "${ED}"/usr/misc "${ED}"/usr/share/netpbm || die
182 doman userguide/*.[0-9]
183 use doc && dohtml -r userguide
186 dodoc HISTORY Netpbm.programming USERDOC