blob: a340b4856603d3a0518fd1a5a8b84257e7c9cec0 [file] [log] [blame]
Brad Bishop1a4b7ee2018-12-16 17:11:34 -08001SUMMARY = "ClamAV anti-virus utility for Unix - command-line interface"
2DESCRIPTION = "ClamAV is an open source antivirus engine for detecting trojans, viruses, malware & other malicious threats."
3HOMEPAGE = "http://www.clamav.net/index.html"
4SECTION = "security"
5LICENSE = "LGPL-2.1"
6
Brad Bishopc342db32019-05-15 21:57:59 -04007DEPENDS = "libtool db libmspack openssl zlib llvm chrpath-replacement-native clamav-native"
8DEPENDS_class-native = "db-native openssl-native zlib-native"
9
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080010LIC_FILES_CHKSUM = "file://COPYING.LGPL;beginline=2;endline=3;md5=4b89c05acc71195e9a06edfa2fa7d092"
11
12SRCREV = "b66e5e27b48c0a07494f9df9b809ed933cede047"
13
14SRC_URI = "git://github.com/vrtadmin/clamav-devel;branch=rel/0.99 \
15 file://clamd.conf \
16 file://freshclam.conf \
17 file://volatiles.03_clamav \
Brad Bishop95dbbac2019-12-02 13:55:25 -050018 file://tmpfiles.clamav \
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080019 file://${BPN}.service \
Brad Bishopc342db32019-05-15 21:57:59 -040020 file://freshclam-native.conf \
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080021 "
22
23S = "${WORKDIR}/git"
24
25LEAD_SONAME = "libclamav.so"
26SO_VER = "7.1.1"
27
28EXTRANATIVEPATH += "chrpath-native"
29
30inherit autotools-brokensep pkgconfig useradd systemd
31
32UID = "clamav"
33GID = "clamav"
Brad Bishopc342db32019-05-15 21:57:59 -040034INSTALL_CLAMAV_CVD ?= "1"
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080035
36# Clamav has a built llvm version 2 but does not build with gcc 6.x,
37# disable the internal one. This is a known issue
Brad Bishop19323692019-04-05 15:28:33 -040038# If you want LLVM support, use the one in core
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080039
Brad Bishopc342db32019-05-15 21:57:59 -040040CLAMAV_USR_DIR = "${STAGING_DIR_NATIVE}/usr"
41CLAMAV_USR_DIR_class-target = "${STAGING_DIR_HOST}/usr"
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080042
Brad Bishopc342db32019-05-15 21:57:59 -040043PACKAGECONFIG_class-target ?= "ncurses bz2"
44PACKAGECONFIG_class-target += " ${@bb.utils.contains("DISTRO_FEATURES", "ipv6", "ipv6", "", d)}"
45PACKAGECONFIG_class-target += "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd', '', d)}"
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080046
47PACKAGECONFIG[pcre] = "--with-pcre=${STAGING_LIBDIR}, --without-pcre, libpcre"
Brad Bishopc342db32019-05-15 21:57:59 -040048PACKAGECONFIG[xml] = "--with-xml=${CLAMAV_USR_DIR}, --disable-xml, libxml2,"
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080049PACKAGECONFIG[json] = "--with-libjson=${STAGING_LIBDIR}, --without-libjson, json,"
50PACKAGECONFIG[curl] = "--with-libcurl=${STAGING_LIBDIR}, --without-libcurl, curl,"
51PACKAGECONFIG[ipv6] = "--enable-ipv6, --disable-ipv6"
Brad Bishopc342db32019-05-15 21:57:59 -040052PACKAGECONFIG[bz2] = "--with-libbz2-prefix=${CLAMAV_USR_DIR}, --without-libbz2-prefix, "
53PACKAGECONFIG[ncurses] = "--with-libncurses-prefix=${CLAMAV_USR_DIR}, --without-libncurses-prefix, ncurses, "
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080054PACKAGECONFIG[systemd] = "--with-systemdsystemunitdir=${systemd_unitdir}/system/, --without-systemdsystemunitdir, "
55
Brad Bishopc342db32019-05-15 21:57:59 -040056EXTRA_OECONF_CLAMAV = "--without-libcheck-prefix --disable-unrar \
57 --with-system-llvm --with-llvm-linking=dynamic --disable-llvm \
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080058 --disable-mempool \
59 --program-prefix="" \
60 --disable-yara \
Brad Bishopc342db32019-05-15 21:57:59 -040061 --disable-xml \
62 --with-openssl=${CLAMAV_USR_DIR} \
63 --with-zlib=${CLAMAV_USR_DIR} --disable-zlib-vcheck \
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080064 "
65
Brad Bishopc342db32019-05-15 21:57:59 -040066EXTRA_OECONF_class-native += "${EXTRA_OECONF_CLAMAV}"
67EXTRA_OECONF_class-target += "--with-user=${UID} --with-group=${GID} --disable-rpath ${EXTRA_OECONF_CLAMAV}"
68
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080069do_configure () {
Brad Bishop26bdd442019-08-16 17:08:17 -040070 ${S}/configure ${CONFIGUREOPTS} ${EXTRA_OECONF}
Brad Bishopc342db32019-05-15 21:57:59 -040071 install -d ${S}/clamav_db
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080072}
73
Brad Bishopc342db32019-05-15 21:57:59 -040074do_configure_class-native () {
Brad Bishop26bdd442019-08-16 17:08:17 -040075 ${S}/configure ${CONFIGUREOPTS} ${EXTRA_OECONF}
Brad Bishopc342db32019-05-15 21:57:59 -040076}
77
78
79do_compile_append_class-target() {
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080080 # brute force removing RPATH
81 chrpath -d ${B}/libclamav/.libs/libclamav.so.${SO_VER}
82 chrpath -d ${B}/sigtool/.libs/sigtool
83 chrpath -d ${B}/clambc/.libs/clambc
84 chrpath -d ${B}/clamscan/.libs/clamscan
85 chrpath -d ${B}/clamconf/.libs/clamconf
86 chrpath -d ${B}/clamd/.libs/clamd
87 chrpath -d ${B}/freshclam/.libs/freshclam
Brad Bishopc342db32019-05-15 21:57:59 -040088
89 if [ "${INSTALL_CLAMAV_CVD}" = "1" ]; then
90 bbnote "CLAMAV creating cvd"
91 ${STAGING_BINDIR_NATIVE}/freshclam --datadir=${S}/clamav_db --config=${WORKDIR}/freshclam-native.conf
92 fi
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080093}
94
Brad Bishopc342db32019-05-15 21:57:59 -040095do_install_append_class-target () {
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080096 install -d ${D}/${sysconfdir}
97 install -d ${D}/${localstatedir}/lib/clamav
98 install -d ${D}${sysconfdir}/clamav ${D}${sysconfdir}/default/volatiles
99
100 install -m 644 ${WORKDIR}/clamd.conf ${D}/${sysconfdir}
101 install -m 644 ${WORKDIR}/freshclam.conf ${D}/${sysconfdir}
102 install -m 0644 ${WORKDIR}/volatiles.03_clamav ${D}${sysconfdir}/default/volatiles/volatiles.03_clamav
103 sed -i -e 's#${STAGING_DIR_HOST}##g' ${D}${libdir}/pkgconfig/libclamav.pc
104 rm ${D}/${libdir}/libclamav.so
Brad Bishopc342db32019-05-15 21:57:59 -0400105 install -m 666 ${S}/clamav_db/* ${D}/${localstatedir}/lib/clamav/.
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800106 if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)};then
107 install -D -m 0644 ${WORKDIR}/clamav.service ${D}${systemd_unitdir}/system/clamav.service
Brad Bishop95dbbac2019-12-02 13:55:25 -0500108 install -d ${D}${sysconfdir}/tmpfiles.d
109 install -m 0644 ${WORKDIR}/tmpfiles.clamav ${D}${sysconfdir}/tmpfiles.d/clamav.conf
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800110 fi
111}
112
113pkg_postinst_ontarget_${PN} () {
Brad Bishop95dbbac2019-12-02 13:55:25 -0500114 if command -v systemd-tmpfiles >/dev/null; then
115 systemd-tmpfiles --create ${sysconfdir}/tmpfiles.d/clamav.conf
116 elif [ -e ${sysconfdir}/init.d/populate-volatile.sh ]; then
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800117 ${sysconfdir}/init.d/populate-volatile.sh update
118 fi
Brad Bishopc342db32019-05-15 21:57:59 -0400119 mkdir -p ${localstatedir}/lib/clamav
120 chown -R ${UID}:${GID} ${localstatedir}/lib/clamav
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800121}
122
123
Brad Bishopc342db32019-05-15 21:57:59 -0400124PACKAGES = "${PN} ${PN}-dev ${PN}-dbg ${PN}-daemon ${PN}-doc ${PN}-cvd \
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800125 ${PN}-clamdscan ${PN}-freshclam ${PN}-libclamav ${PN}-staticdev"
126
127FILES_${PN} = "${bindir}/clambc ${bindir}/clamscan ${bindir}/clamsubmit \
128 ${bindir}/*sigtool ${mandir}/man1/clambc* ${mandir}/man1/clamscan* \
129 ${mandir}/man1/sigtool* ${mandir}/man1/clambsubmit* \
130 ${docdir}/clamav/* "
131
132FILES_${PN}-clamdscan = " ${bindir}/clamdscan \
133 ${docdir}/clamdscan/* \
134 ${mandir}/man1/clamdscan* \
135 "
136
137FILES_${PN}-daemon = "${bindir}/clamconf ${bindir}/clamdtop ${sbindir}/clamd \
138 ${mandir}/man1/clamconf* ${mandir}/man1/clamdtop* \
139 ${mandir}/man5/clamd* ${mandir}/man8/clamd* \
140 ${sysconfdir}/clamd.conf* \
141 ${systemd_unitdir}/system/clamav-daemon/* \
142 ${docdir}/clamav-daemon/* ${sysconfdir}/clamav-daemon \
143 ${sysconfdir}/logcheck/ignore.d.server/clamav-daemon "
144
145FILES_${PN}-freshclam = "${bindir}/freshclam \
146 ${sysconfdir}/freshclam.conf* \
147 ${sysconfdir}/clamav ${sysconfdir}/default/volatiles \
Brad Bishop95dbbac2019-12-02 13:55:25 -0500148 ${sysconfdir}/tmpfiles.d/*.conf \
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800149 ${localstatedir}/lib/clamav \
150 ${docdir}/${PN}-freshclam ${mandir}/man1/freshclam.* \
151 ${mandir}/man5/freshclam.conf.* \
152 ${systemd_unitdir}/system/clamav-freshclam.service"
153
154FILES_${PN}-dev = " ${bindir}/clamav-config ${libdir}/*.la \
155 ${libdir}/pkgconfig/*.pc \
156 ${mandir}/man1/clamav-config.* \
157 ${includedir}/*.h ${docdir}/libclamav* "
158
159FILES_${PN}-staticdev = "${libdir}/*.a"
160
161FILES_${PN}-libclamav = "${libdir}/libclamav.so* ${libdir}/libmspack.so*\
162 ${docdir}/libclamav/* "
163
164FILES_${PN}-doc = "${mandir}/man/* \
165 ${datadir}/man/* \
166 ${docdir}/* "
167
Brad Bishopc342db32019-05-15 21:57:59 -0400168FILES_${PN}-cvd = "${localstatedir}/lib/clamav/*.cvd ${localstatedir}/lib/clamav/*.dat"
169
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800170USERADD_PACKAGES = "${PN}"
171GROUPADD_PARAM_${PN} = "--system ${UID}"
172USERADD_PARAM_${PN} = "--system -g ${GID} --home-dir \
173 ${localstatedir}/spool/${BPN} \
174 --no-create-home --shell /bin/false ${BPN}"
175
176RPROVIDES_${PN} += "${PN}-systemd"
177RREPLACES_${PN} += "${PN}-systemd"
178RCONFLICTS_${PN} += "${PN}-systemd"
179SYSTEMD_SERVICE_${PN} = "${BPN}.service"
180
Brad Bishopc342db32019-05-15 21:57:59 -0400181RDEPENDS_${PN} = "openssl ncurses-libncurses libbz2 ncurses-libtinfo clamav-freshclam clamav-libclamav"
182RDEPENDS_${PN}_class-native = ""
183
184BBCLASSEXTEND = "native"