blob: 3bcb5eb7a9370edfe73b0d0aa826108acaa8257d [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"
Patrick Williamsde0582f2022-04-08 10:23:27 -05005LICENSE = "LGPL-2.1-only"
Andrew Geisslerf1e44062021-04-15 15:52:46 -05006
7DEPENDS = "glibc llvm libtool db openssl zlib curl libxml2 bison pcre2 json-c libcheck"
8
Patrick Williamsde0582f2022-04-08 10:23:27 -05009COMPATIBLE_HOST:libc-musl:class-target = "null"
10
Andrew Geisslerf1e44062021-04-15 15:52:46 -050011LIC_FILES_CHKSUM = "file://COPYING.txt;beginline=2;endline=3;md5=f7029fbbc5898b273d5902896f7bbe17"
12
Patrick Williams213cb262021-08-07 19:21:33 -050013# July 27th
14SRCREV = "c389dfa4c3af92b006ada4f7595bbc3e6df3f356"
Andrew Geisslerf1e44062021-04-15 15:52:46 -050015
Patrick Williams53961c22022-01-20 11:06:23 -060016SRC_URI = "git://github.com/vrtadmin/clamav-devel;branch=rel/0.104;protocol=https \
Andrew Geisslerf1e44062021-04-15 15:52:46 -050017 file://clamd.conf \
18 file://freshclam.conf \
19 file://volatiles.03_clamav \
20 file://tmpfiles.clamav \
Andrew Geisslerf1e44062021-04-15 15:52:46 -050021 file://headers_fixup.patch \
22 file://oe_cmake_fixup.patch \
William A. Kennington IIIee32beb2021-06-02 12:48:35 -070023 file://fix_systemd_socket.patch \
Andrew Geisslerf1e44062021-04-15 15:52:46 -050024"
25S = "${WORKDIR}/git"
26
27LEAD_SONAME = "libclamav.so"
28SO_VER = "9.6.0"
29
30BINCONFIG = "${bindir}/clamav-config"
31
32inherit cmake chrpath pkgconfig useradd systemd multilib_header multilib_script
33
William A. Kennington IIIee32beb2021-06-02 12:48:35 -070034UPSTREAM_CHECK_COMMITS = "1"
35
Andrew Geisslerf1e44062021-04-15 15:52:46 -050036CLAMAV_UID ?= "clamav"
37CLAMAV_GID ?= "clamav"
38
39MULTILIB_SCRIPTS = "${PN}-dev:${bindir}/clamav-config"
40
41EXTRA_OECMAKE = " -DCMAKE_BUILD_TYPE=Release -DOPTIMIZE=ON -DENABLE_JSON_SHARED=OFF \
42 -DCLAMAV_GROUP=${CLAMAV_GID} -DCLAMAV_USER=${CLAMAV_UID} \
43 -DENABLE_TESTS=OFF -DBUILD_SHARED_LIBS=ON \
44 -DDISABLE_MPOOL=ON -DENABLE_FRESHCLAM_DNS_FIX=ON \
45 "
46
47PACKAGECONFIG ?= " clamonacc \
48 ${@bb.utils.contains("DISTRO_FEATURES", "systemd", "systemd", "", d)}"
49
50PACKAGECONFIG[milter] = "-DENABLE_MILTER=ON ,-DENABLE_MILTER=OFF, curl, curl"
51PACKAGECONFIG[clamonacc] = "-DENABLE_CLAMONACC=ON ,-DENABLE_CLAMONACC=OFF,"
52PACKAGECONFIG[unrar] = "-DENABLE_UNRAR=ON ,-DENABLE_UNRAR=OFF,"
53PACKAGECONFIG[systemd] = "-DENABLE_SYSTEMD=ON -DSYSTEMD_UNIT_DIR=${systemd_system_unitdir}, -DENABLE_SYSTEMD=OFF, systemd"
54
55export OECMAKE_C_FLAGS += " -I${STAGING_INCDIR} -L ${RECIPE_SYSROOT}${nonarch_libdir} -L${STAGING_LIBDIR} -lpthread"
56
Patrick Williams213cb262021-08-07 19:21:33 -050057do_install:append () {
Andrew Geisslerf1e44062021-04-15 15:52:46 -050058 install -d ${D}/${sysconfdir}
Patrick Williams93c203f2021-10-06 16:15:23 -050059 install -d -o ${CLAMAV_UID} -g ${CLAMAV_GID} ${D}/${localstatedir}/lib/clamav
Andrew Geisslerf1e44062021-04-15 15:52:46 -050060 install -d ${D}${sysconfdir}/clamav ${D}${sysconfdir}/default/volatiles
61
62 install -m 644 ${WORKDIR}/clamd.conf ${D}/${prefix}/${sysconfdir}
63 install -m 644 ${WORKDIR}/freshclam.conf ${D}/${prefix}/${sysconfdir}
64 install -m 0644 ${WORKDIR}/volatiles.03_clamav ${D}${sysconfdir}/default/volatiles/03_clamav
65 sed -i -e 's#${STAGING_DIR_HOST}##g' ${D}${libdir}/pkgconfig/libclamav.pc
66 rm ${D}/${libdir}/libclamav.so
67 if [ "${INSTALL_CLAMAV_CVD}" = "1" ]; then
68 install -m 666 ${S}/clamav_db/* ${D}/${localstatedir}/lib/clamav/.
69 fi
70
71 rm ${D}/${libdir}/libfreshclam.so
72 rm ${D}/${libdir}/libmspack.so
73
74 if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)};then
Andrew Geisslerf1e44062021-04-15 15:52:46 -050075 install -d ${D}${sysconfdir}/tmpfiles.d
76 install -m 0644 ${WORKDIR}/tmpfiles.clamav ${D}${sysconfdir}/tmpfiles.d/clamav.conf
77 fi
78 oe_multilib_header clamav-types.h
79}
80
Patrick Williams213cb262021-08-07 19:21:33 -050081pkg_postinst:${PN} () {
William A. Kennington IIIee32beb2021-06-02 12:48:35 -070082 if [ -z "$D" ]; then
83 if command -v systemd-tmpfiles >/dev/null; then
84 systemd-tmpfiles --create ${sysconfdir}/tmpfiles.d/clamav.conf
85 elif [ -e ${sysconfdir}/init.d/populate-volatile.sh ]; then
86 ${sysconfdir}/init.d/populate-volatile.sh update
87 fi
Andrew Geisslerf1e44062021-04-15 15:52:46 -050088 fi
Andrew Geisslerf1e44062021-04-15 15:52:46 -050089}
90
William A. Kennington IIIee32beb2021-06-02 12:48:35 -070091PACKAGES += "${PN}-daemon ${PN}-clamdscan ${PN}-freshclam ${PN}-libclamav"
Andrew Geisslerf1e44062021-04-15 15:52:46 -050092
Patrick Williams213cb262021-08-07 19:21:33 -050093FILES:${PN} = "${bindir}/clambc ${bindir}/clamscan ${bindir}/clamsubmit ${sbindir}/clamonacc \
Andrew Geisslerf1e44062021-04-15 15:52:46 -050094 ${bindir}/*sigtool ${mandir}/man1/clambc* ${mandir}/man1/clamscan* \
95 ${mandir}/man1/sigtool* ${mandir}/man1/clambsubmit* \
William A. Kennington IIIee32beb2021-06-02 12:48:35 -070096 ${docdir}/clamav/*"
Andrew Geisslerf1e44062021-04-15 15:52:46 -050097
Patrick Williams213cb262021-08-07 19:21:33 -050098FILES:${PN}-clamdscan = " ${bindir}/clamdscan \
Andrew Geisslerf1e44062021-04-15 15:52:46 -050099 ${docdir}/clamdscan/* \
100 ${mandir}/man1/clamdscan* \
101 "
102
Patrick Williams213cb262021-08-07 19:21:33 -0500103FILES:${PN}-daemon = "${bindir}/clamconf ${bindir}/clamdtop ${sbindir}/clamd \
Andrew Geisslerf1e44062021-04-15 15:52:46 -0500104 ${mandir}/man1/clamconf* ${mandir}/man1/clamdtop* \
105 ${mandir}/man5/clamd* ${mandir}/man8/clamd* \
106 ${sysconfdir}/clamd.conf* \
107 /usr/etc/clamd.conf* \
William A. Kennington IIIee32beb2021-06-02 12:48:35 -0700108 ${systemd_system_unitdir}/clamav-daemon/* \
Andrew Geisslerf1e44062021-04-15 15:52:46 -0500109 ${docdir}/clamav-daemon/* ${sysconfdir}/clamav-daemon \
110 ${sysconfdir}/logcheck/ignore.d.server/clamav-daemon \
William A. Kennington IIIee32beb2021-06-02 12:48:35 -0700111 ${systemd_system_unitdir}/clamav-daemon.service \
112 ${systemd_system_unitdir}/clamav-clamonacc.service \
Andrew Geisslerf1e44062021-04-15 15:52:46 -0500113 "
114
Patrick Williams213cb262021-08-07 19:21:33 -0500115FILES:${PN}-freshclam = "${bindir}/freshclam \
Andrew Geisslerf1e44062021-04-15 15:52:46 -0500116 ${sysconfdir}/freshclam.conf* \
117 /usr/etc/freshclam.conf* \
118 ${sysconfdir}/clamav ${sysconfdir}/default/volatiles \
119 ${sysconfdir}/tmpfiles.d/*.conf \
120 ${localstatedir}/lib/clamav \
121 ${docdir}/${PN}-freshclam ${mandir}/man1/freshclam.* \
122 ${mandir}/man5/freshclam.conf.* \
William A. Kennington IIIee32beb2021-06-02 12:48:35 -0700123 ${systemd_system_unitdir}/clamav-freshclam.service"
Andrew Geisslerf1e44062021-04-15 15:52:46 -0500124
Patrick Williams213cb262021-08-07 19:21:33 -0500125FILES:${PN}-dev = " ${bindir}/clamav-config ${libdir}/*.la \
Andrew Geisslerf1e44062021-04-15 15:52:46 -0500126 ${libdir}/pkgconfig/*.pc \
127 ${mandir}/man1/clamav-config.* \
128 ${includedir}/*.h ${docdir}/libclamav* "
129
Patrick Williams213cb262021-08-07 19:21:33 -0500130FILES:${PN}-staticdev = "${libdir}/*.a"
Andrew Geisslerf1e44062021-04-15 15:52:46 -0500131
Patrick Williams213cb262021-08-07 19:21:33 -0500132FILES:${PN}-libclamav = "${libdir}/libclamav.so* ${libdir}/libclammspack.so* \
William A. Kennington IIIee32beb2021-06-02 12:48:35 -0700133 ${libdir}/libfreshclam.so* ${docdir}/libclamav/* \
134 ${libdir}/libmspack* "
Andrew Geisslerf1e44062021-04-15 15:52:46 -0500135
Patrick Williams213cb262021-08-07 19:21:33 -0500136FILES:${PN}-doc = "${mandir}/man/* \
Andrew Geisslerf1e44062021-04-15 15:52:46 -0500137 ${datadir}/man/* \
138 ${docdir}/* "
139
Patrick Williams53961c22022-01-20 11:06:23 -0600140USERADD_PACKAGES = "${PN}-freshclam "
141GROUPADD_PARAM:${PN}-freshclam = "--system ${CLAMAV_UID}"
142USERADD_PARAM:${PN}-freshclam = "--system -g ${CLAMAV_GID} --home-dir \
William A. Kennington IIIee32beb2021-06-02 12:48:35 -0700143 ${localstatedir}/lib/${BPN} \
Patrick Williams53961c22022-01-20 11:06:23 -0600144 --no-create-home --shell /sbin/nologin ${PN}"
Andrew Geisslerf1e44062021-04-15 15:52:46 -0500145
Patrick Williams213cb262021-08-07 19:21:33 -0500146RPROVIDES:${PN} += "${PN}-systemd"
147RREPLACES:${PN} += "${PN}-systemd"
148RCONFLICTS:${PN} += "${PN}-systemd"
William A. Kennington IIIee32beb2021-06-02 12:48:35 -0700149SYSTEMD_PACKAGES = "${PN}-daemon ${PN}-freshclam"
Patrick Williams213cb262021-08-07 19:21:33 -0500150SYSTEMD_SERVICE:${PN}-daemon = "clamav-daemon.service"
151SYSTEMD_SERVICE:${PN}-freshclam = "clamav-freshclam.service"
Andrew Geisslerf1e44062021-04-15 15:52:46 -0500152
Patrick Williams93c203f2021-10-06 16:15:23 -0500153RDEPENDS:${PN} = "openssl ncurses-libncurses libxml2 libbz2 ncurses-libtinfo curl libpcre2 clamav-libclamav"
154RRECOMMENDS:${PN} = "clamav-freshclam"
155RDEPENDS:${PN}-freshclam = "clamav"
156RDEPENDS:${PN}-daemon = "clamav clamav-freshclam"