blob: a4c32e1a669d6f65f6587dcb82c964d5b4a29c61 [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 Bishopa48c0142020-01-06 09:48:41 -05007DEPENDS = "libtool db libxml2 openssl zlib curl llvm clamav-native libmspack"
8DEPENDS_class-native = "db-native openssl-native zlib-native llvm-native curl-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
Brad Bishopa48c0142020-01-06 09:48:41 -050028inherit autotools pkgconfig useradd systemd
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
Brad Bishopc342db32019-05-15 21:57:59 -040048EXTRA_OECONF_CLAMAV = "--without-libcheck-prefix --disable-unrar \
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080049 --disable-mempool \
50 --program-prefix="" \
Brad Bishopa48c0142020-01-06 09:48:41 -050051 --disable-zlib-vcheck \
52 --with-xml=${CLAMAV_USR_DIR} \
53 --with-zlib=${CLAMAV_USR_DIR} \
Brad Bishopc342db32019-05-15 21:57:59 -040054 --with-openssl=${CLAMAV_USR_DIR} \
Brad Bishopa48c0142020-01-06 09:48:41 -050055 --with-libcurl=${CLAMAV_USR_DIR} \
56 --with-system-libmspack=${CLAMAV_USR_DIR} \
57 --with-iconv=no \
58 --enable-check=no \
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080059 "
60
Brad Bishopc342db32019-05-15 21:57:59 -040061EXTRA_OECONF_class-native += "${EXTRA_OECONF_CLAMAV}"
Brad Bishopa48c0142020-01-06 09:48:41 -050062EXTRA_OECONF_class-target += "--with-user=${CLAMAV_UID} --with-group=${CLAMAV_GID} ${EXTRA_OECONF_CLAMAV}"
Brad Bishopc342db32019-05-15 21:57:59 -040063
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080064do_configure () {
Brad Bishop26bdd442019-08-16 17:08:17 -040065 ${S}/configure ${CONFIGUREOPTS} ${EXTRA_OECONF}
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080066}
67
Brad Bishopc342db32019-05-15 21:57:59 -040068do_configure_class-native () {
Brad Bishop26bdd442019-08-16 17:08:17 -040069 ${S}/configure ${CONFIGUREOPTS} ${EXTRA_OECONF}
Brad Bishopc342db32019-05-15 21:57:59 -040070}
71
Brad Bishopc342db32019-05-15 21:57:59 -040072do_compile_append_class-target() {
Brad Bishopc342db32019-05-15 21:57:59 -040073 if [ "${INSTALL_CLAMAV_CVD}" = "1" ]; then
74 bbnote "CLAMAV creating cvd"
Brad Bishopa48c0142020-01-06 09:48:41 -050075 install -d ${S}/clamav_db
Brad Bishopc342db32019-05-15 21:57:59 -040076 ${STAGING_BINDIR_NATIVE}/freshclam --datadir=${S}/clamav_db --config=${WORKDIR}/freshclam-native.conf
77 fi
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080078}
79
Brad Bishopc342db32019-05-15 21:57:59 -040080do_install_append_class-target () {
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080081 install -d ${D}/${sysconfdir}
82 install -d ${D}/${localstatedir}/lib/clamav
83 install -d ${D}${sysconfdir}/clamav ${D}${sysconfdir}/default/volatiles
84
85 install -m 644 ${WORKDIR}/clamd.conf ${D}/${sysconfdir}
86 install -m 644 ${WORKDIR}/freshclam.conf ${D}/${sysconfdir}
87 install -m 0644 ${WORKDIR}/volatiles.03_clamav ${D}${sysconfdir}/default/volatiles/volatiles.03_clamav
88 sed -i -e 's#${STAGING_DIR_HOST}##g' ${D}${libdir}/pkgconfig/libclamav.pc
89 rm ${D}/${libdir}/libclamav.so
Brad Bishopc342db32019-05-15 21:57:59 -040090 install -m 666 ${S}/clamav_db/* ${D}/${localstatedir}/lib/clamav/.
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080091 if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)};then
92 install -D -m 0644 ${WORKDIR}/clamav.service ${D}${systemd_unitdir}/system/clamav.service
Brad Bishop95dbbac2019-12-02 13:55:25 -050093 install -d ${D}${sysconfdir}/tmpfiles.d
94 install -m 0644 ${WORKDIR}/tmpfiles.clamav ${D}${sysconfdir}/tmpfiles.d/clamav.conf
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080095 fi
96}
97
98pkg_postinst_ontarget_${PN} () {
Brad Bishop95dbbac2019-12-02 13:55:25 -050099 if command -v systemd-tmpfiles >/dev/null; then
100 systemd-tmpfiles --create ${sysconfdir}/tmpfiles.d/clamav.conf
101 elif [ -e ${sysconfdir}/init.d/populate-volatile.sh ]; then
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800102 ${sysconfdir}/init.d/populate-volatile.sh update
103 fi
Brad Bishopc342db32019-05-15 21:57:59 -0400104 mkdir -p ${localstatedir}/lib/clamav
Brad Bishopa48c0142020-01-06 09:48:41 -0500105 chown -R ${CLAMAV_UID}:${CLAMAV_GID} ${localstatedir}/lib/clamav
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800106}
107
108
Brad Bishopc342db32019-05-15 21:57:59 -0400109PACKAGES = "${PN} ${PN}-dev ${PN}-dbg ${PN}-daemon ${PN}-doc ${PN}-cvd \
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800110 ${PN}-clamdscan ${PN}-freshclam ${PN}-libclamav ${PN}-staticdev"
111
112FILES_${PN} = "${bindir}/clambc ${bindir}/clamscan ${bindir}/clamsubmit \
113 ${bindir}/*sigtool ${mandir}/man1/clambc* ${mandir}/man1/clamscan* \
114 ${mandir}/man1/sigtool* ${mandir}/man1/clambsubmit* \
115 ${docdir}/clamav/* "
116
117FILES_${PN}-clamdscan = " ${bindir}/clamdscan \
118 ${docdir}/clamdscan/* \
119 ${mandir}/man1/clamdscan* \
120 "
121
122FILES_${PN}-daemon = "${bindir}/clamconf ${bindir}/clamdtop ${sbindir}/clamd \
123 ${mandir}/man1/clamconf* ${mandir}/man1/clamdtop* \
124 ${mandir}/man5/clamd* ${mandir}/man8/clamd* \
125 ${sysconfdir}/clamd.conf* \
126 ${systemd_unitdir}/system/clamav-daemon/* \
127 ${docdir}/clamav-daemon/* ${sysconfdir}/clamav-daemon \
128 ${sysconfdir}/logcheck/ignore.d.server/clamav-daemon "
129
130FILES_${PN}-freshclam = "${bindir}/freshclam \
131 ${sysconfdir}/freshclam.conf* \
132 ${sysconfdir}/clamav ${sysconfdir}/default/volatiles \
Brad Bishop95dbbac2019-12-02 13:55:25 -0500133 ${sysconfdir}/tmpfiles.d/*.conf \
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800134 ${localstatedir}/lib/clamav \
135 ${docdir}/${PN}-freshclam ${mandir}/man1/freshclam.* \
136 ${mandir}/man5/freshclam.conf.* \
137 ${systemd_unitdir}/system/clamav-freshclam.service"
138
139FILES_${PN}-dev = " ${bindir}/clamav-config ${libdir}/*.la \
140 ${libdir}/pkgconfig/*.pc \
141 ${mandir}/man1/clamav-config.* \
142 ${includedir}/*.h ${docdir}/libclamav* "
143
144FILES_${PN}-staticdev = "${libdir}/*.a"
145
Brad Bishopa48c0142020-01-06 09:48:41 -0500146FILES_${PN}-libclamav = "${libdir}/libclamav.so* ${libdir}/libclammspack.so*\
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800147 ${docdir}/libclamav/* "
148
149FILES_${PN}-doc = "${mandir}/man/* \
150 ${datadir}/man/* \
151 ${docdir}/* "
152
Brad Bishopc342db32019-05-15 21:57:59 -0400153FILES_${PN}-cvd = "${localstatedir}/lib/clamav/*.cvd ${localstatedir}/lib/clamav/*.dat"
154
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800155USERADD_PACKAGES = "${PN}"
Brad Bishopa48c0142020-01-06 09:48:41 -0500156GROUPADD_PARAM_${PN} = "--system ${CLAMAV_UID}"
157USERADD_PARAM_${PN} = "--system -g ${CLAMAV_GID} --home-dir \
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800158 ${localstatedir}/spool/${BPN} \
159 --no-create-home --shell /bin/false ${BPN}"
160
161RPROVIDES_${PN} += "${PN}-systemd"
162RREPLACES_${PN} += "${PN}-systemd"
163RCONFLICTS_${PN} += "${PN}-systemd"
164SYSTEMD_SERVICE_${PN} = "${BPN}.service"
165
Brad Bishopa48c0142020-01-06 09:48:41 -0500166RDEPENDS_${PN} = "openssl ncurses-libncurses libxml2 libbz2 ncurses-libtinfo curl libpcre2 clamav-freshclam clamav-libclamav"
Brad Bishopc342db32019-05-15 21:57:59 -0400167RDEPENDS_${PN}_class-native = ""
168
169BBCLASSEXTEND = "native"