buildroot/package/xmlstarlet/xmlstarlet.mk
Romain Naour 0d8247947e package/xmlstarlet: fix host build
Provide the path to HOST_DIR for libxml, libxslt and libiconv like for
the target variant to avoid a build issue on host where /bin is a
symlink to /usr/bin.

Indeed, the configure script use a custom m4 macro XSTAR_LIB_CHECK to
find xml2-config:

XSTAR_LIB_CHECK([LIBXML], [xml2-config])

This macro come from a local m4 file m4/xstar-check-libs.m4 where it
use:

AC_PATH_PROG(LIBXXX()_CONFIG, xxx_config(),
               [], [$LIBXXX()_PREFIX/bin$PATH_SEPARATOR$PATH]

Since no prefix seems to be defined by $LIBXXX()_PREFIX, AC_PATH_PROG
look by itself at /bin/ for xml2-config. So the PATH variable set
by Buildroot containing HOST_DIR/bin is ignored.

The wrong xml2-config is used during the build and the build fail
when no xml2 headers are installed on the host.

Fixes:
src/xml_C14N.c:12:31: fatal errorĀ : libxml/xmlversion.h : No such file or directory
 #include <libxml/xmlversion.h>
                               ^
In file included from src/trans.c:4:0:
src/trans.h:32:30: fatal errorĀ : libxml/xmlmemory.h : No such file or directory
 #include <libxml/xmlmemory.h>

Signed-off-by: Romain Naour <romain.naour@gmail.com>
Cc: Bernd Kuhls <bernd.kuhls@t-online.de>
[Thomas: remove french messages from the commit log, drop
--with-libiconv-prefix option, since we don't have a libiconv
dependency for the host.]
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2017-09-02 23:05:09 +02:00

35 lines
1 KiB
Makefile

################################################################################
#
# xmlstarlet
#
################################################################################
XMLSTARLET_VERSION = 1.6.1
XMLSTARLET_SITE = http://downloads.sourceforge.net/project/xmlstar/xmlstarlet/$(XMLSTARLET_VERSION)
XMLSTARLET_LICENSE = MIT
XMLSTARLET_LICENSE_FILES = COPYING
XMLSTARLET_DEPENDENCIES += libxml2 libxslt \
$(if $(BR2_PACKAGE_LIBICONV),libiconv)
XMLSTARLET_CONF_OPTS += \
--with-libxml-prefix=$(STAGING_DIR)/usr \
--with-libxslt-prefix=$(STAGING_DIR)/usr \
--with-libiconv-prefix=$(STAGING_DIR)/usr
ifeq ($(BR2_STATIC_LIBS),y)
XMLSTARLET_CONF_OPTS += --enable-static-libs
XMLSTARLET_CONF_ENV = LIBS="`$(PKG_CONFIG_HOST_BINARY) --libs libxml-2.0 libexslt`"
else
XMLSTARLET_CONF_OPTS += --disable-static-libs
endif
HOST_XMLSTARLET_DEPENDENCIES += host-libxml2 host-libxslt
HOST_XMLSTARLET_CONF_OPTS += \
--with-libxml-prefix=$(HOST_DIR)/usr \
--with-libxslt-prefix=$(HOST_DIR)/usr
$(eval $(autotools-package))
$(eval $(host-autotools-package))