77700dd36e0f60f723aa1fc4a632f1ea4174e68b
[gentoo.git] / media-gfx / graphicsmagick / graphicsmagick-1.3.24.ebuild
1 # Copyright 1999-2016 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Id$
4
5 EAPI=6
6 inherit autotools toolchain-funcs
7
8 MY_P=${P/graphicsm/GraphicsM}
9
10 DESCRIPTION="Collection of tools and libraries for many image formats"
11 HOMEPAGE="http://www.graphicsmagick.org/"
12 SRC_URI="mirror://sourceforge/${PN}/${MY_P}.tar.xz"
13
14 LICENSE="MIT"
15 SLOT="0"
16 KEYWORDS="alpha amd64 hppa ~ppc ppc64 ~sparc x86 ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos"
17 IUSE="bzip2 cxx debug fpx imagemagick jbig jpeg jpeg2k lcms lzma modules openmp
18         perl png postscript q16 q32 static-libs svg threads tiff truetype webp wmf X zlib"
19
20 RDEPEND=">=sys-devel/libtool-2.2.6b
21         bzip2? ( app-arch/bzip2 )
22         fpx? ( media-libs/libfpx )
23         imagemagick? ( !media-gfx/imagemagick )
24         jbig? ( media-libs/jbigkit )
25         jpeg? ( virtual/jpeg:0 )
26         jpeg2k? ( media-libs/jasper )
27         lcms? ( media-libs/lcms:2 )
28         lzma? ( app-arch/xz-utils )
29         perl? ( dev-lang/perl )
30         png? ( media-libs/libpng:0 )
31         postscript? ( app-text/ghostscript-gpl )
32         svg? ( dev-libs/libxml2 )
33         tiff? ( media-libs/tiff:0 )
34         truetype? (
35                 media-fonts/urw-fonts
36                 >=media-libs/freetype-2
37                 )
38         webp? ( media-libs/libwebp )
39         wmf? ( media-libs/libwmf )
40         X? (
41                 x11-libs/libSM
42                 x11-libs/libXext
43                 )
44         zlib? ( sys-libs/zlib )"
45 DEPEND="${RDEPEND}"
46
47 S=${WORKDIR}/${MY_P}
48
49 PATCHES=(
50         "${FILESDIR}"/${PN}-1.3.19-flags.patch
51         "${FILESDIR}"/${PN}-1.3.19-perl.patch
52         "${FILESDIR}"/${PN}-1.3.20-powerpc.patch
53 )
54
55 src_prepare() {
56         default
57         eautoreconf
58 }
59
60 src_configure() {
61         local depth=8
62         use q16 && depth=16
63         use q32 && depth=32
64
65         local openmp=disable
66         if use openmp && tc-has-openmp; then
67                 openmp=enable
68         fi
69
70         econf \
71                 --docdir="${EPREFIX}"/usr/share/doc/${PF} \
72                 --htmldir="${EPREFIX}"/usr/share/doc/${PF}/html \
73                 --${openmp}-openmp \
74                 --enable-largefile \
75                 --enable-shared \
76                 $(use_enable static-libs static) \
77                 $(use_enable debug prof) \
78                 $(use_enable debug gcov) \
79                 $(use_enable imagemagick magick-compat) \
80                 $(use_with threads) \
81                 $(use_with modules) \
82                 --with-quantum-depth=${depth} \
83                 --without-frozenpaths \
84                 $(use_with cxx magick-plus-plus) \
85                 $(use_with perl) \
86                 --with-perl-options=INSTALLDIRS=vendor \
87                 $(use_with bzip2 bzlib) \
88                 $(use_with postscript dps) \
89                 $(use_with fpx) \
90                 --without-gslib \
91                 $(use_with jbig) \
92                 $(use_with webp) \
93                 $(use_with jpeg) \
94                 $(use_with jpeg2k jp2) \
95                 $(use_with lcms lcms2) \
96                 $(use_with lzma) \
97                 $(use_with png) \
98                 $(use_with tiff) \
99                 $(use_with truetype ttf) \
100                 $(use_with wmf) \
101                 --with-fontpath="${EPREFIX}"/usr/share/fonts \
102                 --with-gs-font-dir="${EPREFIX}"/usr/share/fonts/urw-fonts \
103                 --with-windows-font-dir="${EPREFIX}"/usr/share/fonts/corefonts \
104                 $(use_with svg xml) \
105                 $(use_with zlib) \
106                 $(use_with X x)
107 }
108
109 src_compile() {
110         default
111         use perl && emake perl-build
112 }
113
114 src_test() {
115         unset DISPLAY # some perl tests fail when DISPLAY is set
116         default
117 }
118
119 src_install() {
120         default
121
122         if use perl; then
123                 emake -C PerlMagick DESTDIR="${D}" install
124                 find "${ED}" -type f -name perllocal.pod -exec rm -f {} +
125                 find "${ED}" -depth -mindepth 1 -type d -empty -exec rm -rf {} +
126         fi
127
128         find "${ED}" -name '*.la' -exec sed -i -e "/^dependency_libs/s:=.*:='':" {} +
129 }