blob: 7d8767e2fdecebc420bece524ffc32130ce1dce4 [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 \
18 file://${BPN}.service \
Brad Bishopc342db32019-05-15 21:57:59 -040019 file://freshclam-native.conf \
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080020 "
21
22S = "${WORKDIR}/git"
23
24LEAD_SONAME = "libclamav.so"
25SO_VER = "7.1.1"
26
27EXTRANATIVEPATH += "chrpath-native"
28
29inherit autotools-brokensep pkgconfig useradd systemd
30
31UID = "clamav"
32GID = "clamav"
Brad Bishopc342db32019-05-15 21:57:59 -040033INSTALL_CLAMAV_CVD ?= "1"
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080034
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 Bishop19323692019-04-05 15:28:33 -040037# If you want LLVM support, use the one in core
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080038
Brad Bishopc342db32019-05-15 21:57:59 -040039CLAMAV_USR_DIR = "${STAGING_DIR_NATIVE}/usr"
40CLAMAV_USR_DIR_class-target = "${STAGING_DIR_HOST}/usr"
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080041
Brad Bishopc342db32019-05-15 21:57:59 -040042PACKAGECONFIG_class-target ?= "ncurses bz2"
43PACKAGECONFIG_class-target += " ${@bb.utils.contains("DISTRO_FEATURES", "ipv6", "ipv6", "", d)}"
44PACKAGECONFIG_class-target += "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd', '', d)}"
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080045
46PACKAGECONFIG[pcre] = "--with-pcre=${STAGING_LIBDIR}, --without-pcre, libpcre"
Brad Bishopc342db32019-05-15 21:57:59 -040047PACKAGECONFIG[xml] = "--with-xml=${CLAMAV_USR_DIR}, --disable-xml, libxml2,"
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080048PACKAGECONFIG[json] = "--with-libjson=${STAGING_LIBDIR}, --without-libjson, json,"
49PACKAGECONFIG[curl] = "--with-libcurl=${STAGING_LIBDIR}, --without-libcurl, curl,"
50PACKAGECONFIG[ipv6] = "--enable-ipv6, --disable-ipv6"
Brad Bishopc342db32019-05-15 21:57:59 -040051PACKAGECONFIG[bz2] = "--with-libbz2-prefix=${CLAMAV_USR_DIR}, --without-libbz2-prefix, "
52PACKAGECONFIG[ncurses] = "--with-libncurses-prefix=${CLAMAV_USR_DIR}, --without-libncurses-prefix, ncurses, "
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080053PACKAGECONFIG[systemd] = "--with-systemdsystemunitdir=${systemd_unitdir}/system/, --without-systemdsystemunitdir, "
54
Brad Bishopc342db32019-05-15 21:57:59 -040055EXTRA_OECONF_CLAMAV = "--without-libcheck-prefix --disable-unrar \
56 --with-system-llvm --with-llvm-linking=dynamic --disable-llvm \
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080057 --disable-mempool \
58 --program-prefix="" \
59 --disable-yara \
Brad Bishopc342db32019-05-15 21:57:59 -040060 --disable-xml \
61 --with-openssl=${CLAMAV_USR_DIR} \
62 --with-zlib=${CLAMAV_USR_DIR} --disable-zlib-vcheck \
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080063 "
64
Brad Bishopc342db32019-05-15 21:57:59 -040065EXTRA_OECONF_class-native += "${EXTRA_OECONF_CLAMAV}"
66EXTRA_OECONF_class-target += "--with-user=${UID} --with-group=${GID} --disable-rpath ${EXTRA_OECONF_CLAMAV}"
67
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080068do_configure () {
69 cd ${S}
70 ./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 () {
75 cd ${S}
76 ./configure ${CONFIGUREOPTS} ${EXTRA_OECONF}
77}
78
79
80do_compile_append_class-target() {
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080081 # 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 Bishopc342db32019-05-15 21:57:59 -040089
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 Bishop1a4b7ee2018-12-16 17:11:34 -080094}
95
Brad Bishopc342db32019-05-15 21:57:59 -040096do_install_append_class-target () {
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080097 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 Bishopc342db32019-05-15 21:57:59 -0400106 install -m 666 ${S}/clamav_db/* ${D}/${localstatedir}/lib/clamav/.
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800107 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
112pkg_postinst_ontarget_${PN} () {
113 if [ -e /etc/init.d/populate-volatile.sh ] ; then
114 ${sysconfdir}/init.d/populate-volatile.sh update
115 fi
Brad Bishopc342db32019-05-15 21:57:59 -0400116 mkdir -p ${localstatedir}/lib/clamav
117 chown -R ${UID}:${GID} ${localstatedir}/lib/clamav
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800118}
119
120
Brad Bishopc342db32019-05-15 21:57:59 -0400121PACKAGES = "${PN} ${PN}-dev ${PN}-dbg ${PN}-daemon ${PN}-doc ${PN}-cvd \
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800122 ${PN}-clamdscan ${PN}-freshclam ${PN}-libclamav ${PN}-staticdev"
123
124FILES_${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
129FILES_${PN}-clamdscan = " ${bindir}/clamdscan \
130 ${docdir}/clamdscan/* \
131 ${mandir}/man1/clamdscan* \
132 "
133
134FILES_${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
142FILES_${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
150FILES_${PN}-dev = " ${bindir}/clamav-config ${libdir}/*.la \
151 ${libdir}/pkgconfig/*.pc \
152 ${mandir}/man1/clamav-config.* \
153 ${includedir}/*.h ${docdir}/libclamav* "
154
155FILES_${PN}-staticdev = "${libdir}/*.a"
156
157FILES_${PN}-libclamav = "${libdir}/libclamav.so* ${libdir}/libmspack.so*\
158 ${docdir}/libclamav/* "
159
160FILES_${PN}-doc = "${mandir}/man/* \
161 ${datadir}/man/* \
162 ${docdir}/* "
163
Brad Bishopc342db32019-05-15 21:57:59 -0400164FILES_${PN}-cvd = "${localstatedir}/lib/clamav/*.cvd ${localstatedir}/lib/clamav/*.dat"
165
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800166USERADD_PACKAGES = "${PN}"
167GROUPADD_PARAM_${PN} = "--system ${UID}"
168USERADD_PARAM_${PN} = "--system -g ${GID} --home-dir \
169 ${localstatedir}/spool/${BPN} \
170 --no-create-home --shell /bin/false ${BPN}"
171
172RPROVIDES_${PN} += "${PN}-systemd"
173RREPLACES_${PN} += "${PN}-systemd"
174RCONFLICTS_${PN} += "${PN}-systemd"
175SYSTEMD_SERVICE_${PN} = "${BPN}.service"
176
Brad Bishopc342db32019-05-15 21:57:59 -0400177RDEPENDS_${PN} = "openssl ncurses-libncurses libbz2 ncurses-libtinfo clamav-freshclam clamav-libclamav"
178RDEPENDS_${PN}_class-native = ""
179
180BBCLASSEXTEND = "native"