diff mbox

[08/11] libpng: fix host-libpng build on system on which zlib.h is missing.

Message ID 1342963719-1810-9-git-send-email-s.martin49@gmail.com
State Superseded
Headers show

Commit Message

Samuel Martin July 22, 2012, 1:28 p.m. UTC
This patch ensures libpng.sym is generated using the same zlib.h as the one
used for building binaries.

As a side effect, this patch fix host-libpng build on freshly installed
debian-based systems, on which zlib development data may be not installed.

Signed-off-by: Samuel Martin <s.martin49@gmail.com>

 create mode 100644 package/libpng/libpng-fix-build-if-zlib-h-is-missing-on-the-host.patch

Comments

Thomas Petazzoni July 22, 2012, 2:27 p.m. UTC | #1
Le Sun, 22 Jul 2012 15:28:36 +0200,
Samuel Martin <s.martin49@gmail.com> a écrit :

> +-	$(CPP) @LIBPNG_DEFINES@ $(CPPFLAGS) -DPNG_BUILDSYMS $(srcdir)/png.h | \
> ++	$(CPP) @LIBPNG_DEFINES@ $(CPPFLAGS) $(CFLAGS) -DPNG_BUILDSYMS $(srcdir)/png.h | \

Shouldn't we be passing the right arguments in CPPFLAGS instead?

Thomas
Arnout Vandecappelle July 25, 2012, 5:39 p.m. UTC | #2
On 07/22/12 16:27, Thomas Petazzoni wrote:
> Le Sun, 22 Jul 2012 15:28:36 +0200,
> Samuel Martin<s.martin49@gmail.com>  a écrit :
>
>> +-	$(CPP) @LIBPNG_DEFINES@ $(CPPFLAGS) -DPNG_BUILDSYMS $(srcdir)/png.h | \
>> ++	$(CPP) @LIBPNG_DEFINES@ $(CPPFLAGS) $(CFLAGS) -DPNG_BUILDSYMS $(srcdir)/png.h | \
>
> Shouldn't we be passing the right arguments in CPPFLAGS instead?

  Good point.  HOST_CONFIGURE_OPTS doesn't set CPPFLAGS at all...

  Regards,
  Arnout
Thomas Petazzoni July 25, 2012, 6:19 p.m. UTC | #3
Le Wed, 25 Jul 2012 19:39:46 +0200,
Arnout Vandecappelle <arnout@mind.be> a écrit :

> >> +-	$(CPP) @LIBPNG_DEFINES@ $(CPPFLAGS) -DPNG_BUILDSYMS $(srcdir)/png.h | \
> >> ++	$(CPP) @LIBPNG_DEFINES@ $(CPPFLAGS) $(CFLAGS) -DPNG_BUILDSYMS $(srcdir)/png.h | \
> >
> > Shouldn't we be passing the right arguments in CPPFLAGS instead?
> 
>   Good point.  HOST_CONFIGURE_OPTS doesn't set CPPFLAGS at all...

To what value should we set CPPFLAGS then?

Thomas
diff mbox

Patch

