Richard Marian Thomaiyar | 14fddef | 2018-07-13 23:55:56 +0530 | [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 | |
| 7 | DEPENDS = "libtool db libmspack chrpath-replacement-native" |
| 8 | |
| 9 | LIC_FILES_CHKSUM = "file://COPYING.LGPL;beginline=2;endline=3;md5=4b89c05acc71195e9a06edfa2fa7d092" |
| 10 | |
| 11 | SRCREV = "224f73461a44e278e9fa50ba59f51ee5e64373e0" |
| 12 | |
| 13 | SRC_URI = "git://github.com/vrtadmin/clamav-devel;branch=rel/0.99 \ |
| 14 | file://clamd.conf \ |
| 15 | file://freshclam.conf \ |
| 16 | file://volatiles.03_clamav \ |
| 17 | file://${BPN}.service \ |
| 18 | " |
| 19 | |
| 20 | S = "${WORKDIR}/git" |
| 21 | |
| 22 | LEAD_SONAME = "libclamav.so" |
| 23 | SO_VER = "7.1.1" |
| 24 | |
| 25 | EXTRANATIVEPATH += "chrpath-native" |
| 26 | |
| 27 | inherit autotools-brokensep pkgconfig useradd systemd |
| 28 | |
| 29 | UID = "clamav" |
| 30 | GID = "clamav" |
| 31 | |
| 32 | # Clamav has a built llvm version 2 but does not build with gcc 6.x, |
| 33 | # disable the internal one. This is a known issue |
| 34 | # If you want LLVM support, use meta-oe llvm3.3 to build for GCC 6.X, |
| 35 | # as defined below |
| 36 | |
| 37 | CLAMAV_LLVM ?= "oellvm" |
| 38 | CLAMAV_LLVM_RELEASE ?= "6.0" |
| 39 | |
| 40 | PACKAGECONFIG ?= "ncurses openssl bz2 zlib ${CLAMAV_LLVM}" |
| 41 | PACKAGECONFIG += " ${@bb.utils.contains("DISTRO_FEATURES", "ipv6", "ipv6", "", d)}" |
| 42 | PACKAGECONFIG += "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd', '', d)}" |
| 43 | |
| 44 | PACKAGECONFIG[oellvm] = "--with-system-llvm --with-llvm-linking=dynamic --disable-llvm, ,llvm${CLAMAV_LLVM_RELEASE}" |
| 45 | |
| 46 | PACKAGECONFIG[pcre] = "--with-pcre=${STAGING_LIBDIR}, --without-pcre, libpcre" |
| 47 | PACKAGECONFIG[xml] = "--with-xml=${STAGING_LIBDIR}/.., --with-xml=no, libxml2," |
| 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" |
| 51 | PACKAGECONFIG[openssl] = "--with-openssl=${STAGING_DIR_HOST}/usr, --without-openssl, openssl, openssl" |
| 52 | PACKAGECONFIG[zlib] = "--with-zlib=${STAGING_DIR_HOST}/usr --disable-zlib-vcheck , --without-zlib, zlib, " |
| 53 | PACKAGECONFIG[bz2] = "--with-libbz2-prefix=${STAGING_LIBDIR}/.., --without-libbz2-prefix, " |
| 54 | PACKAGECONFIG[ncurses] = "--with-libncurses-prefix=${STAGING_LIBDIR}/.., --without-libncurses-prefix, ncurses, " |
| 55 | PACKAGECONFIG[systemd] = "--with-systemdsystemunitdir=${systemd_unitdir}/system/, --without-systemdsystemunitdir, " |
| 56 | |
| 57 | EXTRA_OECONF += " --with-user=${UID} --with-group=${GID} \ |
| 58 | --without-libcheck-prefix --disable-unrar \ |
| 59 | --disable-mempool \ |
| 60 | --program-prefix="" \ |
| 61 | --disable-yara \ |
| 62 | --disable-rpath \ |
| 63 | " |
| 64 | |
| 65 | do_configure () { |
| 66 | cd ${S} |
| 67 | ./configure ${CONFIGUREOPTS} ${EXTRA_OECONF} |
| 68 | } |
| 69 | |
| 70 | do_compile_append() { |
| 71 | # brute force removing RPATH |
| 72 | chrpath -d ${B}/libclamav/.libs/libclamav.so.${SO_VER} |
| 73 | chrpath -d ${B}/sigtool/.libs/sigtool |
| 74 | chrpath -d ${B}/clambc/.libs/clambc |
| 75 | chrpath -d ${B}/clamscan/.libs/clamscan |
| 76 | chrpath -d ${B}/clamconf/.libs/clamconf |
| 77 | chrpath -d ${B}/clamd/.libs/clamd |
| 78 | chrpath -d ${B}/freshclam/.libs/freshclam |
| 79 | } |
| 80 | |
| 81 | do_install_append() { |
| 82 | install -d ${D}/${sysconfdir} |
| 83 | install -d ${D}/${localstatedir}/lib/clamav |
| 84 | install -d ${D}${sysconfdir}/clamav ${D}${sysconfdir}/default/volatiles |
| 85 | |
| 86 | install -m 644 ${WORKDIR}/clamd.conf ${D}/${sysconfdir} |
| 87 | install -m 644 ${WORKDIR}/freshclam.conf ${D}/${sysconfdir} |
| 88 | install -m 0644 ${WORKDIR}/volatiles.03_clamav ${D}${sysconfdir}/default/volatiles/volatiles.03_clamav |
| 89 | sed -i -e 's#${STAGING_DIR_HOST}##g' ${D}${libdir}/pkgconfig/libclamav.pc |
| 90 | rm ${D}/${libdir}/libclamav.so |
| 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 |
| 93 | fi |
| 94 | } |
| 95 | |
| 96 | pkg_postinst_ontarget_${PN} () { |
| 97 | if [ -e /etc/init.d/populate-volatile.sh ] ; then |
| 98 | ${sysconfdir}/init.d/populate-volatile.sh update |
| 99 | fi |
| 100 | chown ${UID}:${GID} ${localstatedir}/lib/clamav |
| 101 | } |
| 102 | |
| 103 | |
| 104 | PACKAGES = "${PN} ${PN}-dev ${PN}-dbg ${PN}-daemon ${PN}-doc \ |
| 105 | ${PN}-clamdscan ${PN}-freshclam ${PN}-libclamav ${PN}-staticdev" |
| 106 | |
| 107 | FILES_${PN} = "${bindir}/clambc ${bindir}/clamscan ${bindir}/clamsubmit \ |
| 108 | ${bindir}/*sigtool ${mandir}/man1/clambc* ${mandir}/man1/clamscan* \ |
| 109 | ${mandir}/man1/sigtool* ${mandir}/man1/clambsubmit* \ |
| 110 | ${docdir}/clamav/* " |
| 111 | |
| 112 | FILES_${PN}-clamdscan = " ${bindir}/clamdscan \ |
| 113 | ${docdir}/clamdscan/* \ |
| 114 | ${mandir}/man1/clamdscan* \ |
| 115 | " |
| 116 | |
| 117 | FILES_${PN}-daemon = "${bindir}/clamconf ${bindir}/clamdtop ${sbindir}/clamd \ |
| 118 | ${mandir}/man1/clamconf* ${mandir}/man1/clamdtop* \ |
| 119 | ${mandir}/man5/clamd* ${mandir}/man8/clamd* \ |
| 120 | ${sysconfdir}/clamd.conf* \ |
| 121 | ${systemd_unitdir}/system/clamav-daemon/* \ |
| 122 | ${docdir}/clamav-daemon/* ${sysconfdir}/clamav-daemon \ |
| 123 | ${sysconfdir}/logcheck/ignore.d.server/clamav-daemon " |
| 124 | |
| 125 | FILES_${PN}-freshclam = "${bindir}/freshclam \ |
| 126 | ${sysconfdir}/freshclam.conf* \ |
| 127 | ${sysconfdir}/clamav ${sysconfdir}/default/volatiles \ |
| 128 | ${localstatedir}/lib/clamav \ |
| 129 | ${docdir}/${PN}-freshclam ${mandir}/man1/freshclam.* \ |
| 130 | ${mandir}/man5/freshclam.conf.* \ |
| 131 | ${systemd_unitdir}/system/clamav-freshclam.service" |
| 132 | |
| 133 | FILES_${PN}-dev = " ${bindir}/clamav-config ${libdir}/*.la \ |
| 134 | ${libdir}/pkgconfig/*.pc \ |
| 135 | ${mandir}/man1/clamav-config.* \ |
| 136 | ${includedir}/*.h ${docdir}/libclamav* " |
| 137 | |
| 138 | FILES_${PN}-staticdev = "${libdir}/*.a" |
| 139 | |
| 140 | FILES_${PN}-libclamav = "${libdir}/libclamav.so* ${libdir}/libmspack.so*\ |
| 141 | ${docdir}/libclamav/* " |
| 142 | |
| 143 | FILES_${PN}-doc = "${mandir}/man/* \ |
| 144 | ${datadir}/man/* \ |
| 145 | ${docdir}/* " |
| 146 | |
| 147 | USERADD_PACKAGES = "${PN}" |
| 148 | GROUPADD_PARAM_${PN} = "--system ${UID}" |
| 149 | USERADD_PARAM_${PN} = "--system -g ${GID} --home-dir \ |
| 150 | ${localstatedir}/spool/${BPN} \ |
| 151 | --no-create-home --shell /bin/false ${BPN}" |
| 152 | |
| 153 | RPROVIDES_${PN} += "${PN}-systemd" |
| 154 | RREPLACES_${PN} += "${PN}-systemd" |
| 155 | RCONFLICTS_${PN} += "${PN}-systemd" |
| 156 | SYSTEMD_SERVICE_${PN} = "${BPN}.service" |
| 157 | |
| 158 | RDEPENDS_${PN} += "openssl ncurses-libncurses libbz2 ncurses-libtinfo clamav-freshclam clamav-libclamav" |