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 | |
Brad Bishop | a48c014 | 2020-01-06 09:48:41 -0500 | [diff] [blame] | 28 | inherit autotools pkgconfig useradd systemd |
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 | |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 48 | EXTRA_OECONF_CLAMAV = "--without-libcheck-prefix --disable-unrar \ |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 49 | --disable-mempool \ |
| 50 | --program-prefix="" \ |
Brad Bishop | a48c014 | 2020-01-06 09:48:41 -0500 | [diff] [blame] | 51 | --disable-zlib-vcheck \ |
| 52 | --with-xml=${CLAMAV_USR_DIR} \ |
| 53 | --with-zlib=${CLAMAV_USR_DIR} \ |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 54 | --with-openssl=${CLAMAV_USR_DIR} \ |
Brad Bishop | a48c014 | 2020-01-06 09:48:41 -0500 | [diff] [blame] | 55 | --with-libcurl=${CLAMAV_USR_DIR} \ |
| 56 | --with-system-libmspack=${CLAMAV_USR_DIR} \ |
| 57 | --with-iconv=no \ |
| 58 | --enable-check=no \ |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 59 | " |
| 60 | |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 61 | EXTRA_OECONF_class-native += "${EXTRA_OECONF_CLAMAV}" |
Brad Bishop | a48c014 | 2020-01-06 09:48:41 -0500 | [diff] [blame] | 62 | 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] | 63 | |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 64 | do_configure () { |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame] | 65 | ${S}/configure ${CONFIGUREOPTS} ${EXTRA_OECONF} |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 66 | } |
| 67 | |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 68 | do_configure_class-native () { |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame] | 69 | ${S}/configure ${CONFIGUREOPTS} ${EXTRA_OECONF} |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 70 | } |
| 71 | |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 72 | do_compile_append_class-target() { |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 73 | if [ "${INSTALL_CLAMAV_CVD}" = "1" ]; then |
| 74 | bbnote "CLAMAV creating cvd" |
Brad Bishop | a48c014 | 2020-01-06 09:48:41 -0500 | [diff] [blame] | 75 | install -d ${S}/clamav_db |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 76 | ${STAGING_BINDIR_NATIVE}/freshclam --datadir=${S}/clamav_db --config=${WORKDIR}/freshclam-native.conf |
| 77 | fi |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 78 | } |
| 79 | |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 80 | do_install_append_class-target () { |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 81 | 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 Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 90 | install -m 666 ${S}/clamav_db/* ${D}/${localstatedir}/lib/clamav/. |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 91 | 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 Bishop | 95dbbac | 2019-12-02 13:55:25 -0500 | [diff] [blame] | 93 | install -d ${D}${sysconfdir}/tmpfiles.d |
| 94 | install -m 0644 ${WORKDIR}/tmpfiles.clamav ${D}${sysconfdir}/tmpfiles.d/clamav.conf |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 95 | fi |
| 96 | } |
| 97 | |
| 98 | pkg_postinst_ontarget_${PN} () { |
Brad Bishop | 95dbbac | 2019-12-02 13:55:25 -0500 | [diff] [blame] | 99 | 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 Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 102 | ${sysconfdir}/init.d/populate-volatile.sh update |
| 103 | fi |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 104 | mkdir -p ${localstatedir}/lib/clamav |
Brad Bishop | a48c014 | 2020-01-06 09:48:41 -0500 | [diff] [blame] | 105 | chown -R ${CLAMAV_UID}:${CLAMAV_GID} ${localstatedir}/lib/clamav |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 106 | } |
| 107 | |
| 108 | |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 109 | PACKAGES = "${PN} ${PN}-dev ${PN}-dbg ${PN}-daemon ${PN}-doc ${PN}-cvd \ |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 110 | ${PN}-clamdscan ${PN}-freshclam ${PN}-libclamav ${PN}-staticdev" |
| 111 | |
| 112 | FILES_${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 | |
| 117 | FILES_${PN}-clamdscan = " ${bindir}/clamdscan \ |
| 118 | ${docdir}/clamdscan/* \ |
| 119 | ${mandir}/man1/clamdscan* \ |
| 120 | " |
| 121 | |
| 122 | FILES_${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 | |
| 130 | FILES_${PN}-freshclam = "${bindir}/freshclam \ |
| 131 | ${sysconfdir}/freshclam.conf* \ |
| 132 | ${sysconfdir}/clamav ${sysconfdir}/default/volatiles \ |
Brad Bishop | 95dbbac | 2019-12-02 13:55:25 -0500 | [diff] [blame] | 133 | ${sysconfdir}/tmpfiles.d/*.conf \ |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 134 | ${localstatedir}/lib/clamav \ |
| 135 | ${docdir}/${PN}-freshclam ${mandir}/man1/freshclam.* \ |
| 136 | ${mandir}/man5/freshclam.conf.* \ |
| 137 | ${systemd_unitdir}/system/clamav-freshclam.service" |
| 138 | |
| 139 | FILES_${PN}-dev = " ${bindir}/clamav-config ${libdir}/*.la \ |
| 140 | ${libdir}/pkgconfig/*.pc \ |
| 141 | ${mandir}/man1/clamav-config.* \ |
| 142 | ${includedir}/*.h ${docdir}/libclamav* " |
| 143 | |
| 144 | FILES_${PN}-staticdev = "${libdir}/*.a" |
| 145 | |
Brad Bishop | a48c014 | 2020-01-06 09:48:41 -0500 | [diff] [blame] | 146 | FILES_${PN}-libclamav = "${libdir}/libclamav.so* ${libdir}/libclammspack.so*\ |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 147 | ${docdir}/libclamav/* " |
| 148 | |
| 149 | FILES_${PN}-doc = "${mandir}/man/* \ |
| 150 | ${datadir}/man/* \ |
| 151 | ${docdir}/* " |
| 152 | |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 153 | FILES_${PN}-cvd = "${localstatedir}/lib/clamav/*.cvd ${localstatedir}/lib/clamav/*.dat" |
| 154 | |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 155 | USERADD_PACKAGES = "${PN}" |
Brad Bishop | a48c014 | 2020-01-06 09:48:41 -0500 | [diff] [blame] | 156 | GROUPADD_PARAM_${PN} = "--system ${CLAMAV_UID}" |
| 157 | USERADD_PARAM_${PN} = "--system -g ${CLAMAV_GID} --home-dir \ |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 158 | ${localstatedir}/spool/${BPN} \ |
| 159 | --no-create-home --shell /bin/false ${BPN}" |
| 160 | |
| 161 | RPROVIDES_${PN} += "${PN}-systemd" |
| 162 | RREPLACES_${PN} += "${PN}-systemd" |
| 163 | RCONFLICTS_${PN} += "${PN}-systemd" |
| 164 | SYSTEMD_SERVICE_${PN} = "${BPN}.service" |
| 165 | |
Brad Bishop | a48c014 | 2020-01-06 09:48:41 -0500 | [diff] [blame] | 166 | 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] | 167 | RDEPENDS_${PN}_class-native = "" |
| 168 | |
| 169 | BBCLASSEXTEND = "native" |