app-antivirus/clamav: Revbump to fix various linking issues
authorLars Wendler <polynomial-c@gentoo.org>
Mon, 25 Nov 2019 16:15:30 +0000 (17:15 +0100)
committerLars Wendler <polynomial-c@gentoo.org>
Mon, 25 Nov 2019 16:27:40 +0000 (17:27 +0100)
- Don't call configure with --with-zlib=/usr or else we end up having
  "-L/usr/lib" in linker flags which breaks 64bit compilations in 17.1
  profiles
- Once again (third time) use pkg-config to check for libxml2 in order
  to avoud automagic and unnecessary linking to dev-libs/icu

Bug: https://bugs.gentoo.org/661328
Closes: https://bugs.gentoo.org/699296
Package-Manager: Portage-2.3.79, Repoman-2.3.18
Signed-off-by: Lars Wendler <polynomial-c@gentoo.org>
app-antivirus/clamav/clamav-0.102.1-r1.ebuild [moved from app-antivirus/clamav/clamav-0.102.1.ebuild with 90% similarity]
app-antivirus/clamav/files/clamav-0.102.1-libxml2_pkgconfig.patch [new file with mode: 0644]

similarity index 90%
rename from app-antivirus/clamav/clamav-0.102.1.ebuild
rename to app-antivirus/clamav/clamav-0.102.1-r1.ebuild
index a3044a08ef94915e81df1ceb32c5ac5163afdb8c..2c69d169341119a1ae9046131112b169a9107f70 100644 (file)
@@ -48,6 +48,7 @@ HTML_DOCS=( docs/html/. )
 
 PATCHES=(
        "${FILESDIR}/${PN}-0.101.2-tinfo.patch" #670729
+       "${FILESDIR}/${PN}-0.102.1-libxml2_pkgconfig.patch" #661328
 )
 
 pkg_setup() {
@@ -79,25 +80,29 @@ src_configure() {
                JSONUSE="--with-libjson=${EPREFIX}/usr"
        fi
 
-       econf \
-               $(use_enable bzip2) \
-               $(use_enable clamdtop) \
-               $(use_enable ipv6) \
-               $(use_enable milter) \
-               $(use_enable static-libs static) \
-               $(use_enable test check) \
-               $(use_with xml) \
-               $(use_with iconv) \
-               ${JSONUSE} \
-               $(use_enable libclamav-only) \
-               --with-system-libmspack \
-               --cache-file="${S}"/config.cache \
-               --disable-experimental \
-               --disable-zlib-vcheck \
-               --enable-id-check \
-               --with-dbdir="${EPREFIX}"/var/lib/clamav \
-               --with-zlib="${EPREFIX}"/usr \
+       local myeconfargs=(
+               $(use_enable bzip2)
+               $(use_enable clamdtop)
+               $(use_enable ipv6)
+               $(use_enable milter)
+               $(use_enable static-libs static)
+               $(use_enable test check)
+               $(use_with xml)
+               $(use_with iconv)
+               ${JSONUSE}
+               $(use_enable libclamav-only)
+               $(use_with !libclamav-only libcurl)
+               --with-system-libmspack
+               --cache-file="${S}"/config.cache
+               --disable-experimental
+               --disable-zlib-vcheck
+               --enable-id-check
+               --with-dbdir="${EPREFIX}"/var/lib/clamav
+               # Don't call --with-zlib=/usr (see bug #699296)
+               --with-zlib
                --disable-llvm
+       )
+       econf "${myeconfargs[@]}"
 }
 
 src_install() {
diff --git a/app-antivirus/clamav/files/clamav-0.102.1-libxml2_pkgconfig.patch b/app-antivirus/clamav/files/clamav-0.102.1-libxml2_pkgconfig.patch
new file mode 100644 (file)
index 0000000..ea39173
--- /dev/null
@@ -0,0 +1,120 @@
+From 25b9fccdae3a05561b6b7c9c82018a9a3dfec819 Mon Sep 17 00:00:00 2001
+From: Lars Wendler <polynomial-c@gentoo.org>
+Date: Mon, 25 Nov 2019 15:54:09 +0100
+Subject: [PATCH] build: Use pkg-config to find libxml2
+
+Otherwise we get unneccesary linkage to icu and other unwanted stuff
+
+Bug: https://bugzilla.clamav.net/show_bug.cgi?id=12202
+Gentoo-bug: https://bugs.gentoo.org/661328
+Signed-off-by: Lars Wendler <polynomial-c@gentoo.org>
+---
+ m4/reorganization/libs/xml.m4 | 82 ++++++-----------------------------
+ 1 file changed, 13 insertions(+), 69 deletions(-)
+
+diff --git a/m4/reorganization/libs/xml.m4 b/m4/reorganization/libs/xml.m4
+index 24f0cfa92..d143e3a47 100644
+--- a/m4/reorganization/libs/xml.m4
++++ b/m4/reorganization/libs/xml.m4
+@@ -4,85 +4,29 @@ AC_ARG_ENABLE([xml],
+ [AS_HELP_STRING([--disable-xml], [do not include DMG and XAR support])],
+ want_xml=$enableval, want_xml="auto")
+-XML_HOME=""
+-xmlconfig=""
+ if test "X$want_xml" != "Xno"; then
+-  AC_MSG_CHECKING([for libxml2 installation])
+-  AC_ARG_WITH([xml],
+-    AS_HELP_STRING([--with-xml@<:@=DIR@:>@], [path to directory containing libxml2 library
+-                    @<:@default=/usr/local or /usr if not found in /usr/local@:>@]),
+-    [with_xml_val=$withval]
+-  )
+-
+-  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$XML_HOME" = "x" -a "x$with_xml_val" = "xyes"], [
+-     AS_IF([test -x "/usr/bin/xml2-config"], [XML_HOME="/usr"])
+-     ])
+-
+-  if test "x$XML_HOME" != "x"; then
+-    AC_MSG_RESULT([$XML_HOME])
+-    with_xml="yes"
+-  else
+-    AC_MSG_RESULT([not found])
+-  fi
+-
+-  found_xml="no"
+-  XMLCONF_VERSION=""
+-  XML_CPPFLAGS=""
+-  XML_LIBS=""
+-  case "$with_xml" in
+-    yes) AC_PATH_PROG([xmlconfig], [xml2-config])
+-        if test "x$xmlconfig" = x ; then
+-            AC_MSG_NOTICE([can not locate xml2-config in PATH, will search default XML_HOME variants])
+-            
+-            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
+-        else
+-            found_xml="yes"
+-            XMLCONF_VERSION="`$xmlconfig --version`"
+-            XML_CPPFLAGS="`$xmlconfig --cflags`"
+-            XML_LIBS="`$xmlconfig --libs`"
+-        fi
+-  esac
++    PKG_CHECK_MODULES([XML], [libxml-2.0],
++      [found_xml=yes],
++      [
++          found_xml=no
++          AS_IF([test "x$want_xml" = xyes],
++              [AC_MSG_ERROR([--enable-xml set but cannot find libxml2])]
++          )
++      ]
++    )
+   working_xml="no"
+   if test "X$found_xml" != "Xno"; then
+-
+-    readerresult=""
+-    if test "x$xmlconfig" = x ; then
+-        readerresult="$XML_HOME/include/libxml2/libxml/xmlreader.h"
+-    else
+-        readerresult="`$xmlconfig --prefix`/include/libxml2/libxml/xmlreader.h"
+-    fi
+-    
++    XML_HOME=$(${PKG_CONFIG} --variable prefix libxml-2.0)
+     AC_MSG_CHECKING([for xmlreader.h in $readerresult])
+-    
+-    if test ! -f "$readerresult"; then
++
++    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"
++      XML_CPPFLAGS="$XML_CFLAGS"
+       CPPFLAGS="$CPPFLAGS $XML_CPPFLAGS"
+       save_LDFLAGS="$LDFLAGS"
+       LDFLAGS="$LDFLAGS $XML_LIBS"
+-- 
+2.24.0
+