clamav: avoid host pickup of libxml2
authorEneas U de Queiroz <cotequeiroz@gmail.com>
Sat, 10 Aug 2019 22:59:47 +0000 (19:59 -0300)
committerJosef Schlehofer <pepe.schlehofer@gmail.com>
Mon, 19 Aug 2019 21:53:40 +0000 (23:53 +0200)
If libxml2 is installed in the host, then the host library is used and
compilation fails.

Signed-off-by: Eneas U de Queiroz <cotequeiroz@gmail.com>
(cherry-picked from 199ccc94756bc6c577bf4be96014c27bf12ea3ef)

net/clamav/Makefile
net/clamav/patches/002-Avoid-libxml-checks-if-disable-xml-is-used.patch [new file with mode: 0644]

index bc399827df24114eb4f7b47cdce4e51ff48dbf43..a7553fa54041fdbe407e6833ff445dce9a151ab3 100644 (file)
@@ -23,6 +23,7 @@ PKG_CPE_ID:=cpe:/a:clamav:clamav
 
 PKG_BUILD_PARALLEL:=1
 PKG_INSTALL:=1
+PKG_FIXUP:=autoreconf
 
 include $(INCLUDE_DIR)/uclibc++.mk
 include $(INCLUDE_DIR)/package.mk
@@ -74,7 +75,6 @@ CONFIGURE_ARGS += \
        --with-openssl="$(STAGING_DIR)/usr/" \
        --with-pcre="$(STAGING_DIR)/usr/" \
        --with-zlib="$(STAGING_DIR)/usr/" \
-       --without-xml \
        --without-iconv \
        --without-libncurses-prefix
 
