Andrew Geissler | f1e4406 | 2021-04-15 15:52:46 -0500 | [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 = "glibc llvm libtool db openssl zlib curl libxml2 bison pcre2 json-c libcheck" |
| 8 | |
| 9 | LIC_FILES_CHKSUM = "file://COPYING.txt;beginline=2;endline=3;md5=f7029fbbc5898b273d5902896f7bbe17" |
| 10 | |
| 11 | SRCREV = "5553a5e206ceae5d920368baee7d403f823bcb6f" |
| 12 | |
| 13 | SRC_URI = "git://github.com/vrtadmin/clamav-devel;branch=dev/0.104 \ |
| 14 | file://clamd.conf \ |
| 15 | file://freshclam.conf \ |
| 16 | file://volatiles.03_clamav \ |
| 17 | file://tmpfiles.clamav \ |
| 18 | file://${BPN}.service \ |
| 19 | file://headers_fixup.patch \ |
| 20 | file://oe_cmake_fixup.patch \ |
| 21 | " |
| 22 | S = "${WORKDIR}/git" |
| 23 | |
| 24 | LEAD_SONAME = "libclamav.so" |
| 25 | SO_VER = "9.6.0" |
| 26 | |
| 27 | BINCONFIG = "${bindir}/clamav-config" |
| 28 | |
| 29 | inherit cmake chrpath pkgconfig useradd systemd multilib_header multilib_script |
| 30 | |
| 31 | CLAMAV_UID ?= "clamav" |
| 32 | CLAMAV_GID ?= "clamav" |
| 33 | |
| 34 | MULTILIB_SCRIPTS = "${PN}-dev:${bindir}/clamav-config" |
| 35 | |
| 36 | EXTRA_OECMAKE = " -DCMAKE_BUILD_TYPE=Release -DOPTIMIZE=ON -DENABLE_JSON_SHARED=OFF \ |
| 37 | -DCLAMAV_GROUP=${CLAMAV_GID} -DCLAMAV_USER=${CLAMAV_UID} \ |
| 38 | -DENABLE_TESTS=OFF -DBUILD_SHARED_LIBS=ON \ |
| 39 | -DDISABLE_MPOOL=ON -DENABLE_FRESHCLAM_DNS_FIX=ON \ |
| 40 | " |
| 41 | |
| 42 | PACKAGECONFIG ?= " clamonacc \ |
| 43 | ${@bb.utils.contains("DISTRO_FEATURES", "systemd", "systemd", "", d)}" |
| 44 | |
| 45 | PACKAGECONFIG[milter] = "-DENABLE_MILTER=ON ,-DENABLE_MILTER=OFF, curl, curl" |
| 46 | PACKAGECONFIG[clamonacc] = "-DENABLE_CLAMONACC=ON ,-DENABLE_CLAMONACC=OFF," |
| 47 | PACKAGECONFIG[unrar] = "-DENABLE_UNRAR=ON ,-DENABLE_UNRAR=OFF," |
| 48 | PACKAGECONFIG[systemd] = "-DENABLE_SYSTEMD=ON -DSYSTEMD_UNIT_DIR=${systemd_system_unitdir}, -DENABLE_SYSTEMD=OFF, systemd" |
| 49 | |
| 50 | export OECMAKE_C_FLAGS += " -I${STAGING_INCDIR} -L ${RECIPE_SYSROOT}${nonarch_libdir} -L${STAGING_LIBDIR} -lpthread" |
| 51 | |
| 52 | do_install_append () { |
| 53 | install -d ${D}/${sysconfdir} |
| 54 | install -d ${D}/${localstatedir}/lib/clamav |
| 55 | install -d ${D}${sysconfdir}/clamav ${D}${sysconfdir}/default/volatiles |
| 56 | |
| 57 | install -m 644 ${WORKDIR}/clamd.conf ${D}/${prefix}/${sysconfdir} |
| 58 | install -m 644 ${WORKDIR}/freshclam.conf ${D}/${prefix}/${sysconfdir} |
| 59 | install -m 0644 ${WORKDIR}/volatiles.03_clamav ${D}${sysconfdir}/default/volatiles/03_clamav |
| 60 | sed -i -e 's#${STAGING_DIR_HOST}##g' ${D}${libdir}/pkgconfig/libclamav.pc |
| 61 | rm ${D}/${libdir}/libclamav.so |
| 62 | if [ "${INSTALL_CLAMAV_CVD}" = "1" ]; then |
| 63 | install -m 666 ${S}/clamav_db/* ${D}/${localstatedir}/lib/clamav/. |
| 64 | fi |
| 65 | |
| 66 | rm ${D}/${libdir}/libfreshclam.so |
| 67 | rm ${D}/${libdir}/libmspack.so |
| 68 | |
| 69 | if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)};then |
| 70 | install -D -m 0644 ${WORKDIR}/clamav.service ${D}${systemd_unitdir}/system/clamav.service |
| 71 | install -d ${D}${sysconfdir}/tmpfiles.d |
| 72 | install -m 0644 ${WORKDIR}/tmpfiles.clamav ${D}${sysconfdir}/tmpfiles.d/clamav.conf |
| 73 | fi |
| 74 | oe_multilib_header clamav-types.h |
| 75 | } |
| 76 | |
| 77 | pkg_postinst_ontarget_${PN} () { |
| 78 | if command -v systemd-tmpfiles >/dev/null; then |
| 79 | systemd-tmpfiles --create ${sysconfdir}/tmpfiles.d/clamav.conf |
| 80 | elif [ -e ${sysconfdir}/init.d/populate-volatile.sh ]; then |
| 81 | ${sysconfdir}/init.d/populate-volatile.sh update |
| 82 | fi |
| 83 | mkdir -p ${localstatedir}/lib/clamav |
| 84 | chown -R ${CLAMAV_UID}:${CLAMAV_GID} ${localstatedir}/lib/clamav |
| 85 | } |
| 86 | |
| 87 | |
| 88 | PACKAGES = "${PN} ${PN}-dev ${PN}-dbg ${PN}-daemon ${PN}-doc \ |
| 89 | ${PN}-clamdscan ${PN}-freshclam ${PN}-libclamav ${PN}-staticdev" |
| 90 | |
| 91 | FILES_${PN} = "${bindir}/clambc ${bindir}/clamscan ${bindir}/clamsubmit ${sbindir}/clamonacc \ |
| 92 | ${bindir}/*sigtool ${mandir}/man1/clambc* ${mandir}/man1/clamscan* \ |
| 93 | ${mandir}/man1/sigtool* ${mandir}/man1/clambsubmit* \ |
| 94 | ${docdir}/clamav/* ${libdir}/libmspack* " |
| 95 | |
| 96 | FILES_${PN}-clamdscan = " ${bindir}/clamdscan \ |
| 97 | ${docdir}/clamdscan/* \ |
| 98 | ${mandir}/man1/clamdscan* \ |
| 99 | " |
| 100 | |
| 101 | FILES_${PN}-daemon = "${bindir}/clamconf ${bindir}/clamdtop ${sbindir}/clamd \ |
| 102 | ${mandir}/man1/clamconf* ${mandir}/man1/clamdtop* \ |
| 103 | ${mandir}/man5/clamd* ${mandir}/man8/clamd* \ |
| 104 | ${sysconfdir}/clamd.conf* \ |
| 105 | /usr/etc/clamd.conf* \ |
| 106 | ${systemd_unitdir}/system/clamav-daemon/* \ |
| 107 | ${docdir}/clamav-daemon/* ${sysconfdir}/clamav-daemon \ |
| 108 | ${sysconfdir}/logcheck/ignore.d.server/clamav-daemon \ |
| 109 | ${systemd_unitdir}/system/clamav-daemon.service \ |
| 110 | ${systemd_unitdir}/system/clamav-clamonacc.service \ |
| 111 | " |
| 112 | |
| 113 | FILES_${PN}-freshclam = "${bindir}/freshclam \ |
| 114 | ${sysconfdir}/freshclam.conf* \ |
| 115 | /usr/etc/freshclam.conf* \ |
| 116 | ${sysconfdir}/clamav ${sysconfdir}/default/volatiles \ |
| 117 | ${sysconfdir}/tmpfiles.d/*.conf \ |
| 118 | ${localstatedir}/lib/clamav \ |
| 119 | ${docdir}/${PN}-freshclam ${mandir}/man1/freshclam.* \ |
| 120 | ${mandir}/man5/freshclam.conf.* \ |
| 121 | ${systemd_unitdir}/system/clamav-freshclam.service" |
| 122 | |
| 123 | FILES_${PN}-dev = " ${bindir}/clamav-config ${libdir}/*.la \ |
| 124 | ${libdir}/pkgconfig/*.pc \ |
| 125 | ${mandir}/man1/clamav-config.* \ |
| 126 | ${includedir}/*.h ${docdir}/libclamav* " |
| 127 | |
| 128 | FILES_${PN}-staticdev = "${libdir}/*.a" |
| 129 | |
| 130 | FILES_${PN}-libclamav = "${libdir}/libclamav.so* ${libdir}/libclammspack.so* \ |
| 131 | ${libdir}/libfreshclam.so* ${docdir}/libclamav/* " |
| 132 | |
| 133 | FILES_${PN}-doc = "${mandir}/man/* \ |
| 134 | ${datadir}/man/* \ |
| 135 | ${docdir}/* " |
| 136 | |
| 137 | USERADD_PACKAGES = "${PN}" |
| 138 | GROUPADD_PARAM_${PN} = "--system ${CLAMAV_UID}" |
| 139 | USERADD_PARAM_${PN} = "--system -g ${CLAMAV_GID} --home-dir \ |
| 140 | ${localstatedir}/spool/${BPN} \ |
| 141 | --no-create-home --shell /bin/false ${BPN}" |
| 142 | |
| 143 | RPROVIDES_${PN} += "${PN}-systemd" |
| 144 | RREPLACES_${PN} += "${PN}-systemd" |
| 145 | RCONFLICTS_${PN} += "${PN}-systemd" |
| 146 | SYSTEMD_SERVICE_${PN} = "${BPN}.service" |
| 147 | |
| 148 | RDEPENDS_${PN} = "openssl ncurses-libncurses libxml2 libbz2 ncurses-libtinfo curl libpcre2 clamav-freshclam clamav-libclamav" |