gd: import latest stable from upstream

Our local copy of gd just contains a cross-compile fix which has been
redone upstream.  So import that to drop our local copy.

Note: no board tests have been done as this package doesn't seem to
get used anywhere that I can see.

BUG=chromium-os:24041
TEST=`emerge gd` works
TEST=`emerge-arm-generic gd` works
TEST=`emerge-amd64-generic gd` works
TEST=`emerge-x86-generic gd` works

Change-Id: I59e721717fb477b3adbda255d5cccea38159d333
Reviewed-on: https://gerrit.chromium.org/gerrit/12988
Reviewed-by: David James <davidjames@chromium.org>
Commit-Ready: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
This commit is contained in:
Mike Frysinger 2011-12-15 11:53:16 -05:00 committed by Gerrit
parent c7807e7abd
commit df0e294185
5 changed files with 232 additions and 0 deletions

View File

@ -0,0 +1,25 @@
fix from upstream
http://bugs.gentoo.org/363367
# HG changeset patch
# User tabe
# Date 1239812355 0
# Node ID 3ea283efcdafcb2acc1dd0ace1d3d48da6d8cec8
# Parent 4f29a877875f63cee5a64e7bea406a61882a565e
fixed FS#199
199, Fixed useFontConfig() to work as documented (Ethan Merritt)
diff -r 4f29a877875f -r 3ea283efcdaf src/gdft.c
--- a/src/gdft.c Sat Apr 04 12:00:37 2009 +0000
+++ b/src/gdft.c Wed Apr 15 16:19:15 2009 +0000
@@ -1688,7 +1688,7 @@
BGD_DECLARE(int) gdFTUseFontConfig(int flag)
{
#ifdef HAVE_LIBFONTCONFIG
- fontConfigFlag = 1;
+ fontConfigFlag = flag;
return 1;
#else
return 0;

View File

@ -0,0 +1,113 @@
use libpng's pkg-config files rather than the ugly xxx-config scripts
--- a/configure.ac
+++ b/configure.ac
@@ -47,6 +47,7 @@ AC_PROG_LIBTOOL
AC_PROG_LN_S
AC_PROG_MAKE_SET
#AC_PROG_RANLIB
+PKG_PROG_PKG_CONFIG
dnl may be required for freetype and Xpm
AC_PATH_X
@@ -340,74 +341,26 @@ AC_CHECK_LIB(z,deflate,
dnl libpng is required
AC_ARG_WITH(png,dnl
[ --with-png=DIR where to find the png library],,
- withval=yes)
-
-# libpng12.so is a nightmare. We have to test separately for
-# libpng12-config and libpng-config. If we find libpng12-config,
-# we don't look for the other, which will just be a symlink to it,
-# confusing autoconf into thinking the library itself will be named -lpng,
-# which it won't be. Awful. This code will suffice unless the libpng
-# authors decide to do this AGAIN. Which I really hope they won't. TBB
-
-if test "$withval" != no; then
- AC_PATH_PROG([LIBPNG12_CONFIG], [libpng12-config])
- AC_PATH_PROG([LIBPNG_CONFIG], [libpng-config])
- if test -n "$LIBPNG12_CONFIG"; then
- libpng_CPPFLAGS=`libpng12-config --cflags`
- # should be --ldopts, but it's currently broken
- libpng_LDFLAGS=`libpng12-config --ldflags`
- libpng_LDFLAGS=`echo " $libpng_LDFLAGS" | sed 's/ -l[[^ ]][[^ ]]*//g'`
- elif test -n "$LIBPNG_CONFIG"; then
- libpng_CPPFLAGS=`libpng-config --cflags`
- # should be --ldopts, but it's currently broken
- libpng_LDFLAGS=`libpng-config --ldflags`
- libpng_LDFLAGS=`echo " $libpng_LDFLAGS" | sed 's/ -l[[^ ]][[^ ]]*//g'`
- elif test -d "$withval"; then
- libpng_CPPFLAGS="-I$withval/include"
- libpng_LDFLAGS="-L$withval/lib"
- fi
-
- AC_CHECK_HEADERS(png.h,,
- [AC_CHECK_HEADERS(libpng/png.h,
- [CPPFLAGS="$CPPFLAGS $libpng_CPPFLAGS/libpng"],
- [CPPFLAGS="$_cppflags"])])
-
- _ldflags="$LDFLAGS"
- LDFLAGS="$libpng_LDFLAGS $LDFLAGS"
-
- if test -n "$LIBPNG12_CONFIG"; then
- AC_CHECK_LIB(png12,png_create_read_struct,
- [LIBS="-lpng12 $LIBS"
- FEATURES="GD_PNG $FEATURES"
- AC_DEFINE(HAVE_LIBPNG, 1, [ Define if you have the png library. ])],
- [LDFLAGS="$_ldflags"
- AC_MSG_WARN([libpng is required - see http://www.libpng.org/pub/png/])])
- elif test -n "$LIBPNG_CONFIG"; then
- AC_CHECK_LIB(png,png_create_read_struct,
- [LIBS="-lpng $LIBS"
- FEATURES="GD_PNG $FEATURES"
- AC_DEFINE(HAVE_LIBPNG, 1, [ Define if you have the png library. ])],
- [LDFLAGS="$_ldflags"
- AC_MSG_WARN([libpng is required - see http://www.libpng.org/pub/png/])])
- else
- AC_CHECK_LIB(png,png_create_read_struct,
- [LIBS="-lpng $LIBS"
- FEATURES="GD_PNG $FEATURES"
- AC_DEFINE(HAVE_LIBPNG, 1, [ Define if you have the png library. ])],
- [LDFLAGS="$_ldflags"
- AC_MSG_WARN([libpng is required - see http://www.libpng.org/pub/png/])])
- fi
-else
- ac_cv_lib_png_png_create_read_struct=no
+ with_png=detect)
+
+if test "$with_png" != no; then
+ PKG_CHECK_MODULES([LIBPNG], libpng, [
+ FEATURES="GD_PNG $FEATURES"
+ AC_DEFINE(HAVE_LIBPNG, 1, [ Define if you have the png library. ])
+ CPPFLAGS="$CPPFLAGS $LIBPNG_CFLAGS"
+ LDFLAGS="$LDFLAGS $LIBPNG_LIBS"
+ with_png=yes
+ ],[
+ if test "$with_png" = yes; then
+ AC_MSG_ERROR([png support requested, but not found])
+ fi
+ with_png=no
+ ])
+fi
+if test "$with_png" = no; then
AC_MSG_WARN([libpng is required - see http://www.libpng.org/pub/png/])
fi
-#TBB: png12's png_create_read_struct is just as good
-#2.0.23: should be = not ==
-if test "$ac_cv_lib_png12_png_create_read_struct" = yes; then
- ac_cv_lib_png_png_create_read_struct=yes
-fi
-
dnl FreeType configure tests snarfed from libwmf ..
AC_ARG_WITH(freetype,dnl
[ --with-freetype=DIR where to find the freetype 2.x library],
@@ -528,7 +481,7 @@ dnl report configuration
AC_MSG_RESULT([
** Configuration summary for $PACKAGE $VERSION:
- Support for PNG library: $ac_cv_lib_png_png_create_read_struct
+ Support for PNG library: $with_png
Support for JPEG library: $ac_cv_lib_jpeg_jpeg_set_defaults
Support for Freetype 2.x library: $ac_cv_lib_freetype_FT_Init_FreeType
Support for Fontconfig library: $ac_cv_lib_fontconfig_FcInit

View File

@ -0,0 +1,16 @@
http://bugs.gentoo.org/305101
http://repos.archlinux.org/wsvn/packages/gd/trunk/libpng14.patch
patch in upstream repo already
--- gd_png.c
+++ gd_png.c
@@ -149,7 +149,7 @@
return NULL;
}
- if (!png_check_sig (sig, 8)) { /* bad signature */
+ if (png_sig_cmp (sig, 0, 8)) { /* bad signature */
return NULL; /* bad signature */
}

View File

@ -0,0 +1,17 @@
http://bugs.gentoo.org/292130
fix in usptream repo already
--- gd-2.0.35/gd_gd.c
+++ gd-2.0.35/gd_gd.c
@@ -44,6 +44,10 @@
{
goto fail1;
}
+ if (im->colorsTotal > gdMaxColors)
+ {
+ goto fail1;
+ }
}
/* Int to accommodate truecolor single-color transparency */
if (!gdGetInt (&im->transparent, in))

View File

@ -0,0 +1,61 @@
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/media-libs/gd/gd-2.0.35-r3.ebuild,v 1.12 2011/12/15 17r Exp $
EAPI="2"
inherit autotools eutils
DESCRIPTION="A graphics library for fast image creation"
HOMEPAGE="http://libgd.org/ http://www.boutell.com/gd/"
SRC_URI="http://libgd.org/releases/${P}.tar.bz2"
LICENSE="|| ( as-is BSD )"
SLOT="2"
KEYWORDS="alpha amd64 arm hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~sparc-fbsd ~x86-fbsd"
IUSE="fontconfig jpeg png static-libs truetype xpm zlib"
RDEPEND="fontconfig? ( media-libs/fontconfig )
jpeg? ( virtual/jpeg )
png? ( >=media-libs/libpng-1.2 )
truetype? ( >=media-libs/freetype-2.1.5 )
xpm? ( x11-libs/libXpm x11-libs/libXt )
zlib? ( sys-libs/zlib )"
DEPEND="${RDEPEND}"
src_prepare() {
epatch "${FILESDIR}"/${P}-libpng14.patch #305101
epatch "${FILESDIR}"/${P}-maxcolors.patch #292130
epatch "${FILESDIR}"/${P}-fontconfig.patch #363367
epatch "${FILESDIR}"/${P}-libpng-pkg-config.patch
# Avoid programs we never install
local make_sed=( -e '/^noinst_PROGRAMS/s:noinst:check:' )
use png || make_sed+=( -e '/_PROGRAMS/s:(gdparttopng|gdtopng|gd2topng|pngtogd|pngtogd2|webpng)::g' )
use zlib || make_sed+=( -e '/_PROGRAMS/s:(gd2topng|gd2copypal|gd2togif|giftogd2|gdparttopng|pngtogd2)::g' )
sed -i "${make_sed[@]}" Makefile.am || die
eautoreconf
}
src_configure() {
export ac_cv_lib_z_deflate=$(usex zlib)
# we aren't actually {en,dis}abling X here ... the configure
# script uses it just to add explicit -I/-L paths which we
# don't care about on Gentoo systems.
econf \
--without-x \
$(use_enable static-libs static) \
$(use_with fontconfig) \
$(use_with png) \
$(use_with truetype freetype) \
$(use_with jpeg) \
$(use_with xpm)
}
src_install() {
emake DESTDIR="${D}" install || die
dodoc INSTALL README*
dohtml -r ./
use static-libs || rm -f "${D}"/usr/*/libgd.la
}