Subject: Re: Warning: graphics/png is currently broken
To: NetBSD Packages Technical Discussion List <tech-pkg@netbsd.org>
From: Johnny C. Lam <jlam@pkgsrc.org>
List: tech-pkg
Date: 04/17/2006 17:55:44
--7AUc2qLy4jB3hD7Z
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On Mon, Apr 17, 2006 at 11:46:23AM -0400, Johnny C. Lam wrote:
> Thomas Klausner wrote:
> >On Mon, Apr 17, 2006 at 10:54:48AM -0400, Johnny Lam wrote:
> >>I expect lots of breakage on this one.  How well does the new libpng 
> >>support the deprecated API?  I couldn't find any documentation on how to 
> >>use the deprecated functions.  It looks like maybe we can just pass 
> >>-DPNG_INTERNAL to the compiler to make it use the deprecated functions, 
> >>but I haven't tested this yet.  Since CUPS is breaking, it looks like 
> >>this support isn't so good.
> >
> >If I understand it correctly, the deprecated functions are just
> >not in the library at all. Bernd?
> 
> Maybe the deprecated functions are no longer in the shared library, but 
> perhaps the API is still available in the png.h header if we can somehow 
> activate it.  The question there is how good the support for the 
> deprecated API is, and whether packages will break because the support 
> isn't good.

After some more investigation, it does look like defining PNG_INTERNAL
will cause the deprecated API to be available, so the new PNG is
source-compatible with older versions of PNG.

I've attached a diff to the png package containing my changes.  I
tested this by building cups after adding "USE_OLD_PNG_API" to the
cups Makefile.  I would suggest that we modify packages to set
USE_OLD_PNG_API for now until its proven they build without it.

	Cheers,

	-- Johnny Lam <jlam@pkgsrc.org>

--7AUc2qLy4jB3hD7Z
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="png.diff"

Index: Makefile
===================================================================
RCS file: /cvsroot/pkgsrc/graphics/png/Makefile,v
retrieving revision 1.77
diff -u -r1.77 Makefile
--- Makefile	17 Apr 2006 13:44:46 -0000	1.77
+++ Makefile	17 Apr 2006 17:51:13 -0000
@@ -18,9 +18,12 @@
 PKG_INSTALLATION_TYPES=	overwrite pkgviews
 
 GNU_CONFIGURE=	yes
-PKGCONFIG_OVERRIDE=	scripts/libpng.pc.in
-TEST_TARGET=	test
 USE_LIBTOOL=	yes
+TEST_TARGET=	test
+
+CONFIGURE_ARGS+=	--without-libpng-compat
+
+PKGCONFIG_OVERRIDE=	scripts/libpng.pc.in
 
 SUBST_CLASSES+=		rpathfix
 SUBST_FILES.rpathfix=	scripts/libpng-config.in
@@ -28,15 +31,5 @@
 SUBST_SED.rpathfix=	'/^L_opts=/s|-L\([	 ]*[^	 ]*\)"|${COMPILER_RPATH_FLAG}\1 -L\1"|g'
 SUBST_STAGE.rpathfix=	pre-configure
 
-# highly version dependent -- fix up libtool .la file contents, since
-# just copying a .la file to a new filename is not enough
-# PLIST breakage will show when it needs updating :)
-post-install:
-	cd ${PREFIX}/lib && \
-		${SED} -e 's/png12/png/g' -e 's/0.9.0/3.9.0/' -e 's/so\.0/so\.3/g' \
-			-e 's/libpng.0.dylib/libpng.3.dylib/g' \
-			libpng.la > libpng.la.out && \
-		${MV} libpng.la.out libpng.la
-
 .include "../../devel/zlib/buildlink3.mk"
 .include "../../mk/bsd.pkg.mk"
Index: PLIST
===================================================================
RCS file: /cvsroot/pkgsrc/graphics/png/PLIST,v
retrieving revision 1.9
diff -u -r1.9 PLIST
--- PLIST	16 Apr 2006 23:19:15 -0000	1.9
+++ PLIST	17 Apr 2006 17:51:13 -0000
@@ -1,13 +1,8 @@
 @comment $NetBSD: PLIST,v 1.9 2006/04/16 23:19:15 wiz Exp $
-bin/libpng-config
 bin/libpng12-config
 include/libpng12/png.h
 include/libpng12/pngconf.h
-include/png.h
-include/pngconf.h
-lib/libpng.la
 lib/libpng12.la