diff --git a/net/clamav/patches/002-Avoid-libxml-checks-if-disable-xml-is-used.patch b/net/clamav/patches/002-Avoid-libxml-checks-if-disable-xml-is-used.patch
new file mode 100644 (file)
index 0000000..3564c31
--- /dev/null
@@ -0,0 +1,167 @@
+From de943f313fa5c17bf9cbd560a7578796991b24b5 Mon Sep 17 00:00:00 2001
+From: Eneas U de Queiroz <cotequeiroz@gmail.com>
+Date: Sat, 10 Aug 2019 19:43:20 -0300
+Subject: [PATCH] Avoid libxml checks if --disable-xml is used
+
+Signed-off-by: Eneas U de Queiroz <cotequeiroz@gmail.com>
+---
+ m4/reorganization/libs/xml.m4 | 126 +++++++++++++++++-----------------
+ 1 file changed, 62 insertions(+), 64 deletions(-)
+
+diff --git a/m4/reorganization/libs/xml.m4 b/m4/reorganization/libs/xml.m4
+index 77b2c13a8..0709d2914 100644
+--- a/m4/reorganization/libs/xml.m4
++++ b/m4/reorganization/libs/xml.m4
+@@ -12,87 +12,85 @@ if test "X$want_xml" != "Xno"; then
+                     @<:@default=/usr/local or /usr if not found in /usr/local@:>@]),
+     [with_xml_val=$withval]
+   )
+-fi
+-
+-AS_IF([test "x$with_xml_val" = "xno"], [XML_HOME=""],
+-  [test "x$with_xml_val" = "xyes"], [XML_HOME="/usr/local"],
+-  [XML_HOME="$with_xml_val"])
+-AS_IF([test "x$XML_HOME" != "x"], [
+-   AS_IF([test ! -x "$XML_HOME/bin/xml2-config"], [XML_HOME=""])
+-   ])
++  AS_IF([test "x$with_xml_val" = "xno"], [XML_HOME=""],
++    [test "x$with_xml_val" = "xyes"], [XML_HOME="/usr/local"],
++    [XML_HOME="$with_xml_val"])
+-AS_IF([test "x$XML_HOME" = "x" -a "x$with_xml_val" = "xyes"], [
+-   AS_IF([test -x "/usr/bin/xml2-config"], [XML_HOME="/usr"])
+-   ])
++  AS_IF([test "x$XML_HOME" != "x"], [
++     AS_IF([test ! -x "$XML_HOME/bin/xml2-config"], [XML_HOME=""])
++     ])
+-if test "x$XML_HOME" != "x"; then
+-  AC_MSG_RESULT([$XML_HOME])
+-else
+-  AC_MSG_RESULT([not found])
+-fi
++  AS_IF([test "x$XML_HOME" = "x" -a "x$with_xml_val" = "xyes"], [
++     AS_IF([test -x "/usr/bin/xml2-config"], [XML_HOME="/usr"])
++     ])
+-found_xml="no"
+-XMLCONF_VERSION=""
+-XML_CPPFLAGS=""
+-XML_LIBS=""
+-if test "x$XML_HOME" != "x"; then
+-  AC_MSG_CHECKING([xml2-config version])
+-  XMLCONF_VERSION="`$XML_HOME/bin/xml2-config --version`"
+-  if test "x%XMLCONF_VERSION" != "x"; then
+-    AC_MSG_RESULT([$XMLCONF_VERSION])
+-    found_xml="yes"
+-    XML_CPPFLAGS="`$XML_HOME/bin/xml2-config --cflags`"
+-    XML_LIBS="`$XML_HOME/bin/xml2-config --libs`"
+-    AS_ECHO("$XML_CPPFLAGS")
+-    AS_ECHO("$XML_LIBS")
++  if test "x$XML_HOME" != "x"; then
++    AC_MSG_RESULT([$XML_HOME])
+   else
+-    AC_MSG_ERROR([xml2-config failed])
++    AC_MSG_RESULT([not found])
++  fi
++
++  found_xml="no"
++  XMLCONF_VERSION=""
++  XML_CPPFLAGS=""
++  XML_LIBS=""
++  if test "x$XML_HOME" != "x"; then
++    AC_MSG_CHECKING([xml2-config version])
++    XMLCONF_VERSION="`$XML_HOME/bin/xml2-config --version`"
++    if test "x%XMLCONF_VERSION" != "x"; then
++      AC_MSG_RESULT([$XMLCONF_VERSION])
++      found_xml="yes"
++      XML_CPPFLAGS="`$XML_HOME/bin/xml2-config --cflags`"
++      XML_LIBS="`$XML_HOME/bin/xml2-config --libs`"
++      AS_ECHO("$XML_CPPFLAGS")
++      AS_ECHO("$XML_LIBS")
++    else
++      AC_MSG_ERROR([xml2-config failed])
++    fi
+   fi
+-fi
+-working_xml="no"
+-if test "X$found_xml" != "Xno"; then
+-  AC_MSG_CHECKING([for xmlreader.h in $XML_HOME])
++  working_xml="no"
++  if test "X$found_xml" != "Xno"; then
++    AC_MSG_CHECKING([for xmlreader.h in $XML_HOME])
+-  if test ! -f "$XML_HOME/include/libxml2/libxml/xmlreader.h"; then
+-    AC_MSG_RESULT([not found])
+-  else
+-    AC_MSG_RESULT([found])
+-    save_LIBS="$LIBS"
+-    save_CPPFLAGS="$CPPFLAGS"
+-    CPPFLAGS="$CPPFLAGS $XML_CPPFLAGS"
+-    save_LDFLAGS="$LDFLAGS"
+-    LDFLAGS="$LDFLAGS $XML_LIBS"
++    if test ! -f "$XML_HOME/include/libxml2/libxml/xmlreader.h"; then
++      AC_MSG_RESULT([not found])
++    else
++      AC_MSG_RESULT([found])
++      save_LIBS="$LIBS"
++      save_CPPFLAGS="$CPPFLAGS"
++      CPPFLAGS="$CPPFLAGS $XML_CPPFLAGS"
++      save_LDFLAGS="$LDFLAGS"
++      LDFLAGS="$LDFLAGS $XML_LIBS"
+-    AS_ECHO("CPPFLAGS: $CPPFLAGS")
+-    AS_ECHO("LD_FLAGS: $LDFLAGS")
++      AS_ECHO("CPPFLAGS: $CPPFLAGS")
++      AS_ECHO("LD_FLAGS: $LDFLAGS")
+-    AC_CHECK_LIB([xml2], [xmlTextReaderRead], [working_xml="yes"], [working_xml="no"], [$XML_LIBS])
++      AC_CHECK_LIB([xml2], [xmlTextReaderRead], [working_xml="yes"], [working_xml="no"], [$XML_LIBS])
+-    CPPFLAGS="$save_CPPFLAGS"
+-    LDFLAGS="$save_LDFLAGS"
+-    LIBS="$save_LIBS"
++      CPPFLAGS="$save_CPPFLAGS"
++      LDFLAGS="$save_LDFLAGS"
++      LIBS="$save_LIBS"
++    fi
+   fi
+-fi
+-if test "$working_xml" = "yes"; then
+-  AC_DEFINE([HAVE_LIBXML2],1,[Define to 1 if you have the 'libxml2' library (-lxml2).])
+-  AC_SUBST(XML_CPPFLAGS)
+-  AC_SUBST(XML_LIBS)
+-  AC_MSG_NOTICE([Compiling and linking with libxml2 from $XML_HOME])
+-else
+-  if test "$want_xml" = "yes"; then
+-     AC_MSG_ERROR([****** Please install libxml2 packages!])
++  if test "$working_xml" = "yes"; then
++    AC_DEFINE([HAVE_LIBXML2],1,[Define to 1 if you have the 'libxml2' library (-lxml2).])
++    AC_SUBST(XML_CPPFLAGS)
++    AC_SUBST(XML_LIBS)
++    AC_MSG_NOTICE([Compiling and linking with libxml2 from $XML_HOME])
+   else
+-    if test "$want_xml" != "no"; then
++    if test "$want_xml" = "yes"; then
++      AC_MSG_ERROR([****** Please install libxml2 packages!])
++    else
+       AC_MSG_NOTICE([****** libxml2 support unavailable])
+     fi
++    XML_CPPFLAGS=""
++    XML_LIBS=""
++    AC_SUBST(XML_CPPFLAGS)
++    AC_SUBST(XML_LIBS)
+   fi
+-  XML_CPPFLAGS=""
+-  XML_LIBS=""
+-  AC_SUBST(XML_CPPFLAGS)
+-  AC_SUBST(XML_LIBS)
+ fi
+ AM_CONDITIONAL([HAVE_LIBXML2], test "x$HAVE_LIBXML2" = "xyes")
+-- 
+2.21.0
+