media-libs/libraw: stable 0.18.8 for hppa, bug #633826
[gentoo.git] / media-gfx / imagemagick / imagemagick-6.9.9.23.ebuild
1 # Copyright 1999-2017 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=6
5
6 inherit eutils flag-o-matic libtool multilib toolchain-funcs versionator
7
8 MY_P=ImageMagick-$(replace_version_separator 3 '-')
9
10 DESCRIPTION="A collection of tools and libraries for many image formats"
11 HOMEPAGE="http://www.imagemagick.org/"
12 SRC_URI="mirror://${PN}/${MY_P}.tar.xz"
13
14 LICENSE="imagemagick"
15 SLOT="0/${PV}"
16 KEYWORDS="alpha ~amd64 arm ~hppa ia64 ~mips ppc ppc64 ~s390 ~sh ~sparc x86 ~ppc-aix ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~x64-solaris ~x86-solaris"
17 IUSE="bzip2 corefonts cxx djvu fftw fontconfig fpx graphviz hdri jbig jpeg jpeg2k lcms lqr lzma opencl openexr openmp pango perl png postscript q32 q8 raw static-libs svg test tiff truetype webp wmf X xml zlib"
18
19 RESTRICT="perl? ( userpriv )"
20
21 RDEPEND="
22         dev-libs/libltdl:0
23         bzip2? ( app-arch/bzip2 )
24         corefonts? ( media-fonts/corefonts )
25         djvu? ( app-text/djvu )
26         fftw? ( sci-libs/fftw:3.0 )
27         fontconfig? ( media-libs/fontconfig )
28         fpx? ( >=media-libs/libfpx-1.3.0-r1 )
29         graphviz? ( media-gfx/graphviz )
30         jbig? ( >=media-libs/jbigkit-2:= )
31         jpeg? ( virtual/jpeg:0 )
32         jpeg2k? ( >=media-libs/openjpeg-2.1.0:2 )
33         lcms? ( media-libs/lcms:2= )
34         lqr? ( media-libs/liblqr )
35         opencl? ( virtual/opencl )
36         openexr? ( media-libs/openexr:0= )
37         pango? ( x11-libs/pango )
38         perl? ( >=dev-lang/perl-5.8.8:0= )
39         png? ( media-libs/libpng:0= )
40         postscript? ( app-text/ghostscript-gpl )
41         raw? ( media-gfx/ufraw )
42         svg? ( gnome-base/librsvg )
43         tiff? ( media-libs/tiff:0= )
44         truetype? (
45                 media-fonts/urw-fonts
46                 >=media-libs/freetype-2
47                 )
48         webp? ( media-libs/libwebp:0= )
49         wmf? ( media-libs/libwmf )
50         X? (
51                 x11-libs/libICE
52                 x11-libs/libSM
53                 x11-libs/libXext
54                 x11-libs/libXt
55                 )
56         xml? ( dev-libs/libxml2:= )
57         lzma? ( app-arch/xz-utils )
58         zlib? ( sys-libs/zlib:= )"
59 DEPEND="${RDEPEND}
60         !media-gfx/graphicsmagick[imagemagick]
61         virtual/pkgconfig
62         X? ( x11-proto/xextproto )"
63
64 REQUIRED_USE="corefonts? ( truetype )
65         test? ( corefonts )"
66
67 S=${WORKDIR}/${MY_P}
68
69 src_prepare() {
70         local mesa_cards ati_cards nvidia_cards render_cards
71         default
72
73         elibtoolize # for Darwin modules
74
75         # For testsuite, see https://bugs.gentoo.org/show_bug.cgi?id=500580#c3
76         shopt -s nullglob
77         ati_cards=$(echo -n /dev/ati/card* | sed 's/ /:/g')
78         if test -n "${ati_cards}"; then
79                 addpredict "${ati_cards}"
80         fi
81         mesa_cards=$(echo -n /dev/dri/card* | sed 's/ /:/g')
82         if test -n "${mesa_cards}"; then
83                 addpredict "${mesa_cards}"
84         fi
85         nvidia_cards=$(echo -n /dev/nvidia** | sed 's/ /:/g')
86         if test -n "${nvidia_cards}"; then
87                 addpredict "${nvidia_cards}"
88         fi
89         render_cards=$(echo -n /dev/dri/renderD128* | sed 's/ /:/g')
90         if test -n "${render_cards}"; then
91                 addpredict "${render_cards}"
92         fi
93         shopt -u nullglob
94         addpredict /dev/nvidiactl
95 }
96
97 src_configure() {
98         local depth=16
99         use q8 && depth=8
100         use q32 && depth=32
101
102         local openmp=disable
103         use openmp && { tc-has-openmp && openmp=enable; }
104
105         [[ ${CHOST} == *-solaris* ]] && append-ldflags -lnsl -lsocket
106
107         local myeconfargs=(
108                 $(use_enable static-libs static)
109                 $(use_enable hdri)
110                 $(use_enable opencl)
111                 --with-threads
112                 --with-modules
113                 --with-quantum-depth=${depth}
114                 $(use_with cxx magick-plus-plus)
115                 $(use_with perl)
116                 --with-perl-options='INSTALLDIRS=vendor'
117                 --with-gs-font-dir="${EPREFIX}"/usr/share/fonts/urw-fonts
118                 $(use_with bzip2 bzlib)
119                 $(use_with X x)
120                 $(use_with zlib)
121                 --without-autotrace
122                 $(use_with postscript dps)
123                 $(use_with djvu)
124                 --with-dejavu-font-dir="${EPREFIX}"/usr/share/fonts/dejavu
125                 $(use_with fftw)
126                 $(use_with fpx)
127                 $(use_with fontconfig)
128                 $(use_with truetype freetype)
129                 $(use_with postscript gslib)
130                 $(use_with graphviz gvc)
131                 $(use_with jbig)
132                 $(use_with jpeg)
133                 $(use_with jpeg2k openjp2)
134                 $(use_with lcms)
135                 $(use_with lqr)
136                 $(use_with lzma)
137                 $(use_with openexr)
138                 $(use_with pango)
139                 $(use_with png)
140                 $(use_with svg rsvg)
141                 $(use_with tiff)
142                 $(use_with webp)
143                 $(use_with corefonts windows-font-dir "${EPREFIX}"/usr/share/fonts/corefonts)
144                 $(use_with wmf)
145                 $(use_with xml)
146                 --${openmp}-openmp
147                 --with-gcc-arch=no-automagic
148         )
149         CONFIG_SHELL=$(type -P bash) econf "${myeconfargs[@]}"
150 }
151
152 src_test() {
153         LD_LIBRARY_PATH="${S}/coders/.libs:${S}/filters/.libs:${S}/Magick++/lib/.libs:${S}/magick/.libs:${S}/wand/.libs" \
154         emake check
155 }
156
157 src_install() {
158         # Ensure documentation installation files and paths with each release!
159         emake \
160                 DESTDIR="${D}" \
161                 DOCUMENTATION_PATH="${EPREFIX}"/usr/share/doc/${PF}/html \
162                 install
163
164         rm -f "${ED}"/usr/share/doc/${PF}/html/{ChangeLog,LICENSE,NEWS.txt}
165         dodoc {AUTHORS,README}.txt ChangeLog
166
167         if use perl; then
168                 find "${ED}" -type f -name perllocal.pod -exec rm -f {} +
169                 find "${ED}" -depth -mindepth 1 -type d -empty -exec rm -rf {} +
170         fi
171
172         find "${ED}" -name '*.la' -exec sed -i -e "/^dependency_libs/s:=.*:='':" {} +
173
174         if use opencl; then
175                 cat <<-EOF > "${T}"/99${PN}
176                 SANDBOX_PREDICT="/dev/nvidiactl:/dev/nvidia-uvm:/dev/ati/card:/dev/dri/card:/dev/dri/renderD128"
177                 EOF
178
179                 insinto /etc/sandbox.d
180                 doins "${T}"/99${PN} #472766
181         fi
182
183         insinto /usr/share/${PN}
184         doins config/*icm
185 }