-lib/pkgconfig/libpng.pc
 lib/pkgconfig/libpng12.pc
 man/man3/libpng.3
 man/man3/libpngpf.3
Index: buildlink3.mk
===================================================================
RCS file: /cvsroot/pkgsrc/graphics/png/buildlink3.mk,v
retrieving revision 1.13
diff -u -r1.13 buildlink3.mk
--- buildlink3.mk	17 Apr 2006 13:44:46 -0000	1.13
+++ buildlink3.mk	17 Apr 2006 17:51:13 -0000
@@ -11,9 +11,15 @@
 BUILDLINK_PACKAGES+=	png
 
 .if !empty(PNG_BUILDLINK3_MK:M+)
-BUILDLINK_API_DEPENDS.png+=		png>=1.2.4
+BUILDLINK_API_DEPENDS.png+=	png>=1.2.4
 BUILDLINK_ABI_DEPENDS.png?=	png>=1.2.9nb2
 BUILDLINK_PKGSRCDIR.png?=	../../graphics/png
+
+.  if defined(USE_OLD_PNG_API)
+BUILDLINK_INCDIRS.png+=		include/libpng12
+BUILDLINK_TRANSFORM+=		l:png:png12
+.  endif
+
 .endif	# PNG_BUILDLINK3_MK
 
 .include "../../devel/zlib/buildlink3.mk"
Index: distinfo
===================================================================
RCS file: /cvsroot/pkgsrc/graphics/png/distinfo,v
retrieving revision 1.28
diff -u -r1.28 distinfo
--- distinfo	17 Apr 2006 13:44:46 -0000	1.28
+++ distinfo	17 Apr 2006 17:51:13 -0000
@@ -5,3 +5,5 @@
 Size (libpng-1.2.9.tar.bz2) = 618689 bytes
 SHA1 (patch-ab) = 979175c65587686b339a5556e8bcae3be95a07ca
 SHA1 (patch-ae) = a1edc8ea4eb892b67ecc0a96ee1263c532f7d0f2
+SHA1 (patch-ag) = dcfc3d56bc399630f9b761025e42fe904c4b6a7f
+SHA1 (patch-ah) = c44cb9146d37ed5f3ecf1237b60869192a1d22f6
Index: patches/patch-ag
===================================================================
RCS file: patches/patch-ag
diff -N patches/patch-ag
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ patches/patch-ag	17 Apr 2006 17:51:13 -0000
@@ -0,0 +1,13 @@
+$NetBSD$
+
+--- configure.orig	2006-04-14 07:22:51.000000000 -0400
++++ configure
+@@ -20353,7 +20353,7 @@ fi
+ echo "$as_me:$LINENO: checking if libraries can be versioned" >&5
+ echo $ECHO_N "checking if libraries can be versioned... $ECHO_C" >&6
+ GLD=`$LD --help < /dev/null 2>/dev/null | grep version-script`
+-if test "$GLD"; then
++if false && test "$GLD"; then
+     have_ld_version_script=yes
+     echo "$as_me:$LINENO: result: yes" >&5
+ echo "${ECHO_T}yes" >&6
Index: patches/patch-ah
===================================================================
RCS file: patches/patch-ah
diff -N patches/patch-ah
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ patches/patch-ah	17 Apr 2006 17:51:13 -0000
@@ -0,0 +1,22 @@
+$NetBSD$
+
+--- Makefile.in.orig	2006-04-14 07:22:52.000000000 -0400
++++ Makefile.in
+@@ -999,6 +999,8 @@ libpng.vers: libpng.sym
+ 
+ # install the .../include headers as links to the new ones
+ install-data-hook:
++
++install-data-hook-notrun:
+ 	cd $(DESTDIR)$(includedir); rm -f png.h pngconf.h
+ 	cd $(DESTDIR)$(includedir); $(LN_S) $(PNGLIB_BASENAME)/png.h png.h
+ 	cd $(DESTDIR)$(includedir); $(LN_S) $(PNGLIB_BASENAME)/pngconf.h pngconf.h
+@@ -1008,6 +1010,8 @@ install-data-hook:
+ # do evil things to libpng to cause libpng12 to be used, if
+ # the compat library is not being built do nothing.
+ install-exec-hook:
++
++install-exec-hook-notrun:
+ 	cd $(DESTDIR)$(bindir); rm -f libpng-config
+ 	cd $(DESTDIR)$(bindir); $(LN_S) $(PNGLIB_BASENAME)-config libpng-config
+ 	@if test -n "@compatlib@"; then\

--7AUc2qLy4jB3hD7Z--