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" |
Brad Bishop | a48c014 | 2020-01-06 09:48:41 -0500 | [diff] [blame] | 26 | SO_VER = "9.0.2" |
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 |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 92 | install -m 666 ${S}/clamav_db/* ${D}/${localstatedir}/lib/clamav/. |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 93 | 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 Bishop | 95dbbac | 2019-12-02 13:55:25 -0500 | [diff] [blame] | 95 | install -d ${D}${sysconfdir}/tmpfiles.d |
| 96 | install -m 0644 ${WORKDIR}/tmpfiles.clamav ${D}${sysconfdir}/tmpfiles.d/clamav.conf |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 97 | fi |
Andrew Geissler | 064f75b | 2020-06-27 00:14:46 -0500 | [diff] [blame] | 98 | oe_multilib_header clamav-types.h |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 99 | } |
| 100 | |
| 101 | pkg_postinst_ontarget_${PN} () { |
Brad Bishop | 95dbbac | 2019-12-02 13:55:25 -0500 | [diff] [blame] | 102 | 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 Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 105 | ${sysconfdir}/init.d/populate-volatile.sh update |
| 106 | fi |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 107 | mkdir -p ${localstatedir}/lib/clamav |
Brad Bishop | a48c014 | 2020-01-06 09:48:41 -0500 | [diff] [blame] | 108 | chown -R ${CLAMAV_UID}:${CLAMAV_GID} ${localstatedir}/lib/clamav |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 109 | } |
| 110 | |
| 111 | |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 112 | PACKAGES = "${PN} ${PN}-dev ${PN}-dbg ${PN}-daemon ${PN}-doc ${PN}-cvd \ |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 113 | ${PN}-clamdscan ${PN}-freshclam ${PN}-libclamav ${PN}-staticdev" |
| 114 | |
| 115 | FILES_${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 | |
| 120 | FILES_${PN}-clamdscan = " ${bindir}/clamdscan \ |
| 121 | ${docdir}/clamdscan/* \ |
| 122 | ${mandir}/man1/clamdscan* \ |
| 123 | " |
| 124 | |
| 125 | FILES_${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 | |
| 133 | FILES_${PN}-freshclam = "${bindir}/freshclam \ |
| 134 | ${sysconfdir}/freshclam.conf* \ |
| 135 | ${sysconfdir}/clamav ${sysconfdir}/default/volatiles \ |
Brad Bishop | 95dbbac | 2019-12-02 13:55:25 -0500 | [diff] [blame] | 136 | ${sysconfdir}/tmpfiles.d/*.conf \ |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 137 | ${localstatedir}/lib/clamav \ |
| 138 | ${docdir}/${PN}-freshclam ${mandir}/man1/freshclam.* \ |
| 139 | ${mandir}/man5/freshclam.conf.* \ |
| 140 | ${systemd_unitdir}/system/clamav-freshclam.service" |
| 141 | |
| 142 | FILES_${PN}-dev = " ${bindir}/clamav-config ${libdir}/*.la \ |
| 143 | ${libdir}/pkgconfig/*.pc \ |
| 144 | ${mandir}/man1/clamav-config.* \ |
| 145 | ${includedir}/*.h ${docdir}/libclamav* " |
| 146 | |
| 147 | FILES_${PN}-staticdev = "${libdir}/*.a" |
| 148 | |
Brad Bishop | a48c014 | 2020-01-06 09:48:41 -0500 | [diff] [blame] | 149 | FILES_${PN}-libclamav = "${libdir}/libclamav.so* ${libdir}/libclammspack.so*\ |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 150 | ${docdir}/libclamav/* " |
| 151 | |
| 152 | FILES_${PN}-doc = "${mandir}/man/* \ |
| 153 | ${datadir}/man/* \ |
| 154 | ${docdir}/* " |
| 155 | |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 156 | FILES_${PN}-cvd = "${localstatedir}/lib/clamav/*.cvd ${localstatedir}/lib/clamav/*.dat" |
| 157 | |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 158 | USERADD_PACKAGES = "${PN}" |
Brad Bishop | a48c014 | 2020-01-06 09:48:41 -0500 | [diff] [blame] | 159 | GROUPADD_PARAM_${PN} = "--system ${CLAMAV_UID}" |
| 160 | USERADD_PARAM_${PN} = "--system -g ${CLAMAV_GID} --home-dir \ |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 161 | ${localstatedir}/spool/${BPN} \ |
| 162 | --no-create-home --shell /bin/false ${BPN}" |
| 163 | |
| 164 | RPROVIDES_${PN} += "${PN}-systemd" |
| 165 | RREPLACES_${PN} += "${PN}-systemd" |
| 166 | RCONFLICTS_${PN} += "${PN}-systemd" |
| 167 | SYSTEMD_SERVICE_${PN} = "${BPN}.service" |
| 168 | |
Brad Bishop | a48c014 | 2020-01-06 09:48:41 -0500 | [diff] [blame] | 169 | 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] | 170 | RDEPENDS_${PN}_class-native = "" |
| 171 | |
| 172 | BBCLASSEXTEND = "native" |