blob: 6219d9ed2328fe62b145b0ca132748ef9916fc52 [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
7DEPENDS = "libtool db libmspack chrpath-replacement-native"
8
9LIC_FILES_CHKSUM = "file://COPYING.LGPL;beginline=2;endline=3;md5=4b89c05acc71195e9a06edfa2fa7d092"
10
11SRCREV = "b66e5e27b48c0a07494f9df9b809ed933cede047"
12
13SRC_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
20S = "${WORKDIR}/git"
21
22LEAD_SONAME = "libclamav.so"
23SO_VER = "7.1.1"
24
25EXTRANATIVEPATH += "chrpath-native"
26
27inherit autotools-brokensep pkgconfig useradd systemd
28
29UID = "clamav"
30GID = "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
Brad Bishop19323692019-04-05 15:28:33 -040034# If you want LLVM support, use the one in core
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080035
Brad Bishop19323692019-04-05 15:28:33 -040036PACKAGECONFIG ?= "ncurses openssl bz2 zlib llvm"
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080037PACKAGECONFIG += " ${@bb.utils.contains("DISTRO_FEATURES", "ipv6", "ipv6", "", d)}"
38PACKAGECONFIG += "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd', '', d)}"
39
Brad Bishop19323692019-04-05 15:28:33 -040040PACKAGECONFIG[llvm] = "--with-system-llvm --with-llvm-linking=dynamic --disable-llvm, ,llvm8.0"
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080041
42PACKAGECONFIG[pcre] = "--with-pcre=${STAGING_LIBDIR}, --without-pcre, libpcre"
43PACKAGECONFIG[xml] = "--with-xml=${STAGING_LIBDIR}/.., --with-xml=no, libxml2,"
44PACKAGECONFIG[json] = "--with-libjson=${STAGING_LIBDIR}, --without-libjson, json,"
45PACKAGECONFIG[curl] = "--with-libcurl=${STAGING_LIBDIR}, --without-libcurl, curl,"
46PACKAGECONFIG[ipv6] = "--enable-ipv6, --disable-ipv6"
47PACKAGECONFIG[openssl] = "--with-openssl=${STAGING_DIR_HOST}/usr, --without-openssl, openssl, openssl"
48PACKAGECONFIG[zlib] = "--with-zlib=${STAGING_DIR_HOST}/usr --disable-zlib-vcheck , --without-zlib, zlib, "
49PACKAGECONFIG[bz2] = "--with-libbz2-prefix=${STAGING_LIBDIR}/.., --without-libbz2-prefix, "
50PACKAGECONFIG[ncurses] = "--with-libncurses-prefix=${STAGING_LIBDIR}/.., --without-libncurses-prefix, ncurses, "
51PACKAGECONFIG[systemd] = "--with-systemdsystemunitdir=${systemd_unitdir}/system/, --without-systemdsystemunitdir, "
52
53EXTRA_OECONF += " --with-user=${UID} --with-group=${GID} \
54 --without-libcheck-prefix --disable-unrar \
55 --disable-mempool \
56 --program-prefix="" \
57 --disable-yara \
58 --disable-rpath \
59 "
60
61do_configure () {
62 cd ${S}
63 ./configure ${CONFIGUREOPTS} ${EXTRA_OECONF}
64}
65
66do_compile_append() {
67 # brute force removing RPATH
68 chrpath -d ${B}/libclamav/.libs/libclamav.so.${SO_VER}
69 chrpath -d ${B}/sigtool/.libs/sigtool
70 chrpath -d ${B}/clambc/.libs/clambc
71 chrpath -d ${B}/clamscan/.libs/clamscan
72 chrpath -d ${B}/clamconf/.libs/clamconf
73 chrpath -d ${B}/clamd/.libs/clamd
74 chrpath -d ${B}/freshclam/.libs/freshclam
75}
76
77do_install_append() {
78 install -d ${D}/${sysconfdir}
79 install -d ${D}/${localstatedir}/lib/clamav
80 install -d ${D}${sysconfdir}/clamav ${D}${sysconfdir}/default/volatiles
81
82 install -m 644 ${WORKDIR}/clamd.conf ${D}/${sysconfdir}
83 install -m 644 ${WORKDIR}/freshclam.conf ${D}/${sysconfdir}
84 install -m 0644 ${WORKDIR}/volatiles.03_clamav ${D}${sysconfdir}/default/volatiles/volatiles.03_clamav
85 sed -i -e 's#${STAGING_DIR_HOST}##g' ${D}${libdir}/pkgconfig/libclamav.pc
86 rm ${D}/${libdir}/libclamav.so
87 if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)};then
88 install -D -m 0644 ${WORKDIR}/clamav.service ${D}${systemd_unitdir}/system/clamav.service
89 fi
90}
91
92pkg_postinst_ontarget_${PN} () {
93 if [ -e /etc/init.d/populate-volatile.sh ] ; then
94 ${sysconfdir}/init.d/populate-volatile.sh update
95 fi
96 chown ${UID}:${GID} ${localstatedir}/lib/clamav
97}
98
99
100PACKAGES = "${PN} ${PN}-dev ${PN}-dbg ${PN}-daemon ${PN}-doc \
101 ${PN}-clamdscan ${PN}-freshclam ${PN}-libclamav ${PN}-staticdev"
102
103FILES_${PN} = "${bindir}/clambc ${bindir}/clamscan ${bindir}/clamsubmit \
104 ${bindir}/*sigtool ${mandir}/man1/clambc* ${mandir}/man1/clamscan* \
105 ${mandir}/man1/sigtool* ${mandir}/man1/clambsubmit* \
106 ${docdir}/clamav/* "
107
108FILES_${PN}-clamdscan = " ${bindir}/clamdscan \
109 ${docdir}/clamdscan/* \
110 ${mandir}/man1/clamdscan* \
111 "
112
113FILES_${PN}-daemon = "${bindir}/clamconf ${bindir}/clamdtop ${sbindir}/clamd \
114 ${mandir}/man1/clamconf* ${mandir}/man1/clamdtop* \
115 ${mandir}/man5/clamd* ${mandir}/man8/clamd* \
116 ${sysconfdir}/clamd.conf* \
117 ${systemd_unitdir}/system/clamav-daemon/* \
118 ${docdir}/clamav-daemon/* ${sysconfdir}/clamav-daemon \
119 ${sysconfdir}/logcheck/ignore.d.server/clamav-daemon "
120
121FILES_${PN}-freshclam = "${bindir}/freshclam \
122 ${sysconfdir}/freshclam.conf* \
123 ${sysconfdir}/clamav ${sysconfdir}/default/volatiles \
124 ${localstatedir}/lib/clamav \
125 ${docdir}/${PN}-freshclam ${mandir}/man1/freshclam.* \
126 ${mandir}/man5/freshclam.conf.* \
127 ${systemd_unitdir}/system/clamav-freshclam.service"
128
129FILES_${PN}-dev = " ${bindir}/clamav-config ${libdir}/*.la \
130 ${libdir}/pkgconfig/*.pc \
131 ${mandir}/man1/clamav-config.* \
132 ${includedir}/*.h ${docdir}/libclamav* "
133
134FILES_${PN}-staticdev = "${libdir}/*.a"
135
136FILES_${PN}-libclamav = "${libdir}/libclamav.so* ${libdir}/libmspack.so*\
137 ${docdir}/libclamav/* "
138
139FILES_${PN}-doc = "${mandir}/man/* \
140 ${datadir}/man/* \
141 ${docdir}/* "
142
143USERADD_PACKAGES = "${PN}"
144GROUPADD_PARAM_${PN} = "--system ${UID}"
145USERADD_PARAM_${PN} = "--system -g ${GID} --home-dir \
146 ${localstatedir}/spool/${BPN} \
147 --no-create-home --shell /bin/false ${BPN}"
148
149RPROVIDES_${PN} += "${PN}-systemd"
150RREPLACES_${PN} += "${PN}-systemd"
151RCONFLICTS_${PN} += "${PN}-systemd"
152SYSTEMD_SERVICE_${PN} = "${BPN}.service"
153
154RDEPENDS_${PN} += "openssl ncurses-libncurses libbz2 ncurses-libtinfo clamav-freshclam clamav-libclamav"