media-libs/gd: arm stable wrt bug #679702
[gentoo.git] / media-libs / gd / gd-2.2.5-r2.ebuild
1 # Copyright 1999-2019 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI="7"
5
6 inherit autotools flag-o-matic multilib-minimal
7
8 DESCRIPTION="Graphics library for fast image creation"
9 HOMEPAGE="https://libgd.org/ https://www.boutell.com/gd/"
10 SRC_URI="https://github.com/libgd/libgd/releases/download/${P}/lib${P}.tar.xz
11         test? (
12                 https://github.com/libgd/libgd/raw/e0cb1b76c305db68b251fe782faa12da5d357593/tests/gif/ossfuzz5700.gif -> lib${P}-ossfuzz5700.dat
13                 https://github.com/libgd/libgd/raw/e0cb1b76c305db68b251fe782faa12da5d357593/tests/gif/php_bug_75571.gif -> lib${P}-php_bug_75571.dat
14         )"
15
16 LICENSE="gd IJG HPND BSD"
17 SLOT="2/3"
18 KEYWORDS="~alpha amd64 arm arm64 ~hppa ~ia64 ~m68k ~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"
19 IUSE="cpu_flags_x86_sse fontconfig jpeg png static-libs test tiff truetype webp xpm zlib"
20
21 # fontconfig has prefixed font paths, details see bug #518970
22 REQUIRED_USE="prefix? ( fontconfig )"
23
24 RDEPEND="fontconfig? ( >=media-libs/fontconfig-2.10.92[${MULTILIB_USEDEP}] )
25         jpeg? ( >=virtual/jpeg-0-r2:0=[${MULTILIB_USEDEP}] )
26         png? ( >=media-libs/libpng-1.6.10:0=[${MULTILIB_USEDEP}] )
27         tiff? ( media-libs/tiff:0[${MULTILIB_USEDEP}] )
28         truetype? ( >=media-libs/freetype-2.5.0.1[${MULTILIB_USEDEP}] )
29         webp? ( media-libs/libwebp:=[${MULTILIB_USEDEP}] )
30         xpm? ( >=x11-libs/libXpm-3.5.10-r1[${MULTILIB_USEDEP}] >=x11-libs/libXt-1.1.4[${MULTILIB_USEDEP}] )
31         zlib? ( >=sys-libs/zlib-1.2.8-r1[${MULTILIB_USEDEP}] )"
32 DEPEND="${RDEPEND}
33         >=virtual/pkgconfig-0-r1[${MULTILIB_USEDEP}]"
34
35 S="${WORKDIR}/lib${P}"
36
37 PATCHES=(
38         "${FILESDIR}/${P}-ossfuzz5700.patch"
39         "${FILESDIR}/${P}-CVE-2018-5711.patch"
40         "${FILESDIR}/${P}-CVE-2018-1000222.patch"
41         "${FILESDIR}/${P}-CVE-2019-6977.patch"
42         "${FILESDIR}/${P}-CVE-2019-6978.patch"
43 )
44
45 src_unpack() {
46         default
47
48         if use test ; then
49                 cp "${DISTDIR}"/lib${P}-ossfuzz5700.dat \
50                         "${S}"/tests/gif/ossfuzz5700.gif || die
51                 cp "${DISTDIR}"/lib${P}-php_bug_75571.dat \
52                         "${S}"/tests/gif/php_bug_75571.gif || die
53         fi
54 }
55
56 src_prepare() {
57         default
58         eautoreconf
59 }
60
61 multilib_src_configure() {
62         # bug 603360, https://github.com/libgd/libgd/blob/fd06f7f83c5e78bf5b7f5397746b4e5ee4366250/docs/README.TESTING#L65
63         if use cpu_flags_x86_sse ; then
64                 append-cflags -msse -mfpmath=sse
65         else
66                 append-cflags -ffloat-store
67         fi
68
69         # bug 632076, https://github.com/libgd/libgd/issues/278
70         if use arm64 || use ppc64 || use s390 ; then
71                 append-cflags -ffp-contract=off
72         fi
73
74         # we aren't actually {en,dis}abling X here ... the configure
75         # script uses it just to add explicit -I/-L paths which we
76         # don't care about on Gentoo systems.
77         local myeconfargs=(
78                 --disable-werror
79                 --without-x
80                 --without-liq
81                 $(use_enable static-libs static)
82                 $(use_with fontconfig)
83                 $(use_with png)
84                 $(use_with tiff)
85                 $(use_with truetype freetype)
86                 $(use_with jpeg)
87                 $(use_with webp)
88                 $(use_with xpm)
89                 $(use_with zlib)
90         )
91         ECONF_SOURCE="${S}" econf "${myeconfargs[@]}"
92 }
93
94 multilib_src_install_all() {
95         dodoc README.md
96         find "${ED}" -name '*.la' -delete || die
97 }