blob: ce5b0ea4d491dd97b13381ff08bc5f1e15daf0a2 [file] [log] [blame]
Andrew Geisslerf1e44062021-04-15 15:52:46 -05001SUMMARY = "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 = "glibc llvm libtool db openssl zlib curl libxml2 bison pcre2 json-c libcheck"
8
9LIC_FILES_CHKSUM = "file://COPYING.txt;beginline=2;endline=3;md5=f7029fbbc5898b273d5902896f7bbe17"
10
William A. Kennington IIIee32beb2021-06-02 12:48:35 -070011# May 2nd
12SRCREV = "de0086aa918b79cd22570d0c05977a288b197e23"
Andrew Geisslerf1e44062021-04-15 15:52:46 -050013
14SRC_URI = "git://github.com/vrtadmin/clamav-devel;branch=dev/0.104 \
15 file://clamd.conf \
16 file://freshclam.conf \
17 file://volatiles.03_clamav \
18 file://tmpfiles.clamav \
Andrew Geisslerf1e44062021-04-15 15:52:46 -050019 file://headers_fixup.patch \
20 file://oe_cmake_fixup.patch \
William A. Kennington IIIee32beb2021-06-02 12:48:35 -070021 file://fix_systemd_socket.patch \
Andrew Geisslerf1e44062021-04-15 15:52:46 -050022"
23S = "${WORKDIR}/git"
24
25LEAD_SONAME = "libclamav.so"
26SO_VER = "9.6.0"
27
28BINCONFIG = "${bindir}/clamav-config"
29
30inherit cmake chrpath pkgconfig useradd systemd multilib_header multilib_script
31
William A. Kennington IIIee32beb2021-06-02 12:48:35 -070032UPSTREAM_CHECK_COMMITS = "1"
33
Andrew Geisslerf1e44062021-04-15 15:52:46 -050034CLAMAV_UID ?= "clamav"
35CLAMAV_GID ?= "clamav"
36
37MULTILIB_SCRIPTS = "${PN}-dev:${bindir}/clamav-config"
38
39EXTRA_OECMAKE = " -DCMAKE_BUILD_TYPE=Release -DOPTIMIZE=ON -DENABLE_JSON_SHARED=OFF \
40 -DCLAMAV_GROUP=${CLAMAV_GID} -DCLAMAV_USER=${CLAMAV_UID} \
41 -DENABLE_TESTS=OFF -DBUILD_SHARED_LIBS=ON \
42 -DDISABLE_MPOOL=ON -DENABLE_FRESHCLAM_DNS_FIX=ON \
43 "
44
45PACKAGECONFIG ?= " clamonacc \
46 ${@bb.utils.contains("DISTRO_FEATURES", "systemd", "systemd", "", d)}"
47
48PACKAGECONFIG[milter] = "-DENABLE_MILTER=ON ,-DENABLE_MILTER=OFF, curl, curl"
49PACKAGECONFIG[clamonacc] = "-DENABLE_CLAMONACC=ON ,-DENABLE_CLAMONACC=OFF,"
50PACKAGECONFIG[unrar] = "-DENABLE_UNRAR=ON ,-DENABLE_UNRAR=OFF,"
51PACKAGECONFIG[systemd] = "-DENABLE_SYSTEMD=ON -DSYSTEMD_UNIT_DIR=${systemd_system_unitdir}, -DENABLE_SYSTEMD=OFF, systemd"
52
53export OECMAKE_C_FLAGS += " -I${STAGING_INCDIR} -L ${RECIPE_SYSROOT}${nonarch_libdir} -L${STAGING_LIBDIR} -lpthread"
54
55do_install_append () {
56 install -d ${D}/${sysconfdir}
57 install -d ${D}/${localstatedir}/lib/clamav
58 install -d ${D}${sysconfdir}/clamav ${D}${sysconfdir}/default/volatiles
59
60 install -m 644 ${WORKDIR}/clamd.conf ${D}/${prefix}/${sysconfdir}
61 install -m 644 ${WORKDIR}/freshclam.conf ${D}/${prefix}/${sysconfdir}
62 install -m 0644 ${WORKDIR}/volatiles.03_clamav ${D}${sysconfdir}/default/volatiles/03_clamav
63 sed -i -e 's#${STAGING_DIR_HOST}##g' ${D}${libdir}/pkgconfig/libclamav.pc
64 rm ${D}/${libdir}/libclamav.so
65 if [ "${INSTALL_CLAMAV_CVD}" = "1" ]; then
66 install -m 666 ${S}/clamav_db/* ${D}/${localstatedir}/lib/clamav/.
67 fi
68
69 rm ${D}/${libdir}/libfreshclam.so
70 rm ${D}/${libdir}/libmspack.so
71
72 if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)};then
Andrew Geisslerf1e44062021-04-15 15:52:46 -050073 install -d ${D}${sysconfdir}/tmpfiles.d
74 install -m 0644 ${WORKDIR}/tmpfiles.clamav ${D}${sysconfdir}/tmpfiles.d/clamav.conf
75 fi
76 oe_multilib_header clamav-types.h
77}
78
William A. Kennington IIIee32beb2021-06-02 12:48:35 -070079pkg_postinst_${PN} () {
80 if [ -z "$D" ]; then
81 if command -v systemd-tmpfiles >/dev/null; then
82 systemd-tmpfiles --create ${sysconfdir}/tmpfiles.d/clamav.conf
83 elif [ -e ${sysconfdir}/init.d/populate-volatile.sh ]; then
84 ${sysconfdir}/init.d/populate-volatile.sh update
85 fi
86 chown -R ${CLAMAV_UID}:${CLAMAV_GID} ${localstatedir}/lib/clamav
Andrew Geisslerf1e44062021-04-15 15:52:46 -050087 fi
Andrew Geisslerf1e44062021-04-15 15:52:46 -050088}
89
William A. Kennington IIIee32beb2021-06-02 12:48:35 -070090PACKAGES += "${PN}-daemon ${PN}-clamdscan ${PN}-freshclam ${PN}-libclamav"
Andrew Geisslerf1e44062021-04-15 15:52:46 -050091
92FILES_${PN} = "${bindir}/clambc ${bindir}/clamscan ${bindir}/clamsubmit ${sbindir}/clamonacc \
93 ${bindir}/*sigtool ${mandir}/man1/clambc* ${mandir}/man1/clamscan* \
94 ${mandir}/man1/sigtool* ${mandir}/man1/clambsubmit* \
William A. Kennington IIIee32beb2021-06-02 12:48:35 -070095 ${docdir}/clamav/*"
Andrew Geisslerf1e44062021-04-15 15:52:46 -050096
97FILES_${PN}-clamdscan = " ${bindir}/clamdscan \
98 ${docdir}/clamdscan/* \
99 ${mandir}/man1/clamdscan* \
100 "
101
102FILES_${PN}-daemon = "${bindir}/clamconf ${bindir}/clamdtop ${sbindir}/clamd \
103 ${mandir}/man1/clamconf* ${mandir}/man1/clamdtop* \
104 ${mandir}/man5/clamd* ${mandir}/man8/clamd* \
105 ${sysconfdir}/clamd.conf* \
106 /usr/etc/clamd.conf* \
William A. Kennington IIIee32beb2021-06-02 12:48:35 -0700107 ${systemd_system_unitdir}/clamav-daemon/* \
Andrew Geisslerf1e44062021-04-15 15:52:46 -0500108 ${docdir}/clamav-daemon/* ${sysconfdir}/clamav-daemon \
109 ${sysconfdir}/logcheck/ignore.d.server/clamav-daemon \
William A. Kennington IIIee32beb2021-06-02 12:48:35 -0700110 ${systemd_system_unitdir}/clamav-daemon.service \
111 ${systemd_system_unitdir}/clamav-clamonacc.service \
Andrew Geisslerf1e44062021-04-15 15:52:46 -0500112 "
113
114FILES_${PN}-freshclam = "${bindir}/freshclam \
115 ${sysconfdir}/freshclam.conf* \
116 /usr/etc/freshclam.conf* \
117 ${sysconfdir}/clamav ${sysconfdir}/default/volatiles \
118 ${sysconfdir}/tmpfiles.d/*.conf \
119 ${localstatedir}/lib/clamav \
120 ${docdir}/${PN}-freshclam ${mandir}/man1/freshclam.* \
121 ${mandir}/man5/freshclam.conf.* \
William A. Kennington IIIee32beb2021-06-02 12:48:35 -0700122 ${systemd_system_unitdir}/clamav-freshclam.service"
Andrew Geisslerf1e44062021-04-15 15:52:46 -0500123
124FILES_${PN}-dev = " ${bindir}/clamav-config ${libdir}/*.la \
125 ${libdir}/pkgconfig/*.pc \
126 ${mandir}/man1/clamav-config.* \
127 ${includedir}/*.h ${docdir}/libclamav* "
128
129FILES_${PN}-staticdev = "${libdir}/*.a"
130
131FILES_${PN}-libclamav = "${libdir}/libclamav.so* ${libdir}/libclammspack.so* \
William A. Kennington IIIee32beb2021-06-02 12:48:35 -0700132 ${libdir}/libfreshclam.so* ${docdir}/libclamav/* \
133 ${libdir}/libmspack* "
Andrew Geisslerf1e44062021-04-15 15:52:46 -0500134
135FILES_${PN}-doc = "${mandir}/man/* \
136 ${datadir}/man/* \
137 ${docdir}/* "
138
139USERADD_PACKAGES = "${PN}"
140GROUPADD_PARAM_${PN} = "--system ${CLAMAV_UID}"
141USERADD_PARAM_${PN} = "--system -g ${CLAMAV_GID} --home-dir \
William A. Kennington IIIee32beb2021-06-02 12:48:35 -0700142 ${localstatedir}/lib/${BPN} \
143 --no-create-home --shell /sbin/nologin ${BPN}"
Andrew Geisslerf1e44062021-04-15 15:52:46 -0500144
145RPROVIDES_${PN} += "${PN}-systemd"
146RREPLACES_${PN} += "${PN}-systemd"
147RCONFLICTS_${PN} += "${PN}-systemd"
William A. Kennington IIIee32beb2021-06-02 12:48:35 -0700148SYSTEMD_PACKAGES = "${PN}-daemon ${PN}-freshclam"
149SYSTEMD_SERVICE_${PN}-daemon = "clamav-daemon.service"
150SYSTEMD_SERVICE_${PN}-freshclam = "clamav-freshclam.service"
Andrew Geisslerf1e44062021-04-15 15:52:46 -0500151
152RDEPENDS_${PN} = "openssl ncurses-libncurses libxml2 libbz2 ncurses-libtinfo curl libpcre2 clamav-freshclam clamav-libclamav"
William A. Kennington IIIee32beb2021-06-02 12:48:35 -0700153RDEPENDS_${PN}-daemon = "clamav"