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 () { |
| 69 | cd ${S} |
| 70 | ./configure ${CONFIGUREOPTS} ${EXTRA_OECONF} |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame^] | 71 | install -d ${S}/clamav_db |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 72 | } |
| 73 | |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame^] | 74 | do_configure_class-native () { |
| 75 | cd ${S} |
| 76 | ./configure ${CONFIGUREOPTS} ${EXTRA_OECONF} |
| 77 | } |
| 78 | |
| 79 | |
| 80 | do_compile_append_class-target() { |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 81 | # brute force removing RPATH |
| 82 | chrpath -d ${B}/libclamav/.libs/libclamav.so.${SO_VER} |
| 83 | chrpath -d ${B}/sigtool/.libs/sigtool |
| 84 | chrpath -d ${B}/clambc/.libs/clambc |
| 85 | chrpath -d ${B}/clamscan/.libs/clamscan |
| 86 | chrpath -d ${B}/clamconf/.libs/clamconf |
| 87 | chrpath -d ${B}/clamd/.libs/clamd |
| 88 | chrpath -d ${B}/freshclam/.libs/freshclam |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame^] | 89 | |
| 90 | if [ "${INSTALL_CLAMAV_CVD}" = "1" ]; then |
| 91 | bbnote "CLAMAV creating cvd" |
| 92 | ${STAGING_BINDIR_NATIVE}/freshclam --datadir=${S}/clamav_db --config=${WORKDIR}/freshclam-native.conf |
| 93 | fi |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 94 | } |
| 95 | |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame^] | 96 | do_install_append_class-target () { |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 97 | install -d ${D}/${sysconfdir} |
| 98 | install -d ${D}/${localstatedir}/lib/clamav |
| 99 | install -d ${D}${sysconfdir}/clamav ${D}${sysconfdir}/default/volatiles |
| 100 | |
| 101 | install -m 644 ${WORKDIR}/clamd.conf ${D}/${sysconfdir} |
| 102 | install -m 644 ${WORKDIR}/freshclam.conf ${D}/${sysconfdir} |
| 103 | install -m 0644 ${WORKDIR}/volatiles.03_clamav ${D}${sysconfdir}/default/volatiles/volatiles.03_clamav |
| 104 | sed -i -e 's#${STAGING_DIR_HOST}##g' ${D}${libdir}/pkgconfig/libclamav.pc |
| 105 | rm ${D}/${libdir}/libclamav.so |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame^] | 106 | install -m 666 ${S}/clamav_db/* ${D}/${localstatedir}/lib/clamav/. |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 107 | if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)};then |
| 108 | install -D -m 0644 ${WORKDIR}/clamav.service ${D}${systemd_unitdir}/system/clamav.service |
| 109 | fi |
| 110 | } |
| 111 | |
| 112 | pkg_postinst_ontarget_${PN} () { |
| 113 | if [ -e /etc/init.d/populate-volatile.sh ] ; then |
| 114 | ${sysconfdir}/init.d/populate-volatile.sh update |
| 115 | fi |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame^] | 116 | mkdir -p ${localstatedir}/lib/clamav |
| 117 | chown -R ${UID}:${GID} ${localstatedir}/lib/clamav |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 118 | } |
| 119 | |
| 120 | |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame^] | 121 | PACKAGES = "${PN} ${PN}-dev ${PN}-dbg ${PN}-daemon ${PN}-doc ${PN}-cvd \ |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 122 | ${PN}-clamdscan ${PN}-freshclam ${PN}-libclamav ${PN}-staticdev" |
| 123 | |
| 124 | FILES_${PN} = "${bindir}/clambc ${bindir}/clamscan ${bindir}/clamsubmit \ |
| 125 | ${bindir}/*sigtool ${mandir}/man1/clambc* ${mandir}/man1/clamscan* \ |
| 126 | ${mandir}/man1/sigtool* ${mandir}/man1/clambsubmit* \ |
| 127 | ${docdir}/clamav/* " |
| 128 | |
| 129 | FILES_${PN}-clamdscan = " ${bindir}/clamdscan \ |
| 130 | ${docdir}/clamdscan/* \ |
| 131 | ${mandir}/man1/clamdscan* \ |
| 132 | " |
| 133 | |
| 134 | FILES_${PN}-daemon = "${bindir}/clamconf ${bindir}/clamdtop ${sbindir}/clamd \ |
| 135 | ${mandir}/man1/clamconf* ${mandir}/man1/clamdtop* \ |
| 136 | ${mandir}/man5/clamd* ${mandir}/man8/clamd* \ |
| 137 | ${sysconfdir}/clamd.conf* \ |
| 138 | ${systemd_unitdir}/system/clamav-daemon/* \ |
| 139 | ${docdir}/clamav-daemon/* ${sysconfdir}/clamav-daemon \ |
| 140 | ${sysconfdir}/logcheck/ignore.d.server/clamav-daemon " |
| 141 | |
| 142 | FILES_${PN}-freshclam = "${bindir}/freshclam \ |
| 143 | ${sysconfdir}/freshclam.conf* \ |
| 144 | ${sysconfdir}/clamav ${sysconfdir}/default/volatiles \ |
| 145 | ${localstatedir}/lib/clamav \ |
| 146 | ${docdir}/${PN}-freshclam ${mandir}/man1/freshclam.* \ |
| 147 | ${mandir}/man5/freshclam.conf.* \ |
| 148 | ${systemd_unitdir}/system/clamav-freshclam.service" |
| 149 | |
| 150 | FILES_${PN}-dev = " ${bindir}/clamav-config ${libdir}/*.la \ |
| 151 | ${libdir}/pkgconfig/*.pc \ |
| 152 | ${mandir}/man1/clamav-config.* \ |
| 153 | ${includedir}/*.h ${docdir}/libclamav* " |
| 154 | |
| 155 | FILES_${PN}-staticdev = "${libdir}/*.a" |
| 156 | |
| 157 | FILES_${PN}-libclamav = "${libdir}/libclamav.so* ${libdir}/libmspack.so*\ |
| 158 | ${docdir}/libclamav/* " |
| 159 | |
| 160 | FILES_${PN}-doc = "${mandir}/man/* \ |
| 161 | ${datadir}/man/* \ |
| 162 | ${docdir}/* " |
| 163 | |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame^] | 164 | FILES_${PN}-cvd = "${localstatedir}/lib/clamav/*.cvd ${localstatedir}/lib/clamav/*.dat" |
| 165 | |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 166 | USERADD_PACKAGES = "${PN}" |
| 167 | GROUPADD_PARAM_${PN} = "--system ${UID}" |
| 168 | USERADD_PARAM_${PN} = "--system -g ${GID} --home-dir \ |
| 169 | ${localstatedir}/spool/${BPN} \ |
| 170 | --no-create-home --shell /bin/false ${BPN}" |
| 171 | |
| 172 | RPROVIDES_${PN} += "${PN}-systemd" |
| 173 | RREPLACES_${PN} += "${PN}-systemd" |
| 174 | RCONFLICTS_${PN} += "${PN}-systemd" |
| 175 | SYSTEMD_SERVICE_${PN} = "${BPN}.service" |
| 176 | |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame^] | 177 | RDEPENDS_${PN} = "openssl ncurses-libncurses libbz2 ncurses-libtinfo clamav-freshclam clamav-libclamav" |
| 178 | RDEPENDS_${PN}_class-native = "" |
| 179 | |
| 180 | BBCLASSEXTEND = "native" |