wok-next annotate clamav/receipt @ rev 21020

Cleaning is almost finished... I should proceed to upgrades.
author Aleksej Bobylev <al.bobylev@gmail.com>
date Fri Nov 02 14:15:08 2018 +0200 (2018-11-02)
parents a5d7827e08cf
children 36490385aca7
rev   line source
al@20459 1 # SliTaz package receipt v2.
paul@1104 2
paul@1104 3 PACKAGE="clamav"
al@20472 4 VERSION="0.99.4"
paul@1104 5 CATEGORY="security"
al@20472 6 SHORT_DESC="Antivirus"
paul@1104 7 MAINTAINER="paul@slitaz.org"
pascal@16051 8 LICENSE="GPL2"
al@20472 9 WEB_SITE="https://www.clamav.net/"
al@20459 10
paul@1104 11 TARBALL="$PACKAGE-$VERSION.tar.gz"
al@20472 12 WGET_URL="https://www.clamav.net/downloads/production/$TARBALL"
paul@1104 13
al@20472 14 BUILD_DEPENDS="zlib-dev gmp gmp-dev bzip2-dev ncurses-dev bash \
al@20472 15 libxml2-dev openssl-dev"
al@21020 16 SPLIT="$PACKAGE-dev"
slaxemulator@10996 17
al@20459 18 compile_rules() {
pascal@19704 19 grep -rl 'alignof(' * | xargs sed -i 's|alignof(|alignof_(|'
pascal@19704 20 grep -rl 'alignof<' * | xargs sed -i 's|alignof<|alignof_<|'
pascal@19704 21 grep -rl '__alignof_' * | xargs sed -i 's|__alignof_|__alignof|'
al@21020 22 sed -i 's|make_pair<.*>|make_pair|' libclamav/c++/llvm/lib/ExecutionEngine/JIT/JITDebugRegisterer.cpp
pascal@19704 23 sed -i 's|~0|~0U|g' libclamav/c++/llvm/lib/Target/X86/X86CodeEmitter.cpp \
pascal@19704 24 libclamav/c++/llvm/lib/Target/X86/X86MCCodeEmitter.cpp
pascal@19704 25
paul@1104 26 # Have to create clamav user/group to be able to compile
slaxemulator@15826 27 adduser -s /bin/false -H -D -u 64 clamav
paul@1104 28
paul@1104 29 ./configure \
paul@1104 30 --sysconfdir=/etc/clamav \
paul@16157 31 --with-dbdir=/var/lib/clamav \
pascal@3076 32 --with-iconv=no \
slaxemulator@15826 33 $CONFIGURE_ARGS &&
al@20569 34 fix libtool &&
slaxemulator@15826 35 make &&
al@21020 36 make DESTDIR=$install install
paul@1104 37 }
paul@1104 38
al@20459 39 genpkg_rules() {
al@20459 40 case $PACKAGE in
al@20459 41 clamav)
al@20459 42 mkdir -p $fs/usr/lib $fs/etc/init.d $fs/var/lib/clamav \
al@20459 43 $fs/var/log/clamav $fs/run/clamav
al@20459 44 cp -a $install/usr/bin $fs/usr
al@20459 45 rm -f $fs/usr/bin/clamav-config
al@20459 46 cp -a $install/usr/sbin $fs/usr
al@20459 47 cp -a $install/etc $fs
al@20459 48 mv $fs/etc/clamav/clamd.conf* $fs/etc/clamav/clamd.conf
al@20459 49 mv $fs/etc/clamav/freshclam.conf* $fs/etc/clamav/freshclam.conf
al@20459 50 # Copy only shared lib (.so)
al@20459 51 cp -a $install/usr/lib/*.so* $fs/usr/lib
al@20459 52 # Copy daemon from /$stuff
al@20459 53 cp $stuff/daemon-clamd $fs/etc/init.d/clamd
al@18734 54
al@20459 55 # Customize config
al@20459 56 sed -i -e "s/^Example/#Example/" \
al@20459 57 -e "s|^#LogFile /tmp/clamd.log|LogFile /var/log/clamav/clamav.log|" \
al@20459 58 -e "s|^#PidFile.*|PidFile /run/clamav/clamd.pid|" \
al@20459 59 -e "s|^#LocalSocket /tmp/clamd.socket|LocalSocket /run/clamav/clamd-socket|" \
al@20459 60 $fs/etc/clamav/clamd.conf
al@20459 61 DEPENDS="zlib gmp bzip2 slitaz-base-files ncurses libltdl"
al@20459 62 TAGS="antivirus"
al@20459 63 ;;
al@20459 64 *-dev)
al@20534 65 copy @dev
al@20459 66 ;;
al@20459 67 esac
paul@1104 68 }
paul@1104 69
al@20459 70 post_install_clamav() {
al@18734 71 local user=clamav
al@18734 72 local group=clamav
al@18734 73
paul@1104 74 # Enable freshclam update
al@18734 75 echo; action 'Enabling freshclam update...'
pascal@18730 76 cd "$1/etc/clamav"
al@18734 77 sed -i 's/^Example/#Example/' freshclam.conf
paul@1104 78 status
paul@1104 79
paul@1104 80 # adduser clamav if needed
al@21020 81 if ! grep -q "$user:" "$1/etc/passwd"; then
al@18734 82 action 'Adding user/group $user...'
pascal@18730 83 chroot "$1/" addgroup -S $group
pascal@18730 84 chroot "$1/" adduser -s /bin/false -S -D -H -G $group $user
paul@1104 85 status
paul@1104 86 fi
paul@1595 87
paul@1707 88 # Enable daily.cvd updates (sometimes needed for new version)
al@21020 89 #chown -R $user:$group "$1/var/lib/clamav"
al@18734 90
erjo@11931 91 # Fix perms
al@20570 92 chroot "$1/" chown -R $user.$group /var/log/clamav \
paul@16157 93 /run/clamav /var/lib/clamav
paul@1104 94 }
paul@1104 95
al@20459 96 post_remove_clamav() {
al@18734 97 chroot "$1/" deluser clamav
paul@1104 98 }