summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2011-12-15 16:52:33 +0000
committerMike Frysinger <vapier@gentoo.org>2011-12-15 16:52:33 +0000
commitf5f60a7a978e8d033b1c67cbb67056eb4d419965 (patch)
tree68d1c02db3ffc9c974cd35d980d3b2ba863c2a74 /media-libs/gd
parentold (diff)
downloadgentoo-2-f5f60a7a978e8d033b1c67cbb67056eb4d419965.tar.gz
gentoo-2-f5f60a7a978e8d033b1c67cbb67056eb4d419965.tar.bz2
gentoo-2-f5f60a7a978e8d033b1c67cbb67056eb4d419965.zip
Use libpng's pkg-config files rather than xxx-config scripts.
(Portage version: 2.2.0_alpha79/cvs/Linux x86_64)
Diffstat (limited to 'media-libs/gd')
-rw-r--r--media-libs/gd/ChangeLog6
-rw-r--r--media-libs/gd/files/gd-2.0.35-libpng-pkg-config.patch113
-rw-r--r--media-libs/gd/gd-2.0.35-r3.ebuild28
3 files changed, 126 insertions, 21 deletions
diff --git a/media-libs/gd/ChangeLog b/media-libs/gd/ChangeLog
index 176aaad4439d..5985f399f4c7 100644
--- a/media-libs/gd/ChangeLog
+++ b/media-libs/gd/ChangeLog
@@ -1,6 +1,10 @@
# ChangeLog for media-libs/gd
# Copyright 1999-2011 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/media-libs/gd/ChangeLog,v 1.77 2011/12/15 16:40:57 ssuominen Exp $
+# $Header: /var/cvsroot/gentoo-x86/media-libs/gd/ChangeLog,v 1.78 2011/12/15 16:52:33 vapier Exp $
+
+ 15 Dec 2011; Mike Frysinger <vapier@gentoo.org> gd-2.0.35-r3.ebuild,
+ +files/gd-2.0.35-libpng-pkg-config.patch:
+ Use libpng's pkg-config files rather than xxx-config scripts.
15 Dec 2011; Samuli Suominen <ssuominen@gentoo.org> -gd-2.0.35-r1.ebuild,
-gd-2.0.35-r2.ebuild:
diff --git a/media-libs/gd/files/gd-2.0.35-libpng-pkg-config.patch b/media-libs/gd/files/gd-2.0.35-libpng-pkg-config.patch
new file mode 100644
index 000000000000..4b8971f1e302
--- /dev/null
+++ b/media-libs/gd/files/gd-2.0.35-libpng-pkg-config.patch
@@ -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
diff --git a/media-libs/gd/gd-2.0.35-r3.ebuild b/media-libs/gd/gd-2.0.35-r3.ebuild
index b8efe24f5a9c..bb3f9fb36eca 100644
--- a/media-libs/gd/gd-2.0.35-r3.ebuild
+++ b/media-libs/gd/gd-2.0.35-r3.ebuild
@@ -1,6 +1,6 @@
# 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.10 2011/11/05 18:24:22 armin76 Exp $
+# $Header: /var/cvsroot/gentoo-x86/media-libs/gd/gd-2.0.35-r3.ebuild,v 1.11 2011/12/15 16:52:33 vapier Exp $
EAPI="2"
@@ -17,7 +17,7 @@ IUSE="fontconfig jpeg png static-libs truetype xpm zlib"
RDEPEND="fontconfig? ( media-libs/fontconfig )
jpeg? ( virtual/jpeg )
- png? ( >=media-libs/libpng-1.5:0 )
+ png? ( >=media-libs/libpng-1.2:0 )
truetype? ( >=media-libs/freetype-2.1.5 )
xpm? ( x11-libs/libXpm x11-libs/libXt )
zlib? ( sys-libs/zlib )"
@@ -27,29 +27,17 @@ src_prepare() {
epatch "${FILESDIR}"/${P}-libpng14.patch #305101
epatch "${FILESDIR}"/${P}-maxcolors.patch #292130
epatch "${FILESDIR}"/${P}-fontconfig.patch #363367
-
- # Try libpng15 first, then fallback to plain libpng
- sed -i -e 's:png12:png15:' configure.ac || die
+ epatch "${FILESDIR}"/${P}-libpng-pkg-config.patch
# Avoid programs we never install
- sed -i '/^noinst_PROGRAMS/s:=:=\n___fooooo =:' Makefile.in || die
-
- if ! use png ; then
- sed -i -r \
- -e '/^bin_PROGRAMS/,/^noinst_PROGRAMS/s:(gdparttopng|gdtopng|gd2topng|pngtogd|pngtogd2|webpng)..EXEEXT.::g' \
- Makefile.in || die
- fi
- if ! use zlib ; then
- sed -i -r \
- -e '/^bin_PROGRAMS/,/^noinst_PROGRAMS/s:(gd2topng|gd2copypal|gd2togif|giftogd2|gdparttopng|pngtogd2)..EXEEXT.::g' \
- Makefile.in || die
- fi
+ 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
- eautoconf
- find . -type f -print0 | xargs -0 touch -r configure
+ eautoreconf
}
-usex() { use $1 && echo ${2:-yes} || echo ${3:-no} ; }
src_configure() {
export ac_cv_lib_z_deflate=$(usex zlib)
econf \