File squidclamav.spec of Package squidclamav

#
# spec file for package squidclamav
#
# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via https://bugs.opensuse.org/
#


%define         cgidir /srv/www/cgi-bin/
Name:           squidclamav
Version:        7.2
Release:        0
Summary:        ICAP service and redirector for Squid
License:        GPL-3.0-or-later
Group:          Productivity/Networking/Web/Proxy
Url:            http://squidclamav.darold.net/
Source0:        https://github.com/darold/squidclamav/archive/refs/tags/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
Source1:        %{name}-README.SuSE
Source10:       %{name}-rpmlintrc
# PATCH-FIX-OPENSUSE -- adapt configuration to SUSE layout
Patch1:         squidclamav.conf.patch
BuildRequires:  autoconf
BuildRequires:  automake
BuildRequires:  c-icap-devel
BuildRequires:  gcc
BuildRequires:  libarchive-devel
BuildRequires:  libbz2-devel
BuildRequires:  libopenssl-devel
BuildRequires:  libtool
BuildRequires:  zlib-devel
Requires(pre):  c-icap
Requires:       perl(CGI)
Recommends:     apache2
Recommends:     squid3
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
SquidClamav is an antivirus for Squid proxy based on the Awards winnings ClamAv
anti-virus toolkit. Using it will help you securing your home or enterprise
network web traffic. SquidClamav is the most efficient Squid Redirector and
ICAP service antivirus tool for HTTP traffic available for free, it is written
in C and can handle thousand of connections. The way to add more securing on
your network for free is here.

SquidClamav is build for speed and security in mind, it is first used and
tested to secure a network with 2,500 and more users. It is also known to
working fast with 15000+ users.

%prep
%setup -q
%patch1 -p1
install -m0644 %{SOURCE1} README.SUSE

%build
%configure --with-c-icap=%{_bindir}/c-icap
make %{?_smp_mflags}

%install
mkdir -p %{buildroot}/%{_sysconfdir}/c-icap
%make_install
# move cgi files to the standard apache cgi-directory
mkdir -p %{buildroot}%{cgidir}
mv %{buildroot}%{_prefix}/lib/%{name}/* %{buildroot}%{cgidir}/
rm -rf %{buildroot}%{_prefix}/lib/%{name}
# the directory currently just contains a README, which is packaged in the
# standard documentation directory: so remove the unneeded directory here
rm -rf %{buildroot}%{_datadir}/%{name}
# looks like squidclamav has the config still hardcoded - create a symlink that allows us to use both path names
ln -s %{_sysconfdir}/c-icap/squidclamav.conf %{buildroot}/%{_sysconfdir}/squidclamav.conf

%files
%defattr(-,root,root)
%license COPYING
%doc AUTHORS ChangeLog README README.SUSE
%dir %{_datadir}/c_icap/templates/squidclamav
%dir %{_datadir}/c_icap/templates/squidclamav/en
%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/c-icap/squidclamav.conf*
%config(noreplace) %{_sysconfdir}/squidclamav.conf
%{cgidir}/*
%{_libdir}/c_icap/squidclamav.*
%{_mandir}/man1/%{name}*
%attr(0644,root,root) %{_datadir}/c_icap/templates/squidclamav/*/MALWARE_FOUND

%changelog
openSUSE Build Service is sponsored by