File squid3.spec of Package squid3
#
# spec file for package squid3
#
# Copyright (c) 2012 SUSE LINUX Products 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 http://bugs.opensuse.org/
#
%define squidlibdir %{_libdir}/squid
%define squidconfdir /etc/squid
Name: squid3
Summary: Squid Version 3 WWW Proxy Server
License: GPL-2.0+
Group: Productivity/Networking/Web/Proxy
Version: 3.1.20
Release: 0
Url: http://www.squid-cache.org/Versions/v3
Source0: http://www.squid-cache.org/Versions/v3/3.1/squid-%{version}.tar.bz2
Source1: squid-%{version}.tar.bz2.asc
Source2: RELEASENOTES.html
Source3: squid.init
Source4: squid.sysconfig
Source5: pam.squid
Source6: unsquid.pl
Source7: squid.logrotate
Source9: squid.permissions
Source10: README.kerberos
Source11: squid.service
Source12: squid_cache_swap.sh
#
# the following patches are downloaded directly from the webserver
# don't change the names for easier identification
#
# please read every file if there is interest about what the patch changes
# or just visit: http://www.squid-cache.org/Versions/v3/3.0/changesets/
#
# Bug #3440: compile error in Adaptation
#atch0: http://www.squid-cache.org/Versions/v3/3.1/changesets/squid-3.1-10415.patch
# Portability: SSL library dependency fixes
#atch1: http://www.squid-cache.org/Versions/v3/3.1/changesets/squid-3.1-10416.patch
# Polish: debug messages on swap.state rename failure
#atch2: http://www.squid-cache.org/Versions/v3/3.1/changesets/squid-3.1-10417.patch
# Bug #3442: assertion failed: external_acl.cc:908: ch->auth_user_request != NULL
#atch3: http://www.squid-cache.org/Versions/v3/3.1/changesets/squid-3.1-10418.patch
# Bug #3085: Crash when parsing esi:include
#atch4: http://www.squid-cache.org/Versions/v3/3.1/changesets/squid-3.1-10419.patch
# Bug #3473: erase last uses of obsolete auth_user_hash_pointer
#atch5: http://www.squid-cache.org/Versions/v3/3.1/changesets/squid-3.1-10420.patch
# Bug #3420: Request body consumption races and !theConsumer exception.
#atch6: http://www.squid-cache.org/Versions/v3/3.1/changesets/squid-3.1-10421.patch
#
# do not show some rpmlint warnings
Source99: rpmlintrc
# some useful defaults for squid
Patch100: squid-config.patch
# FIX SWAPDIR - make it a configure option
Patch101: squid-swapdir.patch
# make build compare happy - remove build dates
Patch102: squid-nobuilddates.patch
# FIX-FOR-UPSTREAM: rpmlint - incorrect-fsf-address
Patch200: squid-FSF.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
PreReq: %fillup_prereq
PreReq: %insserv_prereq
PreReq: /usr/bin/getent
PreReq: permissions
PreReq: pwdutils
BuildRequires: db-devel
# needed by bootstrap.sh
BuildRequires: cyrus-sasl-devel
BuildRequires: ed
BuildRequires: expat
BuildRequires: gcc-c++
BuildRequires: libcap-devel
BuildRequires: libexpat-devel
BuildRequires: libtool
BuildRequires: openldap2-devel
BuildRequires: opensp-devel
BuildRequires: openssl-devel
BuildRequires: pam-devel
BuildRequires: sharutils
#
%if 0%{?sles_version} == 9
BuildRequires: heimdal-devel
%else
BuildRequires: krb5-devel
%endif
#
%if 0%{?suse_version} > 1030 || 0%{?fedora_version} > 8
BuildRequires: fdupes
%endif
#
%if 0%{?suse_version} >= 1130
BuildRequires: pkgconfig(libxml-2.0)
%else
BuildRequires: libxml2-devel
%endif
%if 0%{?suse_version} > 1140
BuildRequires: systemd
%{?systemd_requires}
%define has_systemd 1
%endif
Conflicts: squid squid2 squid23 squid-beta
Obsoletes: squid-beta
Obsoletes: squid2
Requires: logrotate
Provides: http_proxy
%description
Squid is a caching proxy for the Web supporting HTTP, HTTPS, FTP, and
more. It reduces bandwidth and improves response times by caching and
reusing frequently-requested web pages. Squid has extensive access
controls and makes a great server accelerator.
Squid 3.0 represents a major rewrite of Squid and has a number of new
features.
The most important of these are: - Code converted to C++, with
significant internal restructuring and rewrites.
- ICAP implementation (RFC 3507 and www.icap-forum.org)
- Edge Side Includes (ESI) implementation (www.esi.org)
Most user-facing changes are reflected in squid.conf.
%prep
%setup -q -n squid-%{version}
cp %{SOURCE10} .
# upstream patches after RELEASE
#
##### other patches
%patch100
%if 0%{?suse_version} > 1010
%patch101
%endif
perl -p -i -e 's|/usr/local/bin/perl|/usr/bin/perl|' `find -name "*.pl"`
chmod a-x CREDITS
%patch102
%patch200
%build
%if 0%{?suse_version} > 1010
./bootstrap.sh
autoreconf -fiv
%endif
export CFLAGS="%{optflags} -fPIE -fPIC -DOPENSSL_LOAD_CONF"
export CXXFLAGS="%{optflags} -fPIE -fPIC -DOPENSSL_LOAD_CONF"
export LDFLAGS='-Wl,-z,relro,-z,now -pie'
./configure --prefix=/usr \
--sysconfdir=%{squidconfdir} \
--bindir=/usr/sbin \
--sbindir=/usr/sbin \
--localstatedir=/var \
--libexecdir=/usr/sbin \
--datadir=/usr/share/squid \
--mandir=%{_mandir} \
--libdir=%{_libdir} \
--sharedstatedir=/var/squid \
--with-logdir=/var/log/squid \
%if 0%{?suse_version} > 1010
--with-swapdir=/var/cache/squid \
%endif
--with-pidfile=/var/run/squid.pid \
--with-dl \
--enable-storeio \
--enable-disk-io=AIO,Blocking,DiskDaemon,DiskThreads \
--enable-removal-policies=heap,lru \
--enable-icmp \
--enable-delay-pools \
--enable-esi \
--enable-icap-client \
--enable-useragent-log \
--enable-referer-log \
--enable-kill-parent-hack \
--enable-arp-acl \
--enable-ssl \
--enable-forw-via-db \
--enable-cache-digests \
--enable-linux-netfilter \
--with-large-files \
--enable-underscores \
--enable-auth=basic,digest,ntlm,negotiate \
--enable-basic-auth-helpers=DB,LDAP,MSNT,NCSA,PAM,POP3,SASL,SMB,YP,getpwnam,multi-domain-NTLM,squid_radius_auth \
--enable-ntlm-auth-helpers=fakeauth,no_check,smb_lm \
--enable-negotiate-auth-helpers=squid_kerb_auth \
--enable-digest-auth-helpers=eDirectory,ldap,password \
--enable-external-acl-helpers=ip_user,ldap_group,session,unix_group,wbinfo_group \
--enable-ntlm-fail-open \
--enable-stacktraces \
--enable-x-accelerator-vary \
--with-default-user=squid \
--disable-ident-lookups \
--enable-follow-x-forwarded-for
## Deprecated
# --enable-poll \
# Deprecated. Automatic checks will enable best I/O loop method available.
#
## changed to default, use --disable-* to build without
# --enable-htcp \
# --enable-snmp \
#####
# problematic options
# --enable-truncate \
# overwrite the number of open filedescriptors of configure to 4096
# to be backward compatible, but numbers above should not be overwritten
if [ `awk '/SQUID_MAXFD/{print $3}' include/autoconf.h` -lt 4096 ]; then
set +x
echo "adapting SQUID_MAXFD to 4096"
set -x
perl -pi -e 's;(\#define SQUID_MAXFD) [0-9]+;$1 4096;' include/autoconf.h
fi
make SAMBAPREFIX=/usr %{?_smp_mflags}
#make DEFAULT_LOG_PREFIX=/var/log/squid \
# DEFAULT_SWAP_DIR=/var/cache/squid \
# DEFAULT_PID_FILE=/var/run/squid.pid \
# SAMBAPREFIX=/usr
%install
/usr/sbin/useradd -r -o -g nogroup -u 31 -s /bin/false -c "WWW-proxy squid" \
-d /var/cache/squid squid 2> /dev/null || :
install -d %{buildroot}%{_localstatedir}/{cache,log}/squid
install -d %{buildroot}%{_prefix}/sbin
make install DESTDIR=%{buildroot} SAMBAPREFIX=/usr
mv %{buildroot}{/etc/squid/,/usr/share/squid/}mime.conf.default
ln -s /etc/squid/mime.conf %{buildroot}%{_datadir}/squid # backward compatible
install -d -m 755 %{buildroot}%{_sysconfdir}/permissions.d
install -m 644 %{SOURCE9} %{buildroot}%{_sysconfdir}/permissions.d/squid
install -d -m 755 %{buildroot}%{_sysconfdir}/logrotate.d
install -m 644 %{SOURCE7} %{buildroot}%{_sysconfdir}/logrotate.d/squid
install -d %{buildroot}%{_mandir}/man8/
#chown squid:root -R %{buildroot}%{_localstatedir}/{cache,log}/squid
chmod 750 %{buildroot}%{_localstatedir}/{cache,log}/squid
install -D %{SOURCE3} %{buildroot}%{_sysconfdir}/init.d/squid
ln -sf %{_sysconfdir}/init.d/squid %{buildroot}%{_sbindir}/rcsquid
install -D -m644 %{SOURCE4} %{buildroot}%{_localstatedir}/adm/fillup-templates/sysconfig.squid
install -D -m 644 doc/squid.8 %{buildroot}/%{_mandir}/man8/
install -m 644 helpers/basic_auth/LDAP/squid_ldap_auth.8 %{buildroot}/%{_mandir}/man8/
install -m 644 helpers/basic_auth/LDAP/squid_ldap_auth.8 %{buildroot}/%{_mandir}/man8/
install -m 644 helpers/basic_auth/PAM/pam_auth.8 %{buildroot}/%{_mandir}/man8/
install -m 644 helpers/external_acl/ldap_group/squid_ldap_group.8 %{buildroot}/%{_mandir}/man8/
gzip -9 %{buildroot}/%{_mandir}/man8/*.8
install -d -m 755 doc/scripts
install scripts/*.pl doc/scripts
cat > doc/scripts/cachemgr.readme <<-EOT
cachemgr.cgi will now be found in %{_libdir}/squid
EOT
install -d -m 755 %{buildroot}/%{_libdir}/squid
mv %{buildroot}%{_sbindir}/cachemgr.cgi %{buildroot}/%{_libdir}/squid
install -d -m 755 doc/contrib
install %{SOURCE6} doc/contrib
install -D -m 644 %{SOURCE5} %{buildroot}%{_sysconfdir}/pam.d/squid
#chown squid:shadow %{buildroot}%{_sbindir}/pam_auth
chmod g+s %{buildroot}%{_sbindir}/pam_auth
#rm %{buildroot}%{_sbindir}/Run*
rm -rf %{buildroot}%{squidconfdir}/errors
for i in errors/*; do
if [ -d $i ]; then
mkdir -p %{buildroot}%{_datadir}/squid/$i
install -m 644 $i/* %{buildroot}%{_datadir}/squid/$i
fi
done
ln -sf /usr/share/squid/errors/de %{buildroot}%{squidconfdir}/errors
# remove unpackaged files
rm -f %{buildroot}%{_prefix}/man/man8/*.8
# fix file duplicates
%if 0%{?suse_version} > 1030
%fdupes -s %{buildroot}%{_prefix}
%endif
%if 0%{?fedora_version} > 8
fdupes -q -n -r %{buildroot}%{_prefix}
%endif
%if 0%{?has_systemd}
install -D -m 644 %{SOURCE11} %{buildroot}%{_unitdir}/squid.service
install -D -m 755 %{SOURCE12} %{buildroot}%{_sbindir}/squid_cache_swap.sh
%endif
%pre
# we need this group for squid (ntlmauth)
# read access to /var/lib/samba/winbindd_privileged
if [ -z "`%{_bindir}/getent group winbind 2>/dev/null`" ]; then
%{_sbindir}/groupadd -r winbind 2>/dev/null
fi
if [ -z "`%{_bindir}/getent passwd squid 2>/dev/null`" ]; then
%{_sbindir}/useradd -c "WWW-proxy squid" -d /var/cache/squid \
-G winbind -g nogroup -o -u 31 -r -s /bin/false \
squid 2>/dev/null
fi
# if squid is not member of winbind, add him
if [ `%{_bindir}/id -nG squid 2>/dev/null | grep -q winbind >/dev/null; echo $?` -ne 0 ]; then
%{_sbindir}/groupmod -A squid winbind 2>/dev/null
fi
%if 0%{?has_systemd}
%service_add_pre squid.service
%endif
%post
%if 0%{?sles_version} == 10
sed -i -e "s,\(^%{_sbindir}/pam_auth.*\)\(2755\),\14755," /etc/permissions.secure
%endif
%run_permissions
# update mode?
if [ "$1" -gt "1" ]; then
if [ -e etc/squid.conf -a ! -L etc/squid.conf -a ! -e etc/squid/squid.conf ]; then
echo "moving /etc/squid.conf to /etc/squid/squid.conf"
mv etc/squid.conf etc/squid/squid.conf
fi
fi
%{fillup_and_insserv -n "squid"}
%if 0%{?has_systemd}
%service_add_post squid.service
%endif
%preun
%stop_on_removal squid
%if 0%{?has_systemd}
%service_del_preun squid.service
%endif
%postun
%if 0%{?has_systemd}
%service_del_postun squid.service
%endif
%restart_on_update squid
%insserv_cleanup
%verifyscript
%verify_permissions -e /usr/sbin/pam_auth
%clean
rm -rf %{buildroot}
%files
%defattr(-,root,root)
%if 0%{?has_systemd}
%{_unitdir}/squid.service
%{_sbindir}/squid_cache_swap.sh
%endif
%attr(750,squid,root) %dir %{_localstatedir}/cache/squid/
%attr(750,squid,root) %dir %{_localstatedir}/log/squid/
%dir %{squidconfdir}
%config(noreplace) %{squidconfdir}/cachemgr.conf
%config(noreplace) %{squidconfdir}/errorpage.css
%config(noreplace) %{squidconfdir}/errors
%config(noreplace) %{_sysconfdir}/logrotate.d/squid
%config(noreplace) %{squidconfdir}/mime.conf
%config(noreplace) %{squidconfdir}/msntauth.conf
%config(noreplace) %{squidconfdir}/squid.conf
%config %{squidconfdir}/cachemgr.conf.default
%config %{squidconfdir}/errorpage.css.default
%config %{squidconfdir}/msntauth.conf.default
%config %{squidconfdir}/squid.conf.default
%config %{squidconfdir}/squid.conf.documented
%config %{_sysconfdir}/pam.d/squid
%config %{_sysconfdir}/init.d/squid
%config %{_sysconfdir}/permissions.d/squid
%dir %{_datadir}/squid
%{_datadir}/squid/errors
%{_datadir}/squid/icons
%config %{_datadir}/squid/mib.txt
%{_sbindir}/diskd
%{_sbindir}/digest_pw_auth
%{_sbindir}/digest_edir_auth
%{_sbindir}/digest_ldap_auth
%{_sbindir}/fakeauth_auth
%{_sbindir}/getpwname_auth
%{_sbindir}/ip_user_check
%{_sbindir}/msnt_auth
%{_sbindir}/ncsa_auth
%{_sbindir}/negotiate_kerb_auth
%{_sbindir}/negotiate_kerb_auth_test
%{_sbindir}/no_check.pl
%{_sbindir}/ntlm_smb_lm_auth
%verify(not mode) %attr(4755,root,shadow) %{_sbindir}/pam_auth
%{_sbindir}/pinger
%{_sbindir}/pop3.pl
%{_sbindir}/rcsquid
%{_sbindir}/sasl_auth
%{_sbindir}/smb_auth
%{_sbindir}/smb_auth.sh
%{_sbindir}/smb_auth.pl
%{_sbindir}/squid
%{_sbindir}/squid_db_auth
%{_sbindir}/squid_kerb_auth
%{_sbindir}/squid_kerb_auth_test
%{_sbindir}/squid_ldap_auth
%{_sbindir}/squid_ldap_group
%{_sbindir}/squid_radius_auth
%{_sbindir}/squid_session
%{_sbindir}/squid_unix_group
%{_sbindir}/squidclient
%{_sbindir}/unlinkd
%{_sbindir}/wbinfo_group.pl
%{_sbindir}/yp_auth
%{_datadir}/squid/mime.conf
%{_datadir}/squid/mime.conf.default
%{_localstatedir}/adm/fillup-templates/sysconfig.squid
%dir %{_libdir}/squid
%{_libdir}/squid/cachemgr.cgi
%doc %{_mandir}/man?/*
%doc CONTRIBUTORS COPYING COPYRIGHT CREDITS ChangeLog
%doc QUICKSTART README RELEASENOTES.html SPONSORS
%doc README.kerberos
%doc doc/contrib doc/scripts
%doc doc/debug-sections.txt src/squid.conf.default
#%doc README.squid_ldapauth CREDITS.squid_ldapauth
#%doc squid_ldapauth.conf
%changelog