1 # Copyright 1999-2019 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
6 inherit autotools flag-o-matic multilib-minimal
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
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
16 LICENSE="gd IJG HPND BSD"
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"
21 # fontconfig has prefixed font paths, details see bug #518970
22 REQUIRED_USE="prefix? ( fontconfig )"
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}] )"
33 >=virtual/pkgconfig-0-r1[${MULTILIB_USEDEP}]"
35 S="${WORKDIR}/lib${P}"
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"
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
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
66 append-cflags -ffloat-store
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
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.
81 $(use_enable static-libs static)
82 $(use_with fontconfig)
85 $(use_with truetype freetype)
91 ECONF_SOURCE="${S}" econf "${myeconfargs[@]}"
94 multilib_src_install_all() {
96 find "${ED}" -name '*.la' -delete || die