summaryrefslogtreecommitdiff
path: root/libre/clamav/PKGBUILD
blob: bdda8d37487431cea312aeaff86eaabee0795b91 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# Contributor (Arch): Dale Blount <dale@archlinux.org>
# Contributor (Arch): Gregor Ibic <gregor.ibic@intelicom.si>
# Maintainer (Arch): Gaetan Bisson <bisson@archlinux.org>
# Contributor (Hyperbola): André Silva <emulatorman@hyperbola.info>
# Maintainer: Omar Vega Ramos <ovruni@gnu.org.pe>
# Contributor: Isaac David <isacdaavid@at@isacdaavid@dot@info>
# Contributor: Andreas Grapentin <andreas@grapentin.org>

_pkgname=clamav-libre
pkgname=clamav
pkgver=0.101.2
pkgrel=1
pkgrel+=.par1
pkgdesc='Anti-virus toolkit for Unix'
pkgdesc+=', without nonfree decompression engine for RAR archives'
url='https://www.clamav.net/'
license=('GPL')
arch=('x86_64')
arch+=('i686' 'armv7h')
depends=('bzip2' 'libltdl' 'libxml2' 'curl' 'systemd-libs' 'pcre2' 'json-c' 'libmspack')
makedepends=('libmilter' 'systemd')
checkdepends=('check')
backup=('etc/clamav/clamd.conf'
        'etc/clamav/freshclam.conf'
        'etc/clamav/clamav-milter.conf'
        'etc/logrotate.d/clamav')
provides=(libclamav.so libclamunrar.so libclamunrar_iface.so)
mksource=(https://www.clamav.net/downloads/production/${pkgname}-${pkgver}.tar.gz{,.sig})
source=(https://repo.parabola.nu/other/${_pkgname}/${_pkgname}-${pkgver}.tar.gz
        clamav.logrotate
        clamav.tmpfiles
        clamav.sysusers)
mksha512sums=('f9ea4589a8081acf7b6d454d1a068da05ae6574a9070a08f9438935795cb6dc084ffb9222b11fb1623f31962f859e6536a2f5bd1de29ef6b9b314efa5edc8c7e'
              'SKIP')
sha512sums=('eb441a213b4816a691b67dd2c0919fbf185cc0ce3ff83dd39af477d4a6be17e4cc57c9250c3bc82d9969c3d37e2609852ffc7cb4bc4fad104a3b023f633d19e8'
            '9cb168c1c16bb43c99900d7ef34456e3f3b593d4d1943c875a0306bc86fd3872cb78e9e1413dcba93579e01b96d466c9eea1975e24190193663b7986c4525d48'
            'c5443634399bd87fe0d0192518538ffdb7296a8437b5b0160a0fbd58696b01285de3237e3feb552c0095c49e576832dec2e2b2107eef2be42424ed7edd13cd19'
            'b984836f6c34d97b90d81fa5d17361a2e3f8c0cc709e3350a4d25cf088dc04f7bf2504359980c8be489c96b1b8798c60e6da533069d3378d49d4f50f929a2c90')
validpgpkeys=('65ED513993F08DA06F9639A6F13F9E16BCA5BFAD') # Talos (Talos, Cisco Systems Inc.) <research@sourcefire.com>

mksource() {
  cd ${pkgname}-${pkgver}

  msg2 "remove nonfree unRAR utility files from the source"
  rm -rv libclamunrar
  rm -v COPYING.unrar
}

prepare() {
  cd ${pkgname}-${pkgver}
  sed -E 's|^(Example)$|#\1|' -i etc/{clamd,freshclam,clamav-milter}.conf.sample
  sed -E 's|#(User) .+|\1 clamav|' -i etc/{clamd,freshclam,clamav-milter}.conf.sample
  sed -E 's|#(LogFile) .+|\1 /var/log/clamav/clamd.log|' -i etc/clamd.conf.sample
  sed -E 's|#(LogTime) .+|\1 yes|' -i etc/clamd.conf.sample etc/clamav-milter.conf.sample
  sed -E 's|#(PidFile) .+|\1 /run/clamav/clamd.pid|' -i etc/clamd.conf.sample
  sed -E 's|#(TemporaryDirectory) .+|\1 /tmp|' -i etc/{clamd,clamav-milter}.conf.sample
  sed -E 's|#(LocalSocket) .+|\1 /run/clamav/clamd.ctl|' -i etc/clamd.conf.sample
  sed -E 's|#(UpdateLogFile) .+|\1 /var/log/clamav/freshclam.log|' -i etc/freshclam.conf.sample
  sed -E 's|#(DatabaseMirror) .+|\1 database.clamav.net|' -i etc/freshclam.conf.sample
  sed -E 's|#(NotifyClamd) .+|\1 /etc/clamav/clamd.conf|' -i etc/freshclam.conf.sample
  sed -E 's|#(PidFile) .+|\1 /run/clamav/freshclam.pid|' -i etc/freshclam.conf.sample
  sed -E 's|#(LogFile) .+|\1 /var/log/clamav/clamav-milter.log|' -i etc/clamav-milter.conf.sample
  sed -E 's|#(PidFile) .+|\1 /run/clamav/clamav-milter.pid|' -i etc/clamav-milter.conf.sample
  sed -E "s|(\\[Unit\\])|\\1\\nWants=network-online.target\\nAfter=network-online.target|" -i freshclam/clamav-freshclam.service.in
  autoreconf -fiv
}

build() {
  cd ${pkgname}-${pkgver}
  # --disable-zlib-vcheck because the configure script thinks that
  # zlib 1.2.11 is older than 1.2.2
  # --enable-llvm=no:
  # workaround for database update issues
  ./configure \
    --prefix=/usr \
    --sbindir=/usr/bin \
    --sysconfdir=/etc/clamav \
    --with-dbdir=/var/lib/clamav \
    --with-user=clamav \
    --with-group=clamav \
    --with-system-libmspack \
    --disable-rpath \
    --disable-clamav \
    --disable-llvm \
    --enable-zlib-vcheck \
    --enable-milter \
    --enable-clamdtop \
    --disable-unrar \
    --enable-llvm=no

  sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool
  make
}

check() {
  cd ${pkgname}-${pkgver}
  make quick-check
}

package() {
  cd ${pkgname}-${pkgver}
  make DESTDIR="${pkgdir}" install

  mv "${pkgdir}"/etc/clamav/freshclam.conf{.sample,}
  mv "${pkgdir}"/etc/clamav/clamd.conf{.sample,}
  mv "${pkgdir}"/etc/clamav/clamav-milter.conf{.sample,}

  install -Dm 644 ../clamav.sysusers "${pkgdir}"/usr/lib/sysusers.d/clamav.conf
  install -Dm 644 ../clamav.tmpfiles "${pkgdir}"/usr/lib/tmpfiles.d/clamav.conf
  install -Dm 644 ../clamav.logrotate "${pkgdir}"/etc/logrotate.d/clamav
}