summaryrefslogtreecommitdiffstats
path: root/recipes-scanners/clamav
diff options
context:
space:
mode:
authorArmin Kuster <akuster808@gmail.com>2020-03-22 16:20:05 +0000
committerArmin Kuster <akuster808@gmail.com>2021-04-02 08:21:34 -0700
commit90504a2580bc251030b90385cbfe8f4e05c10893 (patch)
tree42c7136ab443031c235b282c6a44bf7e4f09d5d3 /recipes-scanners/clamav
parent44d51ebff55a997ea3cf4503a09963926d4fe0a4 (diff)
downloadmeta-security-90504a2580bc251030b90385cbfe8f4e05c10893.tar.gz
clamav: upgrade 104.0
convert to cmake and general cleanup include on oe env patch and glibc 2.33 header fixup if running w/in qemu, need to add qemuparams="-m 2048" to allow freshclam not to oom Signed-off-by: Armin Kuster <akuster808@gmail.com> --- V2] Bump PV to match what is being d/l
Diffstat (limited to 'recipes-scanners/clamav')
-rw-r--r--recipes-scanners/clamav/clamav_0.104.0.bb (renamed from recipes-scanners/clamav/clamav_0.101.5.bb)101
-rw-r--r--recipes-scanners/clamav/files/headers_fixup.patch58
-rw-r--r--recipes-scanners/clamav/files/oe_cmake_fixup.patch39
3 files changed, 134 insertions, 64 deletions
diff --git a/recipes-scanners/clamav/clamav_0.101.5.bb b/recipes-scanners/clamav/clamav_0.104.0.bb
index 7dad263..9e50466 100644
--- a/recipes-scanners/clamav/clamav_0.101.5.bb
+++ b/recipes-scanners/clamav/clamav_0.104.0.bb
@@ -4,94 +4,68 @@ HOMEPAGE = "http://www.clamav.net/index.html"
4SECTION = "security" 4SECTION = "security"
5LICENSE = "LGPL-2.1" 5LICENSE = "LGPL-2.1"
6 6
7DEPENDS = "libtool db libxml2 openssl zlib curl llvm clamav-native libmspack bison-native" 7DEPENDS = "glibc llvm libtool db openssl zlib curl libxml2 bison pcre2 json-c libcheck"
8DEPENDS_class-native = "db-native openssl-native zlib-native llvm-native curl-native bison-native"
9 8
10LIC_FILES_CHKSUM = "file://COPYING.LGPL;beginline=2;endline=3;md5=4b89c05acc71195e9a06edfa2fa7d092" 9LIC_FILES_CHKSUM = "file://COPYING.txt;beginline=2;endline=3;md5=f7029fbbc5898b273d5902896f7bbe17"
11 10
12SRCREV = "482fcd413b07e9fd3ef9850e6d01a45f4e187108" 11SRCREV = "5553a5e206ceae5d920368baee7d403f823bcb6f"
13 12
14SRC_URI = "git://github.com/vrtadmin/clamav-devel;branch=rel/0.101 \ 13SRC_URI = "git://github.com/vrtadmin/clamav-devel;branch=dev/0.104 \
15 file://clamd.conf \ 14 file://clamd.conf \
16 file://freshclam.conf \ 15 file://freshclam.conf \
17 file://volatiles.03_clamav \ 16 file://volatiles.03_clamav \
18 file://tmpfiles.clamav \ 17 file://tmpfiles.clamav \
19 file://${BPN}.service \ 18 file://${BPN}.service \
20 file://freshclam-native.conf \ 19 file://headers_fixup.patch \
21 " 20 file://oe_cmake_fixup.patch \
22 21"
23S = "${WORKDIR}/git" 22S = "${WORKDIR}/git"
24 23
25LEAD_SONAME = "libclamav.so" 24LEAD_SONAME = "libclamav.so"
26SO_VER = "9.0.4" 25SO_VER = "9.6.0"
26
27BINCONFIG = "${bindir}/clamav-config"
27 28
28inherit autotools pkgconfig useradd systemd multilib_header multilib_script 29inherit cmake chrpath pkgconfig useradd systemd multilib_header multilib_script
29 30
30CLAMAV_UID ?= "clamav" 31CLAMAV_UID ?= "clamav"
31CLAMAV_GID ?= "clamav" 32CLAMAV_GID ?= "clamav"
32INSTALL_CLAMAV_CVD ?= "1"
33
34CLAMAV_USR_DIR = "${STAGING_DIR_NATIVE}/usr"
35CLAMAV_USR_DIR_class-target = "${STAGING_DIR_HOST}/usr"
36
37PACKAGECONFIG_class-target ?= "ncurses bz2"
38PACKAGECONFIG_class-target += " ${@bb.utils.contains("DISTRO_FEATURES", "ipv6", "ipv6", "", d)}"
39PACKAGECONFIG_class-target += "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd', '', d)}"
40
41PACKAGECONFIG[pcre] = "--with-pcre=${STAGING_LIBDIR}, --without-pcre, libpcre"
42PACKAGECONFIG[json] = "--with-libjson=${STAGING_LIBDIR}, --without-libjson, json-c,"
43PACKAGECONFIG[ipv6] = "--enable-ipv6, --disable-ipv6"
44PACKAGECONFIG[bz2] = "--with-libbz2-prefix=${CLAMAV_USR_DIR}, --disable-bzip2, bzip2"
45PACKAGECONFIG[ncurses] = "--with-libncurses-prefix=${CLAMAV_USR_DIR}, --without-libncurses-prefix, ncurses, "
46PACKAGECONFIG[systemd] = "--with-systemdsystemunitdir=${systemd_unitdir}/system/, --without-systemdsystemunitdir, "
47 33
48MULTILIB_SCRIPTS = "${PN}-dev:${bindir}/clamav-config ${PN}-cvd:${localstatedir}/lib/clamav/mirrors.dat" 34MULTILIB_SCRIPTS = "${PN}-dev:${bindir}/clamav-config ${PN}-cvd:${localstatedir}/lib/clamav/mirrors.dat"
49 35
50EXTRA_OECONF_CLAMAV = "--without-libcheck-prefix --disable-unrar \ 36EXTRA_OECMAKE = " -DCMAKE_BUILD_TYPE=Release -DOPTIMIZE=ON -DENABLE_JSON_SHARED=OFF \
51 --disable-mempool \ 37 -DCLAMAV_GROUP=${CLAMAV_GID} -DCLAMAV_USER=${CLAMAV_UID} \
52 --program-prefix="" \ 38 -DENABLE_TESTS=OFF -DBUILD_SHARED_LIBS=ON \
53 --disable-zlib-vcheck \ 39 -DDISABLE_MPOOL=ON -DENABLE_FRESHCLAM_DNS_FIX=ON \
54 --with-xml=${CLAMAV_USR_DIR} \ 40 "
55 --with-zlib=${CLAMAV_USR_DIR} \
56 --with-openssl=${CLAMAV_USR_DIR} \
57 --with-libcurl=${CLAMAV_USR_DIR} \
58 --with-system-libmspack=${CLAMAV_USR_DIR} \
59 --with-iconv=no \
60 --enable-check=no \
61 "
62
63EXTRA_OECONF_class-native += "${EXTRA_OECONF_CLAMAV}"
64EXTRA_OECONF_class-target += "--with-user=${CLAMAV_UID} --with-group=${CLAMAV_GID} ${EXTRA_OECONF_CLAMAV}"
65
66do_configure () {
67 ${S}/configure ${CONFIGUREOPTS} ${EXTRA_OECONF}
68}
69 41
70do_configure_class-native () { 42PACKAGECONFIG ?= " clamonacc \
71 ${S}/configure ${CONFIGUREOPTS} ${EXTRA_OECONF} 43 ${@bb.utils.contains("DISTRO_FEATURES", "systemd", "systemd", "", d)}"
72}
73 44
74do_compile_append_class-target() { 45PACKAGECONFIG[milter] = "-DENABLE_MILTER=ON ,-DENABLE_MILTER=OFF, curl, curl"
75 if [ "${INSTALL_CLAMAV_CVD}" = "1" ]; then 46PACKAGECONFIG[clamonacc] = "-DENABLE_CLAMONACC=ON ,-DENABLE_CLAMONACC=OFF,"
76 bbnote "CLAMAV creating cvd" 47PACKAGECONFIG[unrar] = "-DENABLE_UNRAR=ON ,-DENABLE_UNRAR=OFF,"
77 install -d ${S}/clamav_db 48PACKAGECONFIG[systemd] = "-DENABLE_SYSTEMD=ON -DSYSTEMD_UNIT_DIR=${systemd_system_unitdir}, -DENABLE_SYSTEMD=OFF, systemd"
78 ${STAGING_BINDIR_NATIVE}/freshclam --datadir=${S}/clamav_db --config=${WORKDIR}/freshclam-native.conf 49
79 fi 50export OECMAKE_C_FLAGS += " -I${STAGING_INCDIR} -L ${RECIPE_SYSROOT}${nonarch_libdir} -L${STAGING_LIBDIR} -lpthread"
80}
81 51
82do_install_append_class-target () { 52do_install_append () {
83 install -d ${D}/${sysconfdir} 53 install -d ${D}/${sysconfdir}
84 install -d ${D}/${localstatedir}/lib/clamav 54 install -d ${D}/${localstatedir}/lib/clamav
85 install -d ${D}${sysconfdir}/clamav ${D}${sysconfdir}/default/volatiles 55 install -d ${D}${sysconfdir}/clamav ${D}${sysconfdir}/default/volatiles
86 56
87 install -m 644 ${WORKDIR}/clamd.conf ${D}/${sysconfdir} 57 install -m 644 ${WORKDIR}/clamd.conf ${D}/${prefix}/${sysconfdir}
88 install -m 644 ${WORKDIR}/freshclam.conf ${D}/${sysconfdir} 58 install -m 644 ${WORKDIR}/freshclam.conf ${D}/${prefix}/${sysconfdir}
89 install -m 0644 ${WORKDIR}/volatiles.03_clamav ${D}${sysconfdir}/default/volatiles/03_clamav 59 install -m 0644 ${WORKDIR}/volatiles.03_clamav ${D}${sysconfdir}/default/volatiles/03_clamav
90 sed -i -e 's#${STAGING_DIR_HOST}##g' ${D}${libdir}/pkgconfig/libclamav.pc 60 sed -i -e 's#${STAGING_DIR_HOST}##g' ${D}${libdir}/pkgconfig/libclamav.pc
91 rm ${D}/${libdir}/libclamav.so 61 rm ${D}/${libdir}/libclamav.so
92 if [ "${INSTALL_CLAMAV_CVD}" = "1" ]; then 62 if [ "${INSTALL_CLAMAV_CVD}" = "1" ]; then
93 install -m 666 ${S}/clamav_db/* ${D}/${localstatedir}/lib/clamav/. 63 install -m 666 ${S}/clamav_db/* ${D}/${localstatedir}/lib/clamav/.
94 fi 64 fi
65
66 rm ${D}/${libdir}/libfreshclam.so
67 rm ${D}/${libdir}/libmspack.so
68
95 if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)};then 69 if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)};then
96 install -D -m 0644 ${WORKDIR}/clamav.service ${D}${systemd_unitdir}/system/clamav.service 70 install -D -m 0644 ${WORKDIR}/clamav.service ${D}${systemd_unitdir}/system/clamav.service
97 install -d ${D}${sysconfdir}/tmpfiles.d 71 install -d ${D}${sysconfdir}/tmpfiles.d
@@ -114,10 +88,10 @@ pkg_postinst_ontarget_${PN} () {
114PACKAGES = "${PN} ${PN}-dev ${PN}-dbg ${PN}-daemon ${PN}-doc ${PN}-cvd \ 88PACKAGES = "${PN} ${PN}-dev ${PN}-dbg ${PN}-daemon ${PN}-doc ${PN}-cvd \
115 ${PN}-clamdscan ${PN}-freshclam ${PN}-libclamav ${PN}-staticdev" 89 ${PN}-clamdscan ${PN}-freshclam ${PN}-libclamav ${PN}-staticdev"
116 90
117FILES_${PN} = "${bindir}/clambc ${bindir}/clamscan ${bindir}/clamsubmit \ 91FILES_${PN} = "${bindir}/clambc ${bindir}/clamscan ${bindir}/clamsubmit ${sbindir}/clamonacc \
118 ${bindir}/*sigtool ${mandir}/man1/clambc* ${mandir}/man1/clamscan* \ 92 ${bindir}/*sigtool ${mandir}/man1/clambc* ${mandir}/man1/clamscan* \
119 ${mandir}/man1/sigtool* ${mandir}/man1/clambsubmit* \ 93 ${mandir}/man1/sigtool* ${mandir}/man1/clambsubmit* \
120 ${docdir}/clamav/* " 94 ${docdir}/clamav/* ${libdir}/libmspack* "
121 95
122FILES_${PN}-clamdscan = " ${bindir}/clamdscan \ 96FILES_${PN}-clamdscan = " ${bindir}/clamdscan \
123 ${docdir}/clamdscan/* \ 97 ${docdir}/clamdscan/* \
@@ -128,12 +102,14 @@ FILES_${PN}-daemon = "${bindir}/clamconf ${bindir}/clamdtop ${sbindir}/clamd \
128 ${mandir}/man1/clamconf* ${mandir}/man1/clamdtop* \ 102 ${mandir}/man1/clamconf* ${mandir}/man1/clamdtop* \
129 ${mandir}/man5/clamd* ${mandir}/man8/clamd* \ 103 ${mandir}/man5/clamd* ${mandir}/man8/clamd* \
130 ${sysconfdir}/clamd.conf* \ 104 ${sysconfdir}/clamd.conf* \
105 /usr/etc/clamd.conf* \
131 ${systemd_unitdir}/system/clamav-daemon/* \ 106 ${systemd_unitdir}/system/clamav-daemon/* \
132 ${docdir}/clamav-daemon/* ${sysconfdir}/clamav-daemon \ 107 ${docdir}/clamav-daemon/* ${sysconfdir}/clamav-daemon \
133 ${sysconfdir}/logcheck/ignore.d.server/clamav-daemon " 108 ${sysconfdir}/logcheck/ignore.d.server/clamav-daemon "
134 109
135FILES_${PN}-freshclam = "${bindir}/freshclam \ 110FILES_${PN}-freshclam = "${bindir}/freshclam \
136 ${sysconfdir}/freshclam.conf* \ 111 ${sysconfdir}/freshclam.conf* \
112 /usr/etc/freshclam.conf* \
137 ${sysconfdir}/clamav ${sysconfdir}/default/volatiles \ 113 ${sysconfdir}/clamav ${sysconfdir}/default/volatiles \
138 ${sysconfdir}/tmpfiles.d/*.conf \ 114 ${sysconfdir}/tmpfiles.d/*.conf \
139 ${localstatedir}/lib/clamav \ 115 ${localstatedir}/lib/clamav \
@@ -148,8 +124,8 @@ FILES_${PN}-dev = " ${bindir}/clamav-config ${libdir}/*.la \
148 124
149FILES_${PN}-staticdev = "${libdir}/*.a" 125FILES_${PN}-staticdev = "${libdir}/*.a"
150 126
151FILES_${PN}-libclamav = "${libdir}/libclamav.so* ${libdir}/libclammspack.so*\ 127FILES_${PN}-libclamav = "${libdir}/libclamav.so* ${libdir}/libclammspack.so* \
152 ${docdir}/libclamav/* " 128 ${libdir}/libfreshclam.so* ${docdir}/libclamav/* "
153 129
154FILES_${PN}-doc = "${mandir}/man/* \ 130FILES_${PN}-doc = "${mandir}/man/* \
155 ${datadir}/man/* \ 131 ${datadir}/man/* \
@@ -169,6 +145,3 @@ RCONFLICTS_${PN} += "${PN}-systemd"
169SYSTEMD_SERVICE_${PN} = "${BPN}.service" 145SYSTEMD_SERVICE_${PN} = "${BPN}.service"
170 146
171RDEPENDS_${PN} = "openssl ncurses-libncurses libxml2 libbz2 ncurses-libtinfo curl libpcre2 clamav-freshclam clamav-libclamav" 147RDEPENDS_${PN} = "openssl ncurses-libncurses libxml2 libbz2 ncurses-libtinfo curl libpcre2 clamav-freshclam clamav-libclamav"
172RDEPENDS_${PN}_class-native = ""
173
174BBCLASSEXTEND = "native"
diff --git a/recipes-scanners/clamav/files/headers_fixup.patch b/recipes-scanners/clamav/files/headers_fixup.patch
new file mode 100644
index 0000000..9de0a26
--- /dev/null
+++ b/recipes-scanners/clamav/files/headers_fixup.patch
@@ -0,0 +1,58 @@
1Fixes checks not needed do to glibc 2.33
2
3Upstream-Status: Pending
4Signed-off-by: Armin Kuster <akuster808@gmail.com>
5
6Index: git/CMakeLists.txt
7===================================================================
8--- git.orig/CMakeLists.txt
9+++ git/CMakeLists.txt
10@@ -374,8 +373,6 @@ check_include_file("stdlib.h"
11 check_include_file("string.h" HAVE_STRING_H)
12 check_include_file("strings.h" HAVE_STRINGS_H)
13 check_include_file("sys/cdefs.h" HAVE_SYS_CDEFS_H)
14-check_include_file("sys/dl.h" HAVE_SYS_DL_H)
15-check_include_file("sys/fileio.h" HAVE_SYS_FILIO_H)
16 check_include_file("sys/mman.h" HAVE_SYS_MMAN_H)
17 check_include_file("sys/param.h" HAVE_SYS_PARAM_H)
18 check_include_file("sys/queue.h" HAVE_SYS_QUEUE_H)
19@@ -410,8 +407,6 @@ endif()
20
21 # int-types variants
22 check_include_file("inttypes.h" HAVE_INTTYPES_H)
23-check_include_file("sys/inttypes.h" HAVE_SYS_INTTYPES_H)
24-check_include_file("sys/int_types.h" HAVE_SYS_INT_TYPES_H)
25 check_include_file("stdint.h" HAVE_STDINT_H)
26
27 # this hack required to silence warnings on systems with inttypes.h
28@@ -539,17 +528,11 @@ check_type_size("time_t" SIZEOF_TIME_T)
29 # Checks for library functions.
30 include(CheckSymbolExists)
31 check_symbol_exists(_Exit "stdlib.h" HAVE__EXIT)
32-check_symbol_exists(accept4 "sys/types.h" HAVE_ACCEPT4)
33 check_symbol_exists(snprintf "stdio.h" HAVE_SNPRINTF)
34-check_symbol_exists(stat64 "sys/stat.h" HAVE_STAT64)
35-check_symbol_exists(strcasestr "string.h" HAVE_STRCASESTR)
36 check_symbol_exists(strerror_r "string.h" HAVE_STRERROR_R)
37-check_symbol_exists(strlcat "string.h" HAVE_STRLCAT)
38-check_symbol_exists(strlcpy "string.h" HAVE_STRLCPY)
39 check_symbol_exists(strndup "string.h" HAVE_STRNDUP)
40 check_symbol_exists(strnlen "string.h" HAVE_STRNLEN)
41-check_symbol_exists(strnstr "string.h" HAVE_STRNSTR)
42-check_symbol_exists(sysctlbyname "sysctl.h" HAVE_SYSCTLBYNAME)
43+check_symbol_exists(strcasecmp "string.h" HAVE_STRNCMP)
44 check_symbol_exists(timegm "time.h" HAVE_TIMEGM)
45 check_symbol_exists(vsnprintf "stdio.h" HAVE_VSNPRINTF)
46
47@@ -563,10 +546,9 @@ else()
48 check_symbol_exists(fseeko "stdio.h" HAVE_FSEEKO)
49 check_symbol_exists(getaddrinfo "netdb.h" HAVE_GETADDRINFO)
50 check_symbol_exists(getpagesize "unistd.h" HAVE_GETPAGESIZE)
51- check_symbol_exists(mkstemp "unistd.h" HAVE_MKSTEMP)
52 check_symbol_exists(poll "poll.h" HAVE_POLL)
53- check_symbol_exists(setgroups "unistd.h" HAVE_SETGROUPS)
54 check_symbol_exists(setsid "unistd.h" HAVE_SETSID)
55+ set(HAVE_SYSCONF_SC_PAGESIZE 1)
56 endif()
57
58 include(CheckSymbolExists)
diff --git a/recipes-scanners/clamav/files/oe_cmake_fixup.patch b/recipes-scanners/clamav/files/oe_cmake_fixup.patch
new file mode 100644
index 0000000..b284915
--- /dev/null
+++ b/recipes-scanners/clamav/files/oe_cmake_fixup.patch
@@ -0,0 +1,39 @@
1Issue with rpath including /usr/lib and crosscompile checkes causing oe configure to fail
2
3Use oe's cmake rpath framework and exclude some of the cmake checks that fail in our env
4
5Upstream-Status: Inappropriate [configuration]
6Singed-off-by: Armin Kuster <akuster808@gmail.com>
7
8Index: git/CMakeLists.txt
9===================================================================
10--- git.orig/CMakeLists.txt
11+++ git/CMakeLists.txt
12@@ -162,12 +162,6 @@ endif()
13
14 include(GNUInstallDirs)
15
16-if(CMAKE_INSTALL_FULL_LIBDIR)
17- set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_FULL_LIBDIR}")
18-else()
19- set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
20-endif()
21-
22 if(C_LINUX)
23 if(CMAKE_COMPILER_IS_GNUCXX)
24 # Set _GNU_SOURCE for O_LARGEFILE, O_CLOEXEC, O_DIRECTORY, O_NOFOLLOW, etc flags on older systems
25@@ -512,14 +506,8 @@ include(TestInline)
26 include(CheckFileOffsetBits)
27 # Determine how to pack structs on this platform.
28 include(CheckStructPacking)
29-# Check for signed right shift implementation.
30-include(CheckSignedRightShift)
31 # Check if systtem fts implementation available
32 include(CheckFTS)
33-# Check if uname(2) follows POSIX standard.
34-include(CheckUnamePosix)
35-# Check support for file descriptor passing
36-include(CheckFDPassing)
37
38 # Check if big-endian
39 include(TestBigEndian)