blob: 47fbae49ff94247ece8c3e5b3b9bb88f965d803e [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"
Andrew Geisslercc589282020-09-18 13:34:40 -050026SO_VER = "9.0.4"
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
Andrew Geisslerb2fe8632020-08-21 15:57:21 -050092 if [ "${INSTALL_CLAMAV_CVD}" = "1" ]; then
93 install -m 666 ${S}/clamav_db/* ${D}/${localstatedir}/lib/clamav/.
94 fi
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080095 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
Brad Bishop95dbbac2019-12-02 13:55:25 -050097 install -d ${D}${sysconfdir}/tmpfiles.d
98 install -m 0644 ${WORKDIR}/tmpfiles.clamav ${D}${sysconfdir}/tmpfiles.d/clamav.conf
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080099 fi
Andrew Geissler064f75b2020-06-27 00:14:46 -0500100 oe_multilib_header clamav-types.h
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800101}
102
103pkg_postinst_ontarget_${PN} () {
Brad Bishop95dbbac2019-12-02 13:55:25 -0500104 if command -v systemd-tmpfiles >/dev/null; then
105 systemd-tmpfiles --create ${sysconfdir}/tmpfiles.d/clamav.conf
106 elif [ -e ${sysconfdir}/init.d/populate-volatile.sh ]; then
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800107 ${sysconfdir}/init.d/populate-volatile.sh update
108 fi
Brad Bishopc342db32019-05-15 21:57:59 -0400109 mkdir -p ${localstatedir}/lib/clamav
Brad Bishopa48c0142020-01-06 09:48:41 -0500110 chown -R ${CLAMAV_UID}:${CLAMAV_GID} ${localstatedir}/lib/clamav
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800111}
112
113
Brad Bishopc342db32019-05-15 21:57:59 -0400114PACKAGES = "${PN} ${PN}-dev ${PN}-dbg ${PN}-daemon ${PN}-doc ${PN}-cvd \
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800115 ${PN}-clamdscan ${PN}-freshclam ${PN}-libclamav ${PN}-staticdev"
116
117FILES_${PN} = "${bindir}/clambc ${bindir}/clamscan ${bindir}/clamsubmit \
118 ${bindir}/*sigtool ${mandir}/man1/clambc* ${mandir}/man1/clamscan* \
119 ${mandir}/man1/sigtool* ${mandir}/man1/clambsubmit* \
120 ${docdir}/clamav/* "
121
122FILES_${PN}-clamdscan = " ${bindir}/clamdscan \
123 ${docdir}/clamdscan/* \
124 ${mandir}/man1/clamdscan* \
125 "
126
127FILES_${PN}-daemon = "${bindir}/clamconf ${bindir}/clamdtop ${sbindir}/clamd \
128 ${mandir}/man1/clamconf* ${mandir}/man1/clamdtop* \
129 ${mandir}/man5/clamd* ${mandir}/man8/clamd* \
130 ${sysconfdir}/clamd.conf* \
131 ${systemd_unitdir}/system/clamav-daemon/* \
132 ${docdir}/clamav-daemon/* ${sysconfdir}/clamav-daemon \
133 ${sysconfdir}/logcheck/ignore.d.server/clamav-daemon "
134
135FILES_${PN}-freshclam = "${bindir}/freshclam \
136 ${sysconfdir}/freshclam.conf* \
137 ${sysconfdir}/clamav ${sysconfdir}/default/volatiles \
Brad Bishop95dbbac2019-12-02 13:55:25 -0500138 ${sysconfdir}/tmpfiles.d/*.conf \
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800139 ${localstatedir}/lib/clamav \
140 ${docdir}/${PN}-freshclam ${mandir}/man1/freshclam.* \
141 ${mandir}/man5/freshclam.conf.* \
142 ${systemd_unitdir}/system/clamav-freshclam.service"
143
144FILES_${PN}-dev = " ${bindir}/clamav-config ${libdir}/*.la \
145 ${libdir}/pkgconfig/*.pc \
146 ${mandir}/man1/clamav-config.* \
147 ${includedir}/*.h ${docdir}/libclamav* "
148
149FILES_${PN}-staticdev = "${libdir}/*.a"
150
Brad Bishopa48c0142020-01-06 09:48:41 -0500151FILES_${PN}-libclamav = "${libdir}/libclamav.so* ${libdir}/libclammspack.so*\
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800152 ${docdir}/libclamav/* "
153
154FILES_${PN}-doc = "${mandir}/man/* \
155 ${datadir}/man/* \
156 ${docdir}/* "
157
Brad Bishopc342db32019-05-15 21:57:59 -0400158FILES_${PN}-cvd = "${localstatedir}/lib/clamav/*.cvd ${localstatedir}/lib/clamav/*.dat"
159
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800160USERADD_PACKAGES = "${PN}"
Brad Bishopa48c0142020-01-06 09:48:41 -0500161GROUPADD_PARAM_${PN} = "--system ${CLAMAV_UID}"
162USERADD_PARAM_${PN} = "--system -g ${CLAMAV_GID} --home-dir \
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800163 ${localstatedir}/spool/${BPN} \
164 --no-create-home --shell /bin/false ${BPN}"
165
166RPROVIDES_${PN} += "${PN}-systemd"
167RREPLACES_${PN} += "${PN}-systemd"
168RCONFLICTS_${PN} += "${PN}-systemd"
169SYSTEMD_SERVICE_${PN} = "${BPN}.service"
170
Brad Bishopa48c0142020-01-06 09:48:41 -0500171RDEPENDS_${PN} = "openssl ncurses-libncurses libxml2 libbz2 ncurses-libtinfo curl libpcre2 clamav-freshclam clamav-libclamav"
Brad Bishopc342db32019-05-15 21:57:59 -0400172RDEPENDS_${PN}_class-native = ""
173
174BBCLASSEXTEND = "native"