freetype: add libpng to freetype-config and freetype2.pc
authorGustavo Zacarias <gustavo@zacarias.com.ar>
Sun, 10 Nov 2013 14:03:09 +0000 (11:03 -0300)
committerPeter Korsgaard <peter@korsgaard.com>
Sun, 10 Nov 2013 21:34:24 +0000 (22:34 +0100)
Add libpng libraries to freetype-config and freetype2.pc when they're
needed to avoid build breakage for other packages.

Patch in a different form is already upstream.

Fixing configure & friends is not so good since autoreconf busts things
up because of the odd way things are done (upstream fixed too it seems).

Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
package/freetype/freetype.mk

index cc5fbf858c94bdd926a95c49f3a805274fa4681f..1e378d31945fa5e80f9c2d9109601af4c0c2660e 100644 (file)
@@ -37,6 +37,7 @@ ifeq ($(BR2_PACKAGE_LIBPNG),y)
 FREETYPE_DEPENDENCIES += libpng
 FREETYPE_CONF_OPT += LIBPNG_CFLAGS="`$(STAGING_DIR)/usr/bin/libpng-config --cflags`" \
        LIBPNG_LDFLAGS="`$(STAGING_DIR)/usr/bin/libpng-config --ldflags`"
+FREETYPE_LIBPNG_LIBS = "`$(STAGING_DIR)/usr/bin/libpng-config --libs`"
 else
 FREETYPE_CONF_OPT += --without-png
 endif
@@ -49,5 +50,14 @@ define FREETYPE_FIX_CONFIG_FILE
 endef
 FREETYPE_POST_INSTALL_STAGING_HOOKS += FREETYPE_FIX_CONFIG_FILE
 
+# libpng isn't included in freetype-config & freetype2.pc :-/
+define FREETYPE_FIX_CONFIG_FILE_LIBS
+       $(SED) "s,^Libs.private:,& $(FREETYPE_LIBPNG_LIBS)," \
+               $(STAGING_DIR)/usr/lib/pkgconfig/freetype2.pc
+       $(SED) "s,-lfreetype,& $(FREETYPE_LIBPNG_LIBS)," \
+               $(STAGING_DIR)/usr/bin/freetype-config
+endef
+FREETYPE_POST_INSTALL_STAGING_HOOKS += FREETYPE_FIX_CONFIG_FILE_LIBS
+
 $(eval $(autotools-package))
 $(eval $(host-autotools-package))