blob: 2ea2c9bd277f7000651b513d121501620c133263 [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
Andrew Geissler1fe918a2020-05-15 14:16:47 -05007DEPENDS = "libtool db libxml2 openssl zlib curl llvm clamav-native libmspack bison-native"
8DEPENDS_class-native = "db-native openssl-native zlib-native llvm-native curl-native bison-native"
Brad Bishopc342db32019-05-15 21:57:59 -04009
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080010LIC_FILES_CHKSUM = "file://COPYING.LGPL;beginline=2;endline=3;md5=4b89c05acc71195e9a06edfa2fa7d092"
11
Brad Bishopa48c0142020-01-06 09:48:41 -050012SRCREV = "482fcd413b07e9fd3ef9850e6d01a45f4e187108"
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080013
Brad Bishopa48c0142020-01-06 09:48:41 -050014SRC_URI = "git://github.com/vrtadmin/clamav-devel;branch=rel/0.101 \
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080015 file://clamd.conf \
16 file://freshclam.conf \
17 file://volatiles.03_clamav \
Brad Bishop95dbbac2019-12-02 13:55:25 -050018 file://tmpfiles.clamav \
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080019 file://${BPN}.service \
Brad Bishopc342db32019-05-15 21:57:59 -040020 file://freshclam-native.conf \
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080021 "
22
23S = "${WORKDIR}/git"
24
25LEAD_SONAME = "libclamav.so"
Brad Bishopa48c0142020-01-06 09:48:41 -050026SO_VER = "9.0.2"
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080027
Andrew Geissler064f75b2020-06-27 00:14:46 -050028inherit autotools pkgconfig useradd systemd multilib_header multilib_script
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080029
Brad Bishopa48c0142020-01-06 09:48:41 -050030CLAMAV_UID ?= "clamav"
31CLAMAV_GID ?= "clamav"
Brad Bishopc342db32019-05-15 21:57:59 -040032INSTALL_CLAMAV_CVD ?= "1"
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080033
Brad Bishopc342db32019-05-15 21:57:59 -040034CLAMAV_USR_DIR = "${STAGING_DIR_NATIVE}/usr"
35CLAMAV_USR_DIR_class-target = "${STAGING_DIR_HOST}/usr"
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080036
Brad Bishopc342db32019-05-15 21:57:59 -040037PACKAGECONFIG_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)}"
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080040
41PACKAGECONFIG[pcre] = "--with-pcre=${STAGING_LIBDIR}, --without-pcre, libpcre"
Brad Bishopa48c0142020-01-06 09:48:41 -050042PACKAGECONFIG[json] = "--with-libjson=${STAGING_LIBDIR}, --without-libjson, json-c,"
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080043PACKAGECONFIG[ipv6] = "--enable-ipv6, --disable-ipv6"
Brad Bishopa48c0142020-01-06 09:48:41 -050044PACKAGECONFIG[bz2] = "--with-libbz2-prefix=${CLAMAV_USR_DIR}, --disable-bzip2, bzip2"
Brad Bishopc342db32019-05-15 21:57:59 -040045PACKAGECONFIG[ncurses] = "--with-libncurses-prefix=${CLAMAV_USR_DIR}, --without-libncurses-prefix, ncurses, "
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080046PACKAGECONFIG[systemd] = "--with-systemdsystemunitdir=${systemd_unitdir}/system/, --without-systemdsystemunitdir, "
47
Andrew Geissler064f75b2020-06-27 00:14:46 -050048MULTILIB_SCRIPTS = "${PN}-dev:${bindir}/clamav-config ${PN}-cvd:${localstatedir}/lib/clamav/mirrors.dat"
49
Brad Bishopc342db32019-05-15 21:57:59 -040050EXTRA_OECONF_CLAMAV = "--without-libcheck-prefix --disable-unrar \
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080051 --disable-mempool \
52 --program-prefix="" \
Brad Bishopa48c0142020-01-06 09:48:41 -050053 --disable-zlib-vcheck \
54 --with-xml=${CLAMAV_USR_DIR} \
55 --with-zlib=${CLAMAV_USR_DIR} \
Brad Bishopc342db32019-05-15 21:57:59 -040056 --with-openssl=${CLAMAV_USR_DIR} \
Brad Bishopa48c0142020-01-06 09:48:41 -050057 --with-libcurl=${CLAMAV_USR_DIR} \
58 --with-system-libmspack=${CLAMAV_USR_DIR} \
59 --with-iconv=no \
60 --enable-check=no \
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080061 "
62
Brad Bishopc342db32019-05-15 21:57:59 -040063EXTRA_OECONF_class-native += "${EXTRA_OECONF_CLAMAV}"
Brad Bishopa48c0142020-01-06 09:48:41 -050064EXTRA_OECONF_class-target += "--with-user=${CLAMAV_UID} --with-group=${CLAMAV_GID} ${EXTRA_OECONF_CLAMAV}"
Brad Bishopc342db32019-05-15 21:57:59 -040065
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080066do_configure () {
Brad Bishop26bdd442019-08-16 17:08:17 -040067 ${S}/configure ${CONFIGUREOPTS} ${EXTRA_OECONF}
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080068}
69
Brad Bishopc342db32019-05-15 21:57:59 -040070do_configure_class-native () {
Brad Bishop26bdd442019-08-16 17:08:17 -040071 ${S}/configure ${CONFIGUREOPTS} ${EXTRA_OECONF}
Brad Bishopc342db32019-05-15 21:57:59 -040072}
73
Brad Bishopc342db32019-05-15 21:57:59 -040074do_compile_append_class-target() {
Brad Bishopc342db32019-05-15 21:57:59 -040075 if [ "${INSTALL_CLAMAV_CVD}" = "1" ]; then
76 bbnote "CLAMAV creating cvd"
Brad Bishopa48c0142020-01-06 09:48:41 -050077 install -d ${S}/clamav_db
Brad Bishopc342db32019-05-15 21:57:59 -040078 ${STAGING_BINDIR_NATIVE}/freshclam --datadir=${S}/clamav_db --config=${WORKDIR}/freshclam-native.conf
79 fi
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080080}
81
Brad Bishopc342db32019-05-15 21:57:59 -040082do_install_append_class-target () {
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080083 install -d ${D}/${sysconfdir}
84 install -d ${D}/${localstatedir}/lib/clamav
85 install -d ${D}${sysconfdir}/clamav ${D}${sysconfdir}/default/volatiles
86
87 install -m 644 ${WORKDIR}/clamd.conf ${D}/${sysconfdir}
88 install -m 644 ${WORKDIR}/freshclam.conf ${D}/${sysconfdir}
89 install -m 0644 ${WORKDIR}/volatiles.03_clamav ${D}${sysconfdir}/default/volatiles/volatiles.03_clamav
90 sed -i -e 's#${STAGING_DIR_HOST}##g' ${D}${libdir}/pkgconfig/libclamav.pc
91 rm ${D}/${libdir}/libclamav.so
Brad Bishopc342db32019-05-15 21:57:59 -040092 install -m 666 ${S}/clamav_db/* ${D}/${localstatedir}/lib/clamav/.
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080093 if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)};then
94 install -D -m 0644 ${WORKDIR}/clamav.service ${D}${systemd_unitdir}/system/clamav.service
Brad Bishop95dbbac2019-12-02 13:55:25 -050095 install -d ${D}${sysconfdir}/tmpfiles.d
96 install -m 0644 ${WORKDIR}/tmpfiles.clamav ${D}${sysconfdir}/tmpfiles.d/clamav.conf
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080097 fi
Andrew Geissler064f75b2020-06-27 00:14:46 -050098 oe_multilib_header clamav-types.h
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080099}
100
101pkg_postinst_ontarget_${PN} () {
Brad Bishop95dbbac2019-12-02 13:55:25 -0500102 if command -v systemd-tmpfiles >/dev/null; then
103 systemd-tmpfiles --create ${sysconfdir}/tmpfiles.d/clamav.conf
104 elif [ -e ${sysconfdir}/init.d/populate-volatile.sh ]; then
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800105 ${sysconfdir}/init.d/populate-volatile.sh update
106 fi
Brad Bishopc342db32019-05-15 21:57:59 -0400107 mkdir -p ${localstatedir}/lib/clamav
Brad Bishopa48c0142020-01-06 09:48:41 -0500108 chown -R ${CLAMAV_UID}:${CLAMAV_GID} ${localstatedir}/lib/clamav
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800109}
110
111
Brad Bishopc342db32019-05-15 21:57:59 -0400112PACKAGES = "${PN} ${PN}-dev ${PN}-dbg ${PN}-daemon ${PN}-doc ${PN}-cvd \
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800113 ${PN}-clamdscan ${PN}-freshclam ${PN}-libclamav ${PN}-staticdev"
114
115FILES_${PN} = "${bindir}/clambc ${bindir}/clamscan ${bindir}/clamsubmit \
116 ${bindir}/*sigtool ${mandir}/man1/clambc* ${mandir}/man1/clamscan* \
117 ${mandir}/man1/sigtool* ${mandir}/man1/clambsubmit* \
118 ${docdir}/clamav/* "
119
120FILES_${PN}-clamdscan = " ${bindir}/clamdscan \
121 ${docdir}/clamdscan/* \
122 ${mandir}/man1/clamdscan* \
123 "
124
125FILES_${PN}-daemon = "${bindir}/clamconf ${bindir}/clamdtop ${sbindir}/clamd \
126 ${mandir}/man1/clamconf* ${mandir}/man1/clamdtop* \
127 ${mandir}/man5/clamd* ${mandir}/man8/clamd* \
128 ${sysconfdir}/clamd.conf* \
129 ${systemd_unitdir}/system/clamav-daemon/* \
130 ${docdir}/clamav-daemon/* ${sysconfdir}/clamav-daemon \
131 ${sysconfdir}/logcheck/ignore.d.server/clamav-daemon "
132
133FILES_${PN}-freshclam = "${bindir}/freshclam \
134 ${sysconfdir}/freshclam.conf* \
135 ${sysconfdir}/clamav ${sysconfdir}/default/volatiles \
Brad Bishop95dbbac2019-12-02 13:55:25 -0500136 ${sysconfdir}/tmpfiles.d/*.conf \
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800137 ${localstatedir}/lib/clamav \
138 ${docdir}/${PN}-freshclam ${mandir}/man1/freshclam.* \
139 ${mandir}/man5/freshclam.conf.* \
140 ${systemd_unitdir}/system/clamav-freshclam.service"
141
142FILES_${PN}-dev = " ${bindir}/clamav-config ${libdir}/*.la \
143 ${libdir}/pkgconfig/*.pc \
144 ${mandir}/man1/clamav-config.* \
145 ${includedir}/*.h ${docdir}/libclamav* "
146
147FILES_${PN}-staticdev = "${libdir}/*.a"
148
Brad Bishopa48c0142020-01-06 09:48:41 -0500149FILES_${PN}-libclamav = "${libdir}/libclamav.so* ${libdir}/libclammspack.so*\
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800150 ${docdir}/libclamav/* "
151
152FILES_${PN}-doc = "${mandir}/man/* \
153 ${datadir}/man/* \
154 ${docdir}/* "
155
Brad Bishopc342db32019-05-15 21:57:59 -0400156FILES_${PN}-cvd = "${localstatedir}/lib/clamav/*.cvd ${localstatedir}/lib/clamav/*.dat"
157
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800158USERADD_PACKAGES = "${PN}"
Brad Bishopa48c0142020-01-06 09:48:41 -0500159GROUPADD_PARAM_${PN} = "--system ${CLAMAV_UID}"
160USERADD_PARAM_${PN} = "--system -g ${CLAMAV_GID} --home-dir \
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800161 ${localstatedir}/spool/${BPN} \
162 --no-create-home --shell /bin/false ${BPN}"
163
164RPROVIDES_${PN} += "${PN}-systemd"
165RREPLACES_${PN} += "${PN}-systemd"
166RCONFLICTS_${PN} += "${PN}-systemd"
167SYSTEMD_SERVICE_${PN} = "${BPN}.service"
168
Brad Bishopa48c0142020-01-06 09:48:41 -0500169RDEPENDS_${PN} = "openssl ncurses-libncurses libxml2 libbz2 ncurses-libtinfo curl libpcre2 clamav-freshclam clamav-libclamav"
Brad Bishopc342db32019-05-15 21:57:59 -0400170RDEPENDS_${PN}_class-native = ""
171
172BBCLASSEXTEND = "native"