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 | |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 7 | DEPENDS = "libtool db libmspack openssl zlib llvm chrpath-replacement-native clamav-native" |
| 8 | DEPENDS_class-native = "db-native openssl-native zlib-native" |
| 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 | |
| 12 | SRCREV = "b66e5e27b48c0a07494f9df9b809ed933cede047" |
| 13 | |
| 14 | SRC_URI = "git://github.com/vrtadmin/clamav-devel;branch=rel/0.99 \ |
| 15 | file://clamd.conf \ |
| 16 | file://freshclam.conf \ |
| 17 | file://volatiles.03_clamav \ |
| 18 | file://${BPN}.service \ |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 19 | file://freshclam-native.conf \ |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 20 | " |
| 21 | |
| 22 | S = "${WORKDIR}/git" |
| 23 | |
| 24 | LEAD_SONAME = "libclamav.so" |
| 25 | SO_VER = "7.1.1" |
| 26 | |
| 27 | EXTRANATIVEPATH += "chrpath-native" |
| 28 | |
| 29 | inherit autotools-brokensep pkgconfig useradd systemd |
| 30 | |
| 31 | UID = "clamav" |
| 32 | GID = "clamav" |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 33 | INSTALL_CLAMAV_CVD ?= "1" |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 34 | |
| 35 | # Clamav has a built llvm version 2 but does not build with gcc 6.x, |
| 36 | # disable the internal one. This is a known issue |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 37 | # If you want LLVM support, use the one in core |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 38 | |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 39 | CLAMAV_USR_DIR = "${STAGING_DIR_NATIVE}/usr" |
| 40 | CLAMAV_USR_DIR_class-target = "${STAGING_DIR_HOST}/usr" |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 41 | |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 42 | PACKAGECONFIG_class-target ?= "ncurses bz2" |
| 43 | PACKAGECONFIG_class-target += " ${@bb.utils.contains("DISTRO_FEATURES", "ipv6", "ipv6", "", d)}" |
| 44 | PACKAGECONFIG_class-target += "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd', '', d)}" |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 45 | |
| 46 | PACKAGECONFIG[pcre] = "--with-pcre=${STAGING_LIBDIR}, --without-pcre, libpcre" |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 47 | PACKAGECONFIG[xml] = "--with-xml=${CLAMAV_USR_DIR}, --disable-xml, libxml2," |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 48 | PACKAGECONFIG[json] = "--with-libjson=${STAGING_LIBDIR}, --without-libjson, json," |
| 49 | PACKAGECONFIG[curl] = "--with-libcurl=${STAGING_LIBDIR}, --without-libcurl, curl," |
| 50 | PACKAGECONFIG[ipv6] = "--enable-ipv6, --disable-ipv6" |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 51 | PACKAGECONFIG[bz2] = "--with-libbz2-prefix=${CLAMAV_USR_DIR}, --without-libbz2-prefix, " |
| 52 | PACKAGECONFIG[ncurses] = "--with-libncurses-prefix=${CLAMAV_USR_DIR}, --without-libncurses-prefix, ncurses, " |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 53 | PACKAGECONFIG[systemd] = "--with-systemdsystemunitdir=${systemd_unitdir}/system/, --without-systemdsystemunitdir, " |
| 54 | |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 55 | EXTRA_OECONF_CLAMAV = "--without-libcheck-prefix --disable-unrar \ |
| 56 | --with-system-llvm --with-llvm-linking=dynamic --disable-llvm \ |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 57 | --disable-mempool \ |
| 58 | --program-prefix="" \ |
| 59 | --disable-yara \ |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 60 | --disable-xml \ |
| 61 | --with-openssl=${CLAMAV_USR_DIR} \ |
| 62 | --with-zlib=${CLAMAV_USR_DIR} --disable-zlib-vcheck \ |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 63 | " |
| 64 | |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 65 | EXTRA_OECONF_class-native += "${EXTRA_OECONF_CLAMAV}" |
| 66 | EXTRA_OECONF_class-target += "--with-user=${UID} --with-group=${GID} --disable-rpath ${EXTRA_OECONF_CLAMAV}" |
| 67 | |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 68 | do_configure () { |
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 | install -d ${S}/clamav_db |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 71 | } |
| 72 | |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 73 | do_configure_class-native () { |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame] | 74 | ${S}/configure ${CONFIGUREOPTS} ${EXTRA_OECONF} |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 75 | } |
| 76 | |
| 77 | |
| 78 | do_compile_append_class-target() { |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 79 | # brute force removing RPATH |
| 80 | chrpath -d ${B}/libclamav/.libs/libclamav.so.${SO_VER} |
| 81 | chrpath -d ${B}/sigtool/.libs/sigtool |
| 82 | chrpath -d ${B}/clambc/.libs/clambc |
| 83 | chrpath -d ${B}/clamscan/.libs/clamscan |
| 84 | chrpath -d ${B}/clamconf/.libs/clamconf |
| 85 | chrpath -d ${B}/clamd/.libs/clamd |
| 86 | chrpath -d ${B}/freshclam/.libs/freshclam |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 87 | |
| 88 | if [ "${INSTALL_CLAMAV_CVD}" = "1" ]; then |
| 89 | bbnote "CLAMAV creating cvd" |
| 90 | ${STAGING_BINDIR_NATIVE}/freshclam --datadir=${S}/clamav_db --config=${WORKDIR}/freshclam-native.conf |
| 91 | fi |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 92 | } |
| 93 | |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 94 | do_install_append_class-target () { |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 95 | install -d ${D}/${sysconfdir} |
| 96 | install -d ${D}/${localstatedir}/lib/clamav |
| 97 | install -d ${D}${sysconfdir}/clamav ${D}${sysconfdir}/default/volatiles |
| 98 | |
| 99 | install -m 644 ${WORKDIR}/clamd.conf ${D}/${sysconfdir} |
| 100 | install -m 644 ${WORKDIR}/freshclam.conf ${D}/${sysconfdir} |
| 101 | install -m 0644 ${WORKDIR}/volatiles.03_clamav ${D}${sysconfdir}/default/volatiles/volatiles.03_clamav |
| 102 | sed -i -e 's#${STAGING_DIR_HOST}##g' ${D}${libdir}/pkgconfig/libclamav.pc |
| 103 | rm ${D}/${libdir}/libclamav.so |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 104 | install -m 666 ${S}/clamav_db/* ${D}/${localstatedir}/lib/clamav/. |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 105 | if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)};then |
| 106 | install -D -m 0644 ${WORKDIR}/clamav.service ${D}${systemd_unitdir}/system/clamav.service |
| 107 | fi |
| 108 | } |
| 109 | |
| 110 | pkg_postinst_ontarget_${PN} () { |
| 111 | if [ -e /etc/init.d/populate-volatile.sh ] ; then |
| 112 | ${sysconfdir}/init.d/populate-volatile.sh update |
| 113 | fi |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 114 | mkdir -p ${localstatedir}/lib/clamav |
| 115 | chown -R ${UID}:${GID} ${localstatedir}/lib/clamav |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 116 | } |
| 117 | |
| 118 | |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 119 | PACKAGES = "${PN} ${PN}-dev ${PN}-dbg ${PN}-daemon ${PN}-doc ${PN}-cvd \ |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 120 | ${PN}-clamdscan ${PN}-freshclam ${PN}-libclamav ${PN}-staticdev" |
| 121 | |
| 122 | FILES_${PN} = "${bindir}/clambc ${bindir}/clamscan ${bindir}/clamsubmit \ |
| 123 | ${bindir}/*sigtool ${mandir}/man1/clambc* ${mandir}/man1/clamscan* \ |
| 124 | ${mandir}/man1/sigtool* ${mandir}/man1/clambsubmit* \ |
| 125 | ${docdir}/clamav/* " |
| 126 | |
| 127 | FILES_${PN}-clamdscan = " ${bindir}/clamdscan \ |
| 128 | ${docdir}/clamdscan/* \ |
| 129 | ${mandir}/man1/clamdscan* \ |
| 130 | " |
| 131 | |
| 132 | FILES_${PN}-daemon = "${bindir}/clamconf ${bindir}/clamdtop ${sbindir}/clamd \ |
| 133 | ${mandir}/man1/clamconf* ${mandir}/man1/clamdtop* \ |
| 134 | ${mandir}/man5/clamd* ${mandir}/man8/clamd* \ |
| 135 | ${sysconfdir}/clamd.conf* \ |
| 136 | ${systemd_unitdir}/system/clamav-daemon/* \ |
| 137 | ${docdir}/clamav-daemon/* ${sysconfdir}/clamav-daemon \ |
| 138 | ${sysconfdir}/logcheck/ignore.d.server/clamav-daemon " |
| 139 | |
| 140 | FILES_${PN}-freshclam = "${bindir}/freshclam \ |
| 141 | ${sysconfdir}/freshclam.conf* \ |
| 142 | ${sysconfdir}/clamav ${sysconfdir}/default/volatiles \ |
| 143 | ${localstatedir}/lib/clamav \ |
| 144 | ${docdir}/${PN}-freshclam ${mandir}/man1/freshclam.* \ |
| 145 | ${mandir}/man5/freshclam.conf.* \ |
| 146 | ${systemd_unitdir}/system/clamav-freshclam.service" |
| 147 | |
| 148 | FILES_${PN}-dev = " ${bindir}/clamav-config ${libdir}/*.la \ |
| 149 | ${libdir}/pkgconfig/*.pc \ |
| 150 | ${mandir}/man1/clamav-config.* \ |
| 151 | ${includedir}/*.h ${docdir}/libclamav* " |
| 152 | |
| 153 | FILES_${PN}-staticdev = "${libdir}/*.a" |
| 154 | |
| 155 | FILES_${PN}-libclamav = "${libdir}/libclamav.so* ${libdir}/libmspack.so*\ |
| 156 | ${docdir}/libclamav/* " |
| 157 | |
| 158 | FILES_${PN}-doc = "${mandir}/man/* \ |
| 159 | ${datadir}/man/* \ |
| 160 | ${docdir}/* " |
| 161 | |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 162 | FILES_${PN}-cvd = "${localstatedir}/lib/clamav/*.cvd ${localstatedir}/lib/clamav/*.dat" |
| 163 | |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 164 | USERADD_PACKAGES = "${PN}" |
| 165 | GROUPADD_PARAM_${PN} = "--system ${UID}" |
| 166 | USERADD_PARAM_${PN} = "--system -g ${GID} --home-dir \ |
| 167 | ${localstatedir}/spool/${BPN} \ |
| 168 | --no-create-home --shell /bin/false ${BPN}" |
| 169 | |
| 170 | RPROVIDES_${PN} += "${PN}-systemd" |
| 171 | RREPLACES_${PN} += "${PN}-systemd" |
| 172 | RCONFLICTS_${PN} += "${PN}-systemd" |
| 173 | SYSTEMD_SERVICE_${PN} = "${BPN}.service" |
| 174 | |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 175 | RDEPENDS_${PN} = "openssl ncurses-libncurses libbz2 ncurses-libtinfo clamav-freshclam clamav-libclamav" |
| 176 | RDEPENDS_${PN}_class-native = "" |
| 177 | |
| 178 | BBCLASSEXTEND = "native" |