blob: 688250da45af03430d935e5ad9103b512183450b [file] [log] [blame]
Richard Marian Thomaiyar14fddef2018-07-13 23:55:56 +05301SUMMARY = "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 = "224f73461a44e278e9fa50ba59f51ee5e64373e0"
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
34# If you want LLVM support, use meta-oe llvm3.3 to build for GCC 6.X,
35# as defined below
36
37CLAMAV_LLVM ?= "oellvm"
38CLAMAV_LLVM_RELEASE ?= "6.0"
39
40PACKAGECONFIG ?= "ncurses openssl bz2 zlib ${CLAMAV_LLVM}"
41PACKAGECONFIG += " ${@bb.utils.contains("DISTRO_FEATURES", "ipv6", "ipv6", "", d)}"
42PACKAGECONFIG += "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd', '', d)}"
43
44PACKAGECONFIG[oellvm] = "--with-system-llvm --with-llvm-linking=dynamic --disable-llvm, ,llvm${CLAMAV_LLVM_RELEASE}"
45
46PACKAGECONFIG[pcre] = "--with-pcre=${STAGING_LIBDIR}, --without-pcre, libpcre"
47PACKAGECONFIG[xml] = "--with-xml=${STAGING_LIBDIR}/.., --with-xml=no, libxml2,"
48PACKAGECONFIG[json] = "--with-libjson=${STAGING_LIBDIR}, --without-libjson, json,"
49PACKAGECONFIG[curl] = "--with-libcurl=${STAGING_LIBDIR}, --without-libcurl, curl,"
50PACKAGECONFIG[ipv6] = "--enable-ipv6, --disable-ipv6"
51PACKAGECONFIG[openssl] = "--with-openssl=${STAGING_DIR_HOST}/usr, --without-openssl, openssl, openssl"
52PACKAGECONFIG[zlib] = "--with-zlib=${STAGING_DIR_HOST}/usr --disable-zlib-vcheck , --without-zlib, zlib, "
53PACKAGECONFIG[bz2] = "--with-libbz2-prefix=${STAGING_LIBDIR}/.., --without-libbz2-prefix, "
54PACKAGECONFIG[ncurses] = "--with-libncurses-prefix=${STAGING_LIBDIR}/.., --without-libncurses-prefix, ncurses, "
55PACKAGECONFIG[systemd] = "--with-systemdsystemunitdir=${systemd_unitdir}/system/, --without-systemdsystemunitdir, "
56
57EXTRA_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
65do_configure () {
66 cd ${S}
67 ./configure ${CONFIGUREOPTS} ${EXTRA_OECONF}
68}
69
70do_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
81do_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
96pkg_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
104PACKAGES = "${PN} ${PN}-dev ${PN}-dbg ${PN}-daemon ${PN}-doc \
105 ${PN}-clamdscan ${PN}-freshclam ${PN}-libclamav ${PN}-staticdev"
106
107FILES_${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
112FILES_${PN}-clamdscan = " ${bindir}/clamdscan \
113 ${docdir}/clamdscan/* \
114 ${mandir}/man1/clamdscan* \
115 "
116
117FILES_${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
125FILES_${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
133FILES_${PN}-dev = " ${bindir}/clamav-config ${libdir}/*.la \
134 ${libdir}/pkgconfig/*.pc \
135 ${mandir}/man1/clamav-config.* \
136 ${includedir}/*.h ${docdir}/libclamav* "
137
138FILES_${PN}-staticdev = "${libdir}/*.a"
139
140FILES_${PN}-libclamav = "${libdir}/libclamav.so* ${libdir}/libmspack.so*\
141 ${docdir}/libclamav/* "
142
143FILES_${PN}-doc = "${mandir}/man/* \
144 ${datadir}/man/* \
145 ${docdir}/* "
146
147USERADD_PACKAGES = "${PN}"
148GROUPADD_PARAM_${PN} = "--system ${UID}"
149USERADD_PARAM_${PN} = "--system -g ${GID} --home-dir \
150 ${localstatedir}/spool/${BPN} \
151 --no-create-home --shell /bin/false ${BPN}"
152
153RPROVIDES_${PN} += "${PN}-systemd"
154RREPLACES_${PN} += "${PN}-systemd"
155RCONFLICTS_${PN} += "${PN}-systemd"
156SYSTEMD_SERVICE_${PN} = "${BPN}.service"
157
158RDEPENDS_${PN} += "openssl ncurses-libncurses libbz2 ncurses-libtinfo clamav-freshclam clamav-libclamav"