blob: 36e498dfbbf93dabeabc408ae271470dd6cf779b [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
11SRCREV = "5553a5e206ceae5d920368baee7d403f823bcb6f"
12
13SRC_URI = "git://github.com/vrtadmin/clamav-devel;branch=dev/0.104 \
14 file://clamd.conf \
15 file://freshclam.conf \
16 file://volatiles.03_clamav \
17 file://tmpfiles.clamav \
18 file://${BPN}.service \
19 file://headers_fixup.patch \
20 file://oe_cmake_fixup.patch \
21"
22S = "${WORKDIR}/git"
23
24LEAD_SONAME = "libclamav.so"
25SO_VER = "9.6.0"
26
27BINCONFIG = "${bindir}/clamav-config"
28
29inherit cmake chrpath pkgconfig useradd systemd multilib_header multilib_script
30
31CLAMAV_UID ?= "clamav"
32CLAMAV_GID ?= "clamav"
33
34MULTILIB_SCRIPTS = "${PN}-dev:${bindir}/clamav-config"
35
36EXTRA_OECMAKE = " -DCMAKE_BUILD_TYPE=Release -DOPTIMIZE=ON -DENABLE_JSON_SHARED=OFF \
37 -DCLAMAV_GROUP=${CLAMAV_GID} -DCLAMAV_USER=${CLAMAV_UID} \
38 -DENABLE_TESTS=OFF -DBUILD_SHARED_LIBS=ON \
39 -DDISABLE_MPOOL=ON -DENABLE_FRESHCLAM_DNS_FIX=ON \
40 "
41
42PACKAGECONFIG ?= " clamonacc \
43 ${@bb.utils.contains("DISTRO_FEATURES", "systemd", "systemd", "", d)}"
44
45PACKAGECONFIG[milter] = "-DENABLE_MILTER=ON ,-DENABLE_MILTER=OFF, curl, curl"
46PACKAGECONFIG[clamonacc] = "-DENABLE_CLAMONACC=ON ,-DENABLE_CLAMONACC=OFF,"
47PACKAGECONFIG[unrar] = "-DENABLE_UNRAR=ON ,-DENABLE_UNRAR=OFF,"
48PACKAGECONFIG[systemd] = "-DENABLE_SYSTEMD=ON -DSYSTEMD_UNIT_DIR=${systemd_system_unitdir}, -DENABLE_SYSTEMD=OFF, systemd"
49
50export OECMAKE_C_FLAGS += " -I${STAGING_INCDIR} -L ${RECIPE_SYSROOT}${nonarch_libdir} -L${STAGING_LIBDIR} -lpthread"
51
52do_install_append () {
53 install -d ${D}/${sysconfdir}
54 install -d ${D}/${localstatedir}/lib/clamav
55 install -d ${D}${sysconfdir}/clamav ${D}${sysconfdir}/default/volatiles
56
57 install -m 644 ${WORKDIR}/clamd.conf ${D}/${prefix}/${sysconfdir}
58 install -m 644 ${WORKDIR}/freshclam.conf ${D}/${prefix}/${sysconfdir}
59 install -m 0644 ${WORKDIR}/volatiles.03_clamav ${D}${sysconfdir}/default/volatiles/03_clamav
60 sed -i -e 's#${STAGING_DIR_HOST}##g' ${D}${libdir}/pkgconfig/libclamav.pc
61 rm ${D}/${libdir}/libclamav.so
62 if [ "${INSTALL_CLAMAV_CVD}" = "1" ]; then
63 install -m 666 ${S}/clamav_db/* ${D}/${localstatedir}/lib/clamav/.
64 fi
65
66 rm ${D}/${libdir}/libfreshclam.so
67 rm ${D}/${libdir}/libmspack.so
68
69 if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)};then
70 install -D -m 0644 ${WORKDIR}/clamav.service ${D}${systemd_unitdir}/system/clamav.service
71 install -d ${D}${sysconfdir}/tmpfiles.d
72 install -m 0644 ${WORKDIR}/tmpfiles.clamav ${D}${sysconfdir}/tmpfiles.d/clamav.conf
73 fi
74 oe_multilib_header clamav-types.h
75}
76
77pkg_postinst_ontarget_${PN} () {
78 if command -v systemd-tmpfiles >/dev/null; then
79 systemd-tmpfiles --create ${sysconfdir}/tmpfiles.d/clamav.conf
80 elif [ -e ${sysconfdir}/init.d/populate-volatile.sh ]; then
81 ${sysconfdir}/init.d/populate-volatile.sh update
82 fi
83 mkdir -p ${localstatedir}/lib/clamav
84 chown -R ${CLAMAV_UID}:${CLAMAV_GID} ${localstatedir}/lib/clamav
85}
86
87
88PACKAGES = "${PN} ${PN}-dev ${PN}-dbg ${PN}-daemon ${PN}-doc \
89 ${PN}-clamdscan ${PN}-freshclam ${PN}-libclamav ${PN}-staticdev"
90
91FILES_${PN} = "${bindir}/clambc ${bindir}/clamscan ${bindir}/clamsubmit ${sbindir}/clamonacc \
92 ${bindir}/*sigtool ${mandir}/man1/clambc* ${mandir}/man1/clamscan* \
93 ${mandir}/man1/sigtool* ${mandir}/man1/clambsubmit* \
94 ${docdir}/clamav/* ${libdir}/libmspack* "
95
96FILES_${PN}-clamdscan = " ${bindir}/clamdscan \
97 ${docdir}/clamdscan/* \
98 ${mandir}/man1/clamdscan* \
99 "
100
101FILES_${PN}-daemon = "${bindir}/clamconf ${bindir}/clamdtop ${sbindir}/clamd \
102 ${mandir}/man1/clamconf* ${mandir}/man1/clamdtop* \
103 ${mandir}/man5/clamd* ${mandir}/man8/clamd* \
104 ${sysconfdir}/clamd.conf* \
105 /usr/etc/clamd.conf* \
106 ${systemd_unitdir}/system/clamav-daemon/* \
107 ${docdir}/clamav-daemon/* ${sysconfdir}/clamav-daemon \
108 ${sysconfdir}/logcheck/ignore.d.server/clamav-daemon \
109 ${systemd_unitdir}/system/clamav-daemon.service \
110 ${systemd_unitdir}/system/clamav-clamonacc.service \
111 "
112
113FILES_${PN}-freshclam = "${bindir}/freshclam \
114 ${sysconfdir}/freshclam.conf* \
115 /usr/etc/freshclam.conf* \
116 ${sysconfdir}/clamav ${sysconfdir}/default/volatiles \
117 ${sysconfdir}/tmpfiles.d/*.conf \
118 ${localstatedir}/lib/clamav \
119 ${docdir}/${PN}-freshclam ${mandir}/man1/freshclam.* \
120 ${mandir}/man5/freshclam.conf.* \
121 ${systemd_unitdir}/system/clamav-freshclam.service"
122
123FILES_${PN}-dev = " ${bindir}/clamav-config ${libdir}/*.la \
124 ${libdir}/pkgconfig/*.pc \
125 ${mandir}/man1/clamav-config.* \
126 ${includedir}/*.h ${docdir}/libclamav* "
127
128FILES_${PN}-staticdev = "${libdir}/*.a"
129
130FILES_${PN}-libclamav = "${libdir}/libclamav.so* ${libdir}/libclammspack.so* \
131 ${libdir}/libfreshclam.so* ${docdir}/libclamav/* "
132
133FILES_${PN}-doc = "${mandir}/man/* \
134 ${datadir}/man/* \
135 ${docdir}/* "
136
137USERADD_PACKAGES = "${PN}"
138GROUPADD_PARAM_${PN} = "--system ${CLAMAV_UID}"
139USERADD_PARAM_${PN} = "--system -g ${CLAMAV_GID} --home-dir \
140 ${localstatedir}/spool/${BPN} \
141 --no-create-home --shell /bin/false ${BPN}"
142
143RPROVIDES_${PN} += "${PN}-systemd"
144RREPLACES_${PN} += "${PN}-systemd"
145RCONFLICTS_${PN} += "${PN}-systemd"
146SYSTEMD_SERVICE_${PN} = "${BPN}.service"
147
148RDEPENDS_${PN} = "openssl ncurses-libncurses libxml2 libbz2 ncurses-libtinfo curl libpcre2 clamav-freshclam clamav-libclamav"