diff options
Diffstat (limited to 'system/clamav/clamav.SlackBuild')
-rw-r--r-- | system/clamav/clamav.SlackBuild | 123 |
1 files changed, 64 insertions, 59 deletions
diff --git a/system/clamav/clamav.SlackBuild b/system/clamav/clamav.SlackBuild index 28dec28ae4..77fad8b7b2 100644 --- a/system/clamav/clamav.SlackBuild +++ b/system/clamav/clamav.SlackBuild @@ -1,7 +1,7 @@ -#!/bin/sh +#!/bin/bash # Copyright (c) 2006,2007 Eric Hameleers <alien@slackware.com> -# Copyright (c) 2011-2019 Matteo Bernardini <ponce@slackbuilds.org> +# Copyright (c) 2011-2024 Matteo Bernardini <ponce@slackbuilds.org> # All rights reserved. # # Redistribution and use of this script, with or without modification, is @@ -26,21 +26,32 @@ # Version bump and various other changes by Robby Workman # New version bump and various other changes by Matteo Bernardini # No additional license terms added +# Code to deal with multiple copies of the source by B. Watson + +cd $(dirname $0) ; CWD=$(pwd) PRGNAM=clamav -VERSION=${VERSION:-0.102.1} +VERSION=${VERSION:-1.3.1} BUILD=${BUILD:-1} TAG=${TAG:-_SBo} +PKGTYPE=${PKGTYPE:-tgz} if [ -z "$ARCH" ]; then case "$( uname -m )" in - i?86) ARCH=i586 ;; + i?86) ARCH=i686 ;; arm*) ARCH=arm ;; *) ARCH=$( uname -m ) ;; esac fi -CWD=$(pwd) +# If the variable PRINT_PACKAGE_NAME is set, then this script will report what +# the name of the created package would be, and then exit. This information +# could be useful to other scripts. +if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then + echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE" + exit 0 +fi + TMP=${TMP:-/tmp/SBo} PKG="$TMP/package-$PRGNAM" OUTPUT=${OUTPUT:-/tmp} @@ -78,34 +89,26 @@ elif ! getent passwd clamav 2>&1 > /dev/null; then bailout ; fi -# check if json-c is there: if it is, build over it to enable -# the file properties collection and analysis feature -# http://blog.clamav.net/2014/11/intro-to-collection-and-analysis-of.html -if pkg-config --exists json-c ; then - with_jsonc="--with-libjson" -else - with_jsonc="" -fi +set -e -# Some people don't have sendmail installed: don't build milter stuff -# in this case. -# This is your call, not having sendmail is *UNSUPPORTED* -if [ ! -f /usr/lib$LIBDIRSUFFIX/libmilter.a ]; then - milter="dis" - milter_cf="" -else - milter="en" - milter_cf="clamav-milter" +# 20220209 bkw: the download filename ends up with a bunch of +# gibberish (CGI params) if you use wget... I ended up with 2 copies +# of the tarball with different gibberish in the names, and the "tar +# xvf $CWD/$PRGNAM-$VERSION.tar.?z*" meant that both were passed as +# args to tar (making it fail). So be a little more paranoid about +# the filename. +TARBALL=$CWD/$PRGNAM-$VERSION.tar.gz +if [ ! -e "$TARBALL" ]; then + T="$( /bin/ls $CWD/$PRGNAM-$VERSION.tar.gz\?* 2>/dev/null | head -1 )" + [ -n "$T" ] && TARBALL="$T" fi -set -e - rm -rf $PKG mkdir -p $TMP $PKG $OUTPUT cd $TMP rm -rf $PRGNAM-$VERSION -tar xvf $CWD/$PRGNAM-$VERSION.tar.?z* -cd $PRGNAM-$VERSION || exit 1 +tar xvf $TARBALL +cd $PRGNAM-$VERSION chown -R root:root . find -L . \ \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \ @@ -113,6 +116,13 @@ find -L . \ \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \ -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \; +export PATH="/opt/rust16/bin:$PATH" +if [ -z "$LD_LIBRARY_PATH" ]; then + export LD_LIBRARY_PATH="/opt/rust16/lib$LIBDIRSUFFIX" +else + export LD_LIBRARY_PATH="/opt/rust16/lib$LIBDIRSUFFIX:$LD_LIBRARY_PATH" +fi + # Specify the desired mirror in the update config file # http://www.iana.org/cctld/cctld-whois.htm sed -i "s/^\#DatabaseMirror.*/DatabaseMirror db.${COUNTRY}.clamav.net/" \ @@ -143,32 +153,29 @@ sed \ -e "s/^\#ExitOnOOM/ExitOnOOM/" \ -i etc/clamd.conf.sample || exit 1 -autoreconf -fi - -CFLAGS="$SLKCFLAGS" \ -CXXFLAGS="$SLKCFLAGS" \ -./configure \ - --prefix=/usr \ - --libdir=/usr/lib${LIBDIRSUFFIX} \ - --localstatedir=/var \ - --sysconfdir=/etc \ - --mandir=/usr/man \ - --with-user=clamav \ - --with-group=clamav \ - --with-dbdir=/var/lib/clamav \ - --${milter}able-milter \ - --enable-id-check \ - --enable-clamdtop \ - --disable-static \ - --disable-experimental \ - $with_jsonc \ - --build=$ARCH-slackware-linux - -make V=1 -make install DESTDIR=$PKG +mkdir -p build +cd build + cmake \ + -DCMAKE_C_FLAGS:STRING="$SLKCFLAGS" \ + -DCMAKE_CXX_FLAGS:STRING="$SLKCFLAGS" \ + -DCMAKE_INSTALL_PREFIX=/usr \ + -DCMAKE_INSTALL_FULL_LIBDIR=/usr/lib$LIBDIRSUFFIX \ + -DAPP_CONFIG_DIRECTORY=/etc \ + -DENABLE_MILTER=ON \ + -DENABLE_SYSTEMD=OFF \ + -DENABLE_TESTS=OFF \ + -DDATABASE_DIRECTORY=/var/lib/clamav \ + -DENABLE_EXTERNAL_MSPACK=ON \ + -DCMAKE_BUILD_TYPE=Release .. + make + make install DESTDIR=$PKG +cd .. + +mv $PKG/usr/share/man $PKG/usr/man +rm -fR $PKG/usr/share # Prepare the config files: -for cf in clamd freshclam $milter_cf; do +for cf in clamd freshclam clamav-milter; do mv $PKG/etc/$cf.conf.sample $PKG/etc/$cf.conf.new done @@ -180,29 +187,27 @@ install -D -m 0644 $CWD/logrotate.clamav $PKG/etc/logrotate.d/clamav.new # init script must still ensure that /var/run/clamav exists # and has proper ownership and permissions though mkdir -p $PKG/var/lib/clamav $PKG/var/log/clamav $PKG/var/run/clamav -chmod 771 $PKG/var/lib/clamav $PKG/var/log/clamav $PKG/var/run/clamav +chmod 0771 $PKG/var/log/clamav $PKG/var/run/clamav +chmod 0775 $PKG/var/lib/clamav # Fixup some ownership and permissions issues chown -R root:root $PKG chmod -R o-w $PKG -if [ "$milter" = "en" ]; then - chown clamav $PKG/usr/sbin/clamav-milter - chmod 4700 $PKG/usr/sbin/clamav-milter -fi -chmod 0770 $PKG/var/lib/clamav +chown clamav $PKG/usr/sbin/clamav-milter +chmod 4700 $PKG/usr/sbin/clamav-milter touch $PKG/var/lib/clamav/main.cvd $PKG/var/lib/clamav/daily.cvd chmod 0660 $PKG/var/lib/clamav/* # Create log files in such a way that they won't clobber existing ones touch $PKG/var/log/clamav/clamd.log.new \ $PKG/var/log/clamav/freshclam.log.new -chmod 660 $PKG/var/log/clamav/clamd.log.new \ +chmod 0660 $PKG/var/log/clamav/clamd.log.new \ $PKG/var/log/clamav/freshclam.log.new chown -R clamav:clamav $PKG/var/lib/clamav $PKG/var/log/clamav \ $PKG/var/run/clamav -find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \ +find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \ | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true # Compress the man page(s) @@ -222,4 +227,4 @@ cat $CWD/slack-desc > $PKG/install/slack-desc cat $CWD/doinst.sh > $PKG/install/doinst.sh cd $PKG -/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz} +/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE |