Clean up build system for cross-compile sake.
authorMike Frysinger <vapier@gentoo.org>
Tue, 11 Oct 2005 00:43:05 +0000 (00:43 +0000)
committerMike Frysinger <vapier@gentoo.org>
Tue, 11 Oct 2005 00:43:05 +0000 (00:43 +0000)
Package-Manager: portage-2.0.53_rc4

media-libs/libpng/ChangeLog
media-libs/libpng/Manifest
media-libs/libpng/files/digest-libpng-1.2.8-r1 [new file with mode: 0644]
media-libs/libpng/files/libpng-1.2.8-build.patch [new file with mode: 0644]
media-libs/libpng/files/libpng-1.2.8-strnlen.patch [new file with mode: 0644]
media-libs/libpng/libpng-1.2.8-r1.ebuild [new file with mode: 0644]

index 50b6d0191ad8e3c05b18bc14af6a5f2ce2613752..391828d7b5833cd4a8c450bfebb551057a52dc8d 100644 (file)
@@ -1,6 +1,13 @@
 # ChangeLog for media-libs/libpng
 # Copyright 1999-2005 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/media-libs/libpng/ChangeLog,v 1.68 2005/05/27 21:57:50 vapier Exp $
+# $Header: /var/cvsroot/gentoo-x86/media-libs/libpng/ChangeLog,v 1.69 2005/10/11 00:43:05 vapier Exp $
+
+*libpng-1.2.8-r1 (11 Oct 2005)
+
+  11 Oct 2005; Mike Frysinger <vapier@gentoo.org>
+  +files/libpng-1.2.8-build.patch, +files/libpng-1.2.8-strnlen.patch,
+  +libpng-1.2.8-r1.ebuild:
+  Clean up build system for cross-compile sake.
 
   27 May 2005; Mike Frysinger <vapier@gentoo.org> libpng-1.2.8.ebuild:
   Add support for USE=doc to pull in the manual #94029 by Laurence Withers.
index 73c79c31e6c1edda4d2548d6d50f133496416781..adbf18048c2c7430916ebe57db0640fac08ece60 100644 (file)
@@ -1,6 +1,20 @@
-MD5 a6553f135165f9b702985e52f58ed3c1 ChangeLog 10869
-MD5 9a09f8d531c582e78977dbfd96edc1f2 metadata.xml 164
-MD5 67b7ae796734a04480c98efbb6ee7c06 libpng-1.2.8.ebuild 1813
+-----BEGIN PGP SIGNED MESSAGE-----
+Hash: SHA1
+
+MD5 3dc3e31fcdf329242bc180444a57f30b ChangeLog 11097
+MD5 3338fff0166374e14ae138e6a1f4cd21 files/1.2.7-gentoo.diff 464
 MD5 cfc3cad1942561090fafce6a25a23bf0 files/digest-libpng-1.2.8 127
+MD5 cfc3cad1942561090fafce6a25a23bf0 files/digest-libpng-1.2.8-r1 127
+MD5 f13493ee891ede4548a44ad32d56552f files/libpng-1.2.8-build.patch 1857
+MD5 029ec280f20678b76004c1a0a0270111 files/libpng-1.2.8-strnlen.patch 580
 MD5 7443cfcd027ad293e56ec7bed76ee21c files/macos.patch 589
-MD5 3338fff0166374e14ae138e6a1f4cd21 files/1.2.7-gentoo.diff 464
+MD5 0897ccaeb4909330e541daf8e1da5938 libpng-1.2.8-r1.ebuild 1691
+MD5 67b7ae796734a04480c98efbb6ee7c06 libpng-1.2.8.ebuild 1813
+MD5 9a09f8d531c582e78977dbfd96edc1f2 metadata.xml 164
+-----BEGIN PGP SIGNATURE-----
+Version: GnuPG v1.4.2 (GNU/Linux)
+
+iD8DBQFDSwsMgIKl8Uu19MoRAiTMAJ4zHMjNLzYyQSJhZ0Ae8NMwb2Q84gCfWWaG
+F39Qy55pKonW2ZRrG7fsJlU=
+=feRS
+-----END PGP SIGNATURE-----
diff --git a/media-libs/libpng/files/digest-libpng-1.2.8-r1 b/media-libs/libpng/files/digest-libpng-1.2.8-r1
new file mode 100644 (file)
index 0000000..af44599
--- /dev/null
@@ -0,0 +1,2 @@
+MD5 00cea4539bea4bd34cbf8b82ff9589cd libpng-1.2.8.tar.bz2 384970
+MD5 3c9069aa836541dc0e075187dcb21899 libpng-manual.txt 127770
diff --git a/media-libs/libpng/files/libpng-1.2.8-build.patch b/media-libs/libpng/files/libpng-1.2.8-build.patch
new file mode 100644 (file)
index 0000000..77d186d
--- /dev/null
@@ -0,0 +1,74 @@
+Clean up build system to make cross-compiling easy
+
+--- scripts/makefile.linux
++++ scripts/makefile.linux
+@@ -8,12 +8,12 @@
+ PNGMIN = 1.2.8
+ PNGVER = $(PNGMAJ).$(PNGMIN)
+ 
+-CC=gcc
++CC?=gcc
+ 
+ # where "make install" puts libpng12.a, libpng12.so*,
+ # libpng12/png.h and libpng12/pngconf.h
+ # Prefix must be a full pathname.
+-prefix=/usr/local
++prefix=/usr
+ 
+ # Where the zlib library and include files are located.
+ #ZLIBLIB=/usr/local/lib
+@@ -31,18 +31,25 @@
+ 
+ # for pgcc version 2.95.1, -O3 is buggy; don't use it.
+ 
+-CFLAGS=-I$(ZLIBINC) -Wall -O3 -funroll-loops \
+-      $(ALIGN) # $(WARNMORE) -g -DPNG_DEBUG=5
++CFLAGS += -Wall $(ALIGN) 
++ifneq ($(ZLIBINC),)
++CFLAGS += -I$(ZLIBINC)
++endif
++
++ifneq ($(ZLIBLIB),)
++LDFLAGS += -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB)
++endif
++LDFLAGS    += -lz -lm
++LDFLAGS_A   = $(LDFLAGS) libpng.a
++LDFLAGS_SO  = $(LDFLAGS) -L. -Wl,-rpath,. -lpng12
+ 
+-LDFLAGS=-L. -Wl,-rpath,. -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) -lpng12 -lz -lm
+-LDFLAGS_A=-L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) libpng.a -lz -lm
+-
+-RANLIB=ranlib
++AR?=ar
++RANLIB?=ranlib
+ #RANLIB=echo
+ 
+ INCPATH=$(prefix)/include
+ LIBPATH=$(prefix)/lib
+-MANPATH=$(prefix)/man
++MANPATH=$(prefix)/share/man
+ BINPATH=$(prefix)/bin
+ 
+ # override DESTDIR= on the make install command line to easily support
+@@ -74,7 +81,7 @@
+ all: libpng.a $(LIBNAME).so pngtest pngtest-static libpng.pc libpng-config
+ 
+ libpng.a: $(OBJS)
+-      ar rc $@ $(OBJS)
++      $(AR) rc $@ $(OBJS)
+       $(RANLIB) $@
+ 
+ libpng.pc:
+@@ -104,10 +111,10 @@
+ libpng.so.3.$(PNGMIN): $(OBJSDLL)
+       $(CC) -shared -Wl,-soname,libpng.so.3 \
+       -o libpng.so.3.$(PNGMIN) \
+-      $(OBJSDLL)
++      $(OBJSDLL) $(LDFLAGS)
+ 
+ pngtest: pngtest.o $(LIBNAME).so
+-      $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
++      $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS_SO)
+ 
+ pngtest-static: pngtest.o libpng.a
+       $(CC) -o pngtest-static $(CFLAGS) pngtest.o $(LDFLAGS_A)
diff --git a/media-libs/libpng/files/libpng-1.2.8-strnlen.patch b/media-libs/libpng/files/libpng-1.2.8-strnlen.patch
new file mode 100644 (file)
index 0000000..aed2610
--- /dev/null
@@ -0,0 +1,21 @@
+strnlen is a GNU extension
+
+--- libpng/pngerror.c
++++ libpng/pngerror.c
+@@ -23,6 +23,16 @@
+ png_default_warning PNGARG((png_structp png_ptr,
+   png_const_charp warning_message));
+ 
++#ifndef _GNU_SOURCE 
++size_t strnlen(const char *s, size_t limit)
++{
++   size_t len = 0;
++   while ((len < limit) && (*s++))
++     len++;
++   return len;
++}
++#endif
++
+ /* This function is called whenever there is a fatal error.  This function
+  * should not be changed.  If there is a need to handle errors differently,
+  * you should supply a replacement error function and use png_set_error_fn()
diff --git a/media-libs/libpng/libpng-1.2.8-r1.ebuild b/media-libs/libpng/libpng-1.2.8-r1.ebuild
new file mode 100644 (file)
index 0000000..07660c6
--- /dev/null
@@ -0,0 +1,60 @@
+# Copyright 1999-2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/media-libs/libpng/libpng-1.2.8-r1.ebuild,v 1.1 2005/10/11 00:43:05 vapier Exp $
+
+inherit flag-o-matic eutils toolchain-funcs
+
+DESCRIPTION="Portable Network Graphics library"
+HOMEPAGE="http://www.libpng.org/"
+SRC_URI="mirror://sourceforge/libpng/${P}.tar.bz2
+       doc? ( http://www.libpng.org/pub/png/libpng-manual.txt )"
+
+LICENSE="as-is"
+SLOT="1.2"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc-macos ~ppc64 ~s390 ~sh ~sparc ~x86"
+IUSE="doc"
+
+DEPEND="sys-libs/zlib"
+
+src_unpack() {
+       unpack ${P}.tar.bz2
+       cd "${S}"
+       use doc && cp "${DISTDIR}"/libpng-manual.txt .
+
+       epatch "${FILESDIR}"/1.2.7-gentoo.diff
+       epatch "${FILESDIR}"/${PN}-1.2.8-strnlen.patch
+       epatch "${FILESDIR}"/${PN}-1.2.8-build.patch
+
+       [[ $(gcc-version) == "3.3" || $(gcc-version) == "3.2" ]] \
+               && replace-cpu-flags k6 k6-2 k6-3 i586
+
+       local makefilein
+       case ${CHOST} in
+               *-darwin*) makefilein="scripts/makefile.darwin";;
+               *)         makefilein="scripts/makefile.linux";;
+       esac
+       sed \
+               -e "/^ZLIBLIB=/s:=.*:=:" \
+               -e "/^ZLIBINC=/s:=.*:=:" \
+               -e "/^LIBPATH=/s:/lib:/$(get_libdir):" \
+               -e 's:mkdir:mkdir -p:' \
+               ${makefilein} > Makefile || die
+}
+
+src_compile() {
+       tc-export CC RANLIB AR
+       emake || die "emake failed"
+}
+
+src_install() {
+       make DESTDIR="${D}" install || die
+       dodoc ANNOUNCE CHANGES KNOWNBUG README TODO Y2KINFO
+       use doc && dodoc libpng-manual.txt
+}
+
+pkg_postinst() {
+       # the libpng authors really screwed around between 1.2.1 and 1.2.3
+       if [[ -f ${ROOT}/usr/$(get_libdir)/libpng.so.3.1.2.1 ]] ; then
+               rm -f "${ROOT}"/usr/$(get_libdir)/libpng.so.3.1.2.1
+       fi
+}