diff --git a/package/libpng/libpng-fix-build-if-zlib-h-is-missing-on-the-host.patch b/package/libpng/libpng-fix-build-if-zlib-h-is-missing-on-the-host.patch
new file mode 100644
index 0000000..4e22498
--- /dev/null
+++ b/package/libpng/libpng-fix-build-if-zlib-h-is-missing-on-the-host.patch
@@ -0,0 +1,47 @@ 
+This patch ensure that '$(O)/host/usr/include' is added to the command generating
+libpng.sym.
+
+This allows building host-libpng on a system missing zlib development data, which
+are provided by '$(O)/host/usr/include' though.
+
+This avoid the following error occurs:
+
+/usr/bin/cpp -DPNG_CONFIGURE_LIBPNG  -DPNG_BUILDSYMS ./png.h | \
+		/bin/sed -n -e \
+		's|^.*PNG_FUNCTION_EXPORT[ 	]*\(['_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789']*\).*$|\1|p' \
+		-e 's|^.*PNG_DATA_EXPORT[ 	]*\(['_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789']*\).*$|\1|p' \
+			>libpng.sym.new
+./png.h:421:18: fatal error: zlib.h: No such file or directory
+[...]
+libtool: link: /usr/bin/gcc -shared  .libs/libpng14_la-png.o .libs/libpng14_la-pngset.o .libs/libpng14_la-pngget.o .libs/libpng14_la-pngrutil.o .libs/libpng14_la-pngtrans.o .libs/libpng14_la-pngwutil.o .libs/libpng14_la-pngread.o .libs/libpng14_la-pngrio.o .libs/libpng14_la-pngwio.o .libs/libpng14_la-pngwrite.o .libs/libpng14_la-pngrtran.o .libs/libpng14_la-pngwtran.o .libs/libpng14_la-pngmem.o .libs/libpng14_la-pngerror.o .libs/libpng14_la-pngpread.o   -L/opt/buildroot/output/host/lib -L/opt/buildroot/output/host/usr/lib -lz -lm  -Wl,--version-script=libpng.vers -Wl,-rpath -Wl,/opt/buildroot/output/host/usr/lib   -Wl,-soname -Wl,libpng14.so.14 -o .libs/libpng14.so.14.11.0
+/usr/bin/ld:libpng.vers:2: syntax error in VERSION script
+collect2: ld returned 1 exit status
+make[2]: *** [libpng14.la] Error 1
+
+Signed-off-by: Samuel Martin <s.martin49@gmail.com>
+
+---
+diff -purN host-libpng-1.4.11.orig/Makefile.am host-libpng-1.4.11/Makefile.am
+--- host-libpng-1.4.11.orig/Makefile.am	2012-07-22 01:06:18.692261599 +0000
++++ host-libpng-1.4.11/Makefile.am	2012-07-22 01:11:59.350414529 +0000
+@@ -95,7 +95,7 @@ $(PNGLIB_BASENAME)-config: libpng-config
+ 
+ libpng.sym: png.h pngconf.h
+ 	rm -f $@ $@.new
+-	$(CPP) @LIBPNG_DEFINES@ $(CPPFLAGS) -DPNG_BUILDSYMS $(srcdir)/png.h | \
++	$(CPP) @LIBPNG_DEFINES@ $(CPPFLAGS) $(CFLAGS) -DPNG_BUILDSYMS $(srcdir)/png.h | \
+ 		$(SED) -n -e \
+ 		's|^.*PNG_FUNCTION_EXPORT[ 	]*\([$(AN)]*\).*$$|$(SYMBOL_PREFIX)\1|p' \
+ 		-e 's|^.*PNG_DATA_EXPORT[ 	]*\([$(AN)]*\).*$$|$(SYMBOL_PREFIX)\1|p' \
+diff -purN host-libpng-1.4.11.orig/Makefile.in host-libpng-1.4.11/Makefile.in
+--- host-libpng-1.4.11.orig/Makefile.in	2012-07-22 01:06:18.692261599 +0000
++++ host-libpng-1.4.11/Makefile.in	2012-07-22 01:12:38.093537811 +0000
+@@ -1214,7 +1214,7 @@ $(PNGLIB_BASENAME)-config: libpng-config
+ 
+ libpng.sym: png.h pngconf.h
+ 	rm -f $@ $@.new
+-	$(CPP) @LIBPNG_DEFINES@ $(CPPFLAGS) -DPNG_BUILDSYMS $(srcdir)/png.h | \
++	$(CPP) @LIBPNG_DEFINES@ $(CPPFLAGS) $(CFLAGS) -DPNG_BUILDSYMS $(srcdir)/png.h | \
+ 		$(SED) -n -e \
+ 		's|^.*PNG_FUNCTION_EXPORT[ 	]*\([$(AN)]*\).*$$|$(SYMBOL_PREFIX)\1|p' \
+ 		-e 's|^.*PNG_DATA_EXPORT[ 	]*\([$(AN)]*\).*$$|$(SYMBOL_PREFIX)\1|p' \
diff --git a/package/libpng/libpng.mk b/package/libpng/libpng.mk
index dd295c6..7b17e72 100644
--- a/package/libpng/libpng.mk
+++ b/package/libpng/libpng.mk
@@ -30,5 +30,7 @@  ifneq ($(BR2_HAVE_DEVFILES),y)
 LIBPNG_POST_INSTALL_TARGET_HOOKS += LIBPNG_REMOVE_CONFIG_SCRIPTS
 endif
 
+HOST_LIBPNG_AUTORECONF = YES
+
 $(eval $(autotools-package))
 $(eval $(host-autotools-package))