blob: 7f0433777bfbbcf5ac33196ec50db87ea0557848 [file] [log] [blame]
Brad Bishop1a4b7ee2018-12-16 17:11:34 -08001SUMMARY = "ClamAV anti-virus utility for Unix - command-line interface"
2DESCRIPTION = "ClamAV is an open source antivirus engine for detecting trojans, viruses, malware & other malicious threats."
3HOMEPAGE = "http://www.clamav.net/index.html"
4SECTION = "security"
5LICENSE = "LGPL-2.1"
6
Brad Bishopc342db32019-05-15 21:57:59 -04007DEPENDS = "libtool db libmspack openssl zlib llvm chrpath-replacement-native clamav-native"
8DEPENDS_class-native = "db-native openssl-native zlib-native"
9
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080010LIC_FILES_CHKSUM = "file://COPYING.LGPL;beginline=2;endline=3;md5=4b89c05acc71195e9a06edfa2fa7d092"
11
12SRCREV = "b66e5e27b48c0a07494f9df9b809ed933cede047"
13
14SRC_URI = "git://github.com/vrtadmin/clamav-devel;branch=rel/0.99 \
15 file://clamd.conf \
16 file://freshclam.conf \
17 file://volatiles.03_clamav \
18 file://${BPN}.service \
Brad Bishopc342db32019-05-15 21:57:59 -040019 file://freshclam-native.conf \
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080020 "
21
22S = "${WORKDIR}/git"
23
24LEAD_SONAME = "libclamav.so"
25SO_VER = "7.1.1"
26
27EXTRANATIVEPATH += "chrpath-native"
28
29inherit autotools-brokensep pkgconfig useradd systemd
30
31UID = "clamav"
32GID = "clamav"
Brad Bishopc342db32019-05-15 21:57:59 -040033INSTALL_CLAMAV_CVD ?= "1"
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080034
35# Clamav has a built llvm version 2 but does not build with gcc 6.x,
36# disable the internal one. This is a known issue
Brad Bishop19323692019-04-05 15:28:33 -040037# If you want LLVM support, use the one in core
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080038
Brad Bishopc342db32019-05-15 21:57:59 -040039CLAMAV_USR_DIR = "${STAGING_DIR_NATIVE}/usr"
40CLAMAV_USR_DIR_class-target = "${STAGING_DIR_HOST}/usr"
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080041
Brad Bishopc342db32019-05-15 21:57:59 -040042PACKAGECONFIG_class-target ?= "ncurses bz2"
43PACKAGECONFIG_class-target += " ${@bb.utils.contains("DISTRO_FEATURES", "ipv6", "ipv6", "", d)}"
44PACKAGECONFIG_class-target += "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd', '', d)}"
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080045
46PACKAGECONFIG[pcre] = "--with-pcre=${STAGING_LIBDIR}, --without-pcre, libpcre"
Brad Bishopc342db32019-05-15 21:57:59 -040047PACKAGECONFIG[xml] = "--with-xml=${CLAMAV_USR_DIR}, --disable-xml, libxml2,"
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080048PACKAGECONFIG[json] = "--with-libjson=${STAGING_LIBDIR}, --without-libjson, json,"
49PACKAGECONFIG[curl] = "--with-libcurl=${STAGING_LIBDIR}, --without-libcurl, curl,"
50PACKAGECONFIG[ipv6] = "--enable-ipv6, --disable-ipv6"
Brad Bishopc342db32019-05-15 21:57:59 -040051PACKAGECONFIG[bz2] = "--with-libbz2-prefix=${CLAMAV_USR_DIR}, --without-libbz2-prefix, "
52PACKAGECONFIG[ncurses] = "--with-libncurses-prefix=${CLAMAV_USR_DIR}, --without-libncurses-prefix, ncurses, "
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080053PACKAGECONFIG[systemd] = "--with-systemdsystemunitdir=${systemd_unitdir}/system/, --without-systemdsystemunitdir, "
54
Brad Bishopc342db32019-05-15 21:57:59 -040055EXTRA_OECONF_CLAMAV = "--without-libcheck-prefix --disable-unrar \
56 --with-system-llvm --with-llvm-linking=dynamic --disable-llvm \
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080057 --disable-mempool \
58 --program-prefix="" \
59 --disable-yara \
Brad Bishopc342db32019-05-15 21:57:59 -040060 --disable-xml \
61 --with-openssl=${CLAMAV_USR_DIR} \
62 --with-zlib=${CLAMAV_USR_DIR} --disable-zlib-vcheck \
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080063 "
64
Brad Bishopc342db32019-05-15 21:57:59 -040065EXTRA_OECONF_class-native += "${EXTRA_OECONF_CLAMAV}"
66EXTRA_OECONF_class-target += "--with-user=${UID} --with-group=${GID} --disable-rpath ${EXTRA_OECONF_CLAMAV}"
67
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080068do_configure () {
Brad Bishop26bdd442019-08-16 17:08:17 -040069 ${S}/configure ${CONFIGUREOPTS} ${EXTRA_OECONF}
Brad Bishopc342db32019-05-15 21:57:59 -040070 install -d ${S}/clamav_db
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080071}
72
Brad Bishopc342db32019-05-15 21:57:59 -040073do_configure_class-native () {
Brad Bishop26bdd442019-08-16 17:08:17 -040074 ${S}/configure ${CONFIGUREOPTS} ${EXTRA_OECONF}
Brad Bishopc342db32019-05-15 21:57:59 -040075}
76
77
78do_compile_append_class-target() {
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080079 # brute force removing RPATH
80 chrpath -d ${B}/libclamav/.libs/libclamav.so.${SO_VER}
81 chrpath -d ${B}/sigtool/.libs/sigtool
82 chrpath -d ${B}/clambc/.libs/clambc
83 chrpath -d ${B}/clamscan/.libs/clamscan
84 chrpath -d ${B}/clamconf/.libs/clamconf
85 chrpath -d ${B}/clamd/.libs/clamd
86 chrpath -d ${B}/freshclam/.libs/freshclam
Brad Bishopc342db32019-05-15 21:57:59 -040087
88 if [ "${INSTALL_CLAMAV_CVD}" = "1" ]; then
89 bbnote "CLAMAV creating cvd"
90 ${STAGING_BINDIR_NATIVE}/freshclam --datadir=${S}/clamav_db --config=${WORKDIR}/freshclam-native.conf
91 fi
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080092}
93
Brad Bishopc342db32019-05-15 21:57:59 -040094do_install_append_class-target () {
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080095 install -d ${D}/${sysconfdir}
96 install -d ${D}/${localstatedir}/lib/clamav
97 install -d ${D}${sysconfdir}/clamav ${D}${sysconfdir}/default/volatiles
98
99 install -m 644 ${WORKDIR}/clamd.conf ${D}/${sysconfdir}
100 install -m 644 ${WORKDIR}/freshclam.conf ${D}/${sysconfdir}
101 install -m 0644 ${WORKDIR}/volatiles.03_clamav ${D}${sysconfdir}/default/volatiles/volatiles.03_clamav
102 sed -i -e 's#${STAGING_DIR_HOST}##g' ${D}${libdir}/pkgconfig/libclamav.pc
103 rm ${D}/${libdir}/libclamav.so
Brad Bishopc342db32019-05-15 21:57:59 -0400104 install -m 666 ${S}/clamav_db/* ${D}/${localstatedir}/lib/clamav/.
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800105 if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)};then
106 install -D -m 0644 ${WORKDIR}/clamav.service ${D}${systemd_unitdir}/system/clamav.service
107 fi
108}
109
110pkg_postinst_ontarget_${PN} () {
111 if [ -e /etc/init.d/populate-volatile.sh ] ; then
112 ${sysconfdir}/init.d/populate-volatile.sh update
113 fi
Brad Bishopc342db32019-05-15 21:57:59 -0400114 mkdir -p ${localstatedir}/lib/clamav
115 chown -R ${UID}:${GID} ${localstatedir}/lib/clamav
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800116}
117
118
Brad Bishopc342db32019-05-15 21:57:59 -0400119PACKAGES = "${PN} ${PN}-dev ${PN}-dbg ${PN}-daemon ${PN}-doc ${PN}-cvd \
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800120 ${PN}-clamdscan ${PN}-freshclam ${PN}-libclamav ${PN}-staticdev"
121
122FILES_${PN} = "${bindir}/clambc ${bindir}/clamscan ${bindir}/clamsubmit \
123 ${bindir}/*sigtool ${mandir}/man1/clambc* ${mandir}/man1/clamscan* \
124 ${mandir}/man1/sigtool* ${mandir}/man1/clambsubmit* \
125 ${docdir}/clamav/* "
126
127FILES_${PN}-clamdscan = " ${bindir}/clamdscan \
128 ${docdir}/clamdscan/* \
129 ${mandir}/man1/clamdscan* \
130 "
131
132FILES_${PN}-daemon = "${bindir}/clamconf ${bindir}/clamdtop ${sbindir}/clamd \
133 ${mandir}/man1/clamconf* ${mandir}/man1/clamdtop* \
134 ${mandir}/man5/clamd* ${mandir}/man8/clamd* \
135 ${sysconfdir}/clamd.conf* \
136 ${systemd_unitdir}/system/clamav-daemon/* \
137 ${docdir}/clamav-daemon/* ${sysconfdir}/clamav-daemon \
138 ${sysconfdir}/logcheck/ignore.d.server/clamav-daemon "
139
140FILES_${PN}-freshclam = "${bindir}/freshclam \
141 ${sysconfdir}/freshclam.conf* \
142 ${sysconfdir}/clamav ${sysconfdir}/default/volatiles \
143 ${localstatedir}/lib/clamav \
144 ${docdir}/${PN}-freshclam ${mandir}/man1/freshclam.* \
145 ${mandir}/man5/freshclam.conf.* \
146 ${systemd_unitdir}/system/clamav-freshclam.service"
147
148FILES_${PN}-dev = " ${bindir}/clamav-config ${libdir}/*.la \
149 ${libdir}/pkgconfig/*.pc \
150 ${mandir}/man1/clamav-config.* \
151 ${includedir}/*.h ${docdir}/libclamav* "
152
153FILES_${PN}-staticdev = "${libdir}/*.a"
154
155FILES_${PN}-libclamav = "${libdir}/libclamav.so* ${libdir}/libmspack.so*\
156 ${docdir}/libclamav/* "
157
158FILES_${PN}-doc = "${mandir}/man/* \
159 ${datadir}/man/* \
160 ${docdir}/* "
161
Brad Bishopc342db32019-05-15 21:57:59 -0400162FILES_${PN}-cvd = "${localstatedir}/lib/clamav/*.cvd ${localstatedir}/lib/clamav/*.dat"
163
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800164USERADD_PACKAGES = "${PN}"
165GROUPADD_PARAM_${PN} = "--system ${UID}"
166USERADD_PARAM_${PN} = "--system -g ${GID} --home-dir \
167 ${localstatedir}/spool/${BPN} \
168 --no-create-home --shell /bin/false ${BPN}"
169
170RPROVIDES_${PN} += "${PN}-systemd"
171RREPLACES_${PN} += "${PN}-systemd"
172RCONFLICTS_${PN} += "${PN}-systemd"
173SYSTEMD_SERVICE_${PN} = "${BPN}.service"
174
Brad Bishopc342db32019-05-15 21:57:59 -0400175RDEPENDS_${PN} = "openssl ncurses-libncurses libbz2 ncurses-libtinfo clamav-freshclam clamav-libclamav"
176RDEPENDS_${PN}_class-native = ""
177
178BBCLASSEXTEND = "native"