Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 1 | SUMMARY = "ClamAV anti-virus utility for Unix - command-line interface" |
| 2 | DESCRIPTION = "ClamAV is an open source antivirus engine for detecting trojans, viruses, malware & other malicious threats." |
| 3 | HOMEPAGE = "http://www.clamav.net/index.html" |
| 4 | SECTION = "security" |
| 5 | LICENSE = "LGPL-2.1" |
| 6 | |
Andrew Geissler | 1fe918a | 2020-05-15 14:16:47 -0500 | [diff] [blame] | 7 | DEPENDS = "libtool db libxml2 openssl zlib curl llvm clamav-native libmspack bison-native" |
| 8 | DEPENDS_class-native = "db-native openssl-native zlib-native llvm-native curl-native bison-native" |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 9 | |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 10 | LIC_FILES_CHKSUM = "file://COPYING.LGPL;beginline=2;endline=3;md5=4b89c05acc71195e9a06edfa2fa7d092" |
| 11 | |
Brad Bishop | a48c014 | 2020-01-06 09:48:41 -0500 | [diff] [blame] | 12 | SRCREV = "482fcd413b07e9fd3ef9850e6d01a45f4e187108" |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 13 | |
Brad Bishop | a48c014 | 2020-01-06 09:48:41 -0500 | [diff] [blame] | 14 | SRC_URI = "git://github.com/vrtadmin/clamav-devel;branch=rel/0.101 \ |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 15 | file://clamd.conf \ |
| 16 | file://freshclam.conf \ |
| 17 | file://volatiles.03_clamav \ |
Brad Bishop | 95dbbac | 2019-12-02 13:55:25 -0500 | [diff] [blame] | 18 | file://tmpfiles.clamav \ |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 19 | file://${BPN}.service \ |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 20 | file://freshclam-native.conf \ |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 21 | " |
| 22 | |
| 23 | S = "${WORKDIR}/git" |
| 24 | |
| 25 | LEAD_SONAME = "libclamav.so" |
Andrew Geissler | cc58928 | 2020-09-18 13:34:40 -0500 | [diff] [blame] | 26 | SO_VER = "9.0.4" |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 27 | |
Andrew Geissler | 064f75b | 2020-06-27 00:14:46 -0500 | [diff] [blame] | 28 | inherit autotools pkgconfig useradd systemd multilib_header multilib_script |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 29 | |
Brad Bishop | a48c014 | 2020-01-06 09:48:41 -0500 | [diff] [blame] | 30 | CLAMAV_UID ?= "clamav" |
| 31 | CLAMAV_GID ?= "clamav" |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 32 | INSTALL_CLAMAV_CVD ?= "1" |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 33 | |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 34 | CLAMAV_USR_DIR = "${STAGING_DIR_NATIVE}/usr" |
| 35 | CLAMAV_USR_DIR_class-target = "${STAGING_DIR_HOST}/usr" |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 36 | |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 37 | PACKAGECONFIG_class-target ?= "ncurses bz2" |
| 38 | PACKAGECONFIG_class-target += " ${@bb.utils.contains("DISTRO_FEATURES", "ipv6", "ipv6", "", d)}" |
| 39 | PACKAGECONFIG_class-target += "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd', '', d)}" |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 40 | |
| 41 | PACKAGECONFIG[pcre] = "--with-pcre=${STAGING_LIBDIR}, --without-pcre, libpcre" |
Brad Bishop | a48c014 | 2020-01-06 09:48:41 -0500 | [diff] [blame] | 42 | PACKAGECONFIG[json] = "--with-libjson=${STAGING_LIBDIR}, --without-libjson, json-c," |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 43 | PACKAGECONFIG[ipv6] = "--enable-ipv6, --disable-ipv6" |
Brad Bishop | a48c014 | 2020-01-06 09:48:41 -0500 | [diff] [blame] | 44 | PACKAGECONFIG[bz2] = "--with-libbz2-prefix=${CLAMAV_USR_DIR}, --disable-bzip2, bzip2" |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 45 | PACKAGECONFIG[ncurses] = "--with-libncurses-prefix=${CLAMAV_USR_DIR}, --without-libncurses-prefix, ncurses, " |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 46 | PACKAGECONFIG[systemd] = "--with-systemdsystemunitdir=${systemd_unitdir}/system/, --without-systemdsystemunitdir, " |
| 47 | |
Andrew Geissler | 064f75b | 2020-06-27 00:14:46 -0500 | [diff] [blame] | 48 | MULTILIB_SCRIPTS = "${PN}-dev:${bindir}/clamav-config ${PN}-cvd:${localstatedir}/lib/clamav/mirrors.dat" |
| 49 | |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 50 | EXTRA_OECONF_CLAMAV = "--without-libcheck-prefix --disable-unrar \ |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 51 | --disable-mempool \ |
| 52 | --program-prefix="" \ |
Brad Bishop | a48c014 | 2020-01-06 09:48:41 -0500 | [diff] [blame] | 53 | --disable-zlib-vcheck \ |
| 54 | --with-xml=${CLAMAV_USR_DIR} \ |
| 55 | --with-zlib=${CLAMAV_USR_DIR} \ |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 56 | --with-openssl=${CLAMAV_USR_DIR} \ |
Brad Bishop | a48c014 | 2020-01-06 09:48:41 -0500 | [diff] [blame] | 57 | --with-libcurl=${CLAMAV_USR_DIR} \ |
| 58 | --with-system-libmspack=${CLAMAV_USR_DIR} \ |
| 59 | --with-iconv=no \ |
| 60 | --enable-check=no \ |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 61 | " |
| 62 | |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 63 | EXTRA_OECONF_class-native += "${EXTRA_OECONF_CLAMAV}" |
Brad Bishop | a48c014 | 2020-01-06 09:48:41 -0500 | [diff] [blame] | 64 | EXTRA_OECONF_class-target += "--with-user=${CLAMAV_UID} --with-group=${CLAMAV_GID} ${EXTRA_OECONF_CLAMAV}" |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 65 | |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 66 | do_configure () { |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame] | 67 | ${S}/configure ${CONFIGUREOPTS} ${EXTRA_OECONF} |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 68 | } |
| 69 | |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 70 | do_configure_class-native () { |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame] | 71 | ${S}/configure ${CONFIGUREOPTS} ${EXTRA_OECONF} |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 72 | } |
| 73 | |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 74 | do_compile_append_class-target() { |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 75 | if [ "${INSTALL_CLAMAV_CVD}" = "1" ]; then |
| 76 | bbnote "CLAMAV creating cvd" |
Brad Bishop | a48c014 | 2020-01-06 09:48:41 -0500 | [diff] [blame] | 77 | install -d ${S}/clamav_db |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 78 | ${STAGING_BINDIR_NATIVE}/freshclam --datadir=${S}/clamav_db --config=${WORKDIR}/freshclam-native.conf |
| 79 | fi |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 80 | } |
| 81 | |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 82 | do_install_append_class-target () { |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 83 | 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 Geissler | b2fe863 | 2020-08-21 15:57:21 -0500 | [diff] [blame] | 92 | if [ "${INSTALL_CLAMAV_CVD}" = "1" ]; then |
| 93 | install -m 666 ${S}/clamav_db/* ${D}/${localstatedir}/lib/clamav/. |
| 94 | fi |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 95 | 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 Bishop | 95dbbac | 2019-12-02 13:55:25 -0500 | [diff] [blame] | 97 | install -d ${D}${sysconfdir}/tmpfiles.d |
| 98 | install -m 0644 ${WORKDIR}/tmpfiles.clamav ${D}${sysconfdir}/tmpfiles.d/clamav.conf |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 99 | fi |
Andrew Geissler | 064f75b | 2020-06-27 00:14:46 -0500 | [diff] [blame] | 100 | oe_multilib_header clamav-types.h |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 101 | } |
| 102 | |
| 103 | pkg_postinst_ontarget_${PN} () { |
Brad Bishop | 95dbbac | 2019-12-02 13:55:25 -0500 | [diff] [blame] | 104 | 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 Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 107 | ${sysconfdir}/init.d/populate-volatile.sh update |
| 108 | fi |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 109 | mkdir -p ${localstatedir}/lib/clamav |
Brad Bishop | a48c014 | 2020-01-06 09:48:41 -0500 | [diff] [blame] | 110 | chown -R ${CLAMAV_UID}:${CLAMAV_GID} ${localstatedir}/lib/clamav |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 111 | } |
| 112 | |
| 113 | |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 114 | PACKAGES = "${PN} ${PN}-dev ${PN}-dbg ${PN}-daemon ${PN}-doc ${PN}-cvd \ |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 115 | ${PN}-clamdscan ${PN}-freshclam ${PN}-libclamav ${PN}-staticdev" |
| 116 | |
| 117 | FILES_${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 | |
| 122 | FILES_${PN}-clamdscan = " ${bindir}/clamdscan \ |
| 123 | ${docdir}/clamdscan/* \ |
| 124 | ${mandir}/man1/clamdscan* \ |
| 125 | " |
| 126 | |
| 127 | FILES_${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 | |
| 135 | FILES_${PN}-freshclam = "${bindir}/freshclam \ |
| 136 | ${sysconfdir}/freshclam.conf* \ |
| 137 | ${sysconfdir}/clamav ${sysconfdir}/default/volatiles \ |
Brad Bishop | 95dbbac | 2019-12-02 13:55:25 -0500 | [diff] [blame] | 138 | ${sysconfdir}/tmpfiles.d/*.conf \ |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 139 | ${localstatedir}/lib/clamav \ |
| 140 | ${docdir}/${PN}-freshclam ${mandir}/man1/freshclam.* \ |
| 141 | ${mandir}/man5/freshclam.conf.* \ |
| 142 | ${systemd_unitdir}/system/clamav-freshclam.service" |
| 143 | |
| 144 | FILES_${PN}-dev = " ${bindir}/clamav-config ${libdir}/*.la \ |
| 145 | ${libdir}/pkgconfig/*.pc \ |
| 146 | ${mandir}/man1/clamav-config.* \ |
| 147 | ${includedir}/*.h ${docdir}/libclamav* " |
| 148 | |
| 149 | FILES_${PN}-staticdev = "${libdir}/*.a" |
| 150 | |
Brad Bishop | a48c014 | 2020-01-06 09:48:41 -0500 | [diff] [blame] | 151 | FILES_${PN}-libclamav = "${libdir}/libclamav.so* ${libdir}/libclammspack.so*\ |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 152 | ${docdir}/libclamav/* " |
| 153 | |
| 154 | FILES_${PN}-doc = "${mandir}/man/* \ |
| 155 | ${datadir}/man/* \ |
| 156 | ${docdir}/* " |
| 157 | |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 158 | FILES_${PN}-cvd = "${localstatedir}/lib/clamav/*.cvd ${localstatedir}/lib/clamav/*.dat" |
| 159 | |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 160 | USERADD_PACKAGES = "${PN}" |
Brad Bishop | a48c014 | 2020-01-06 09:48:41 -0500 | [diff] [blame] | 161 | GROUPADD_PARAM_${PN} = "--system ${CLAMAV_UID}" |
| 162 | USERADD_PARAM_${PN} = "--system -g ${CLAMAV_GID} --home-dir \ |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 163 | ${localstatedir}/spool/${BPN} \ |
| 164 | --no-create-home --shell /bin/false ${BPN}" |
| 165 | |
| 166 | RPROVIDES_${PN} += "${PN}-systemd" |
| 167 | RREPLACES_${PN} += "${PN}-systemd" |
| 168 | RCONFLICTS_${PN} += "${PN}-systemd" |
| 169 | SYSTEMD_SERVICE_${PN} = "${BPN}.service" |
| 170 | |
Brad Bishop | a48c014 | 2020-01-06 09:48:41 -0500 | [diff] [blame] | 171 | RDEPENDS_${PN} = "openssl ncurses-libncurses libxml2 libbz2 ncurses-libtinfo curl libpcre2 clamav-freshclam clamav-libclamav" |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 172 | RDEPENDS_${PN}_class-native = "" |
| 173 | |
| 174 | BBCLASSEXTEND = "native" |