File squid.spec of Package squid
#
# spec file for package squid
#
# 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/
#
# needsrootforbuild
%define squid_ldapauth_version 1.3
%define squidconfdir /etc/squid
Name: squid
Summary: Squid WWW proxy server
License: GPL-2.0+
Group: Productivity/Networking/Web/Proxy
Version: 2.7.STABLE9
Release: 0
Url: http://www.squid-cache.org
Source: http://www.squid-cache.org/Versions/v2/2.7/squid-%{version}.tar.bz2
Source1: squid_ldapauth-%{squid_ldapauth_version}.tar.bz2
Source2: rc.squid
Source4: README.SuSE
Source5: pam.squid
Source6: squid.logrotate
Source7: squid-%{version}-RELEASENOTES.html
Source8: contrib-2.4.STABLE6.tar.bz2
# OBSOLETE: Create with: wget --cut-dirs=1 -nH -m -k -r -I/Doc/FAQ/ http://www.squid-cache.org/Doc/FAQ/
# FAQ is now changed into a wiki. The complete FAQ can be found at:
# http://wiki.squid-cache.org/SquidFaq/CompleteFaq
Source10: CompleteFaq.html
# Source: http://gaugusch.at/squid.shtml
Source11: squid_ie_blocker.txt
Source12: http://www.squid-cache.org/WCCP-support/Linux/ip_wccp.c
Source13: squid.sysconfig
# PATCH-UPSTREAM - Bug #2973: memoryleak on maformed requests
Patch0: http://www.squid-cache.org/Versions/v2/2.7/changesets/12697.patch
# PATCH-UPSTREAM - Correct parsing of large gopher indexes
Patch1: http://www.squid-cache.org/Versions/v2/2.7/changesets/12711.patch
# PATCH-UPSTREAM - Fix various harmless warnings detected by gcc 4.6
Patch2: http://www.squid-cache.org/Versions/v2/2.7/changesets/12714.patch
#Patch3: http://www.squid-cache.org/Versions/v2/2.7/changesets/
#Patch4: http://www.squid-cache.org/Versions/v2/2.7/changesets/
#Patch5 http://www.squid-cache.org/Versions/v2/2.7/changesets/
#Patch6: http://www.squid-cache.org/Versions/v2/2.7/changesets/
#Patch7: http://www.squid-cache.org/Versions/v2/2.7/changesets/
#Patch8: http://www.squid-cache.org/Versions/v2/2.7/changesets/
#Patch9: http://www.squid-cache.org/Versions/v2/2.7/changesets/
#Patch10: http://www.squid-cache.org/Versions/v2/2.7/changesets/
#Patch11: http://www.squid-cache.org/Versions/v2/2.7/changesets/
#Patch12: http://www.squid-cache.org/Versions/v2/2.7/changesets/
#Patch13: http://www.squid-cache.org/Versions/v2/2.7/changesets/
#Patch14: http://www.squid-cache.org/Versions/v2/2.7/changesets/
#Patch15: http://www.squid-cache.org/Versions/v2/2.7/changesets/
#Patch16: http://www.squid-cache.org/Versions/v2/2.7/changesets/
#Patch17: http://www.squid-cache.org/Versions/v2/2.7/changesets/
#Patch18: http://www.squid-cache.org/Versions/v2/2.7/changesets/
#Patch19: http://www.squid-cache.org/Versions/v2/2.7/changesets/
####
Patch100: squid-2.7.STABLE3-config.patch
Patch101: squid_ldapauth-%{squid_ldapauth_version}.dif
Patch102: %{name}-2.6.STABLE19-64bit.patch
Patch103: %{name}-2.6.STABLE2-ldflags.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
PreReq: /usr/sbin/useradd, %insserv_prereq, %fillup_prereq
BuildRequires: automake
BuildRequires: db-devel
BuildRequires: openldap2-devel
BuildRequires: opensp-devel
BuildRequires: pam-devel
BuildRequires: samba
BuildRequires: sgmltool
BuildRequires: sharutils
%ifarch %ix86 x86_64 ppc ppc64
BuildRequires: valgrind
BuildRequires: valgrind-devel
%endif
Conflicts: squid-beta squid2 squid23
Requires: logrotate, cron
Provides: http_proxy
%description
The stable version of the Squid WWW Proxy Server.
Home page: http://www.squid-cache.org
%prep
%setup -n squid-%{version} -a 1 -a 8
#(cd auth_modules
#tar xzf %{S:21}
#rm -r MSNT
#mv msntauth-v2.0.3-squid.1 MSNT
#)
%patch0 -p1
%patch1 -p1
%patch2 -p1
#%patch3 -p1
#%patch4 -p1
#%patch5 -p1
#%patch6 -p1
#%patch7 -p1
#%patch8 -p1
#%patch9 -p1
#%patch10 -p1
#%patch11 -p1
#%patch12 -p1
#%patch13 -p1
#%patch14 -p1
#%patch15 -p1
#%patch16 -p1
#%patch17 -p1
#%patch18 -p1
#%patch19 -p1
####
%patch100 -p1
perl -pi -e 's%^#!/usr/local/bin/perl%#!/usr/bin/perl%g' `find -name "*.pl"`
(cd squid_ldapauth*
%patch101
)
%patch102 -p1
%patch103 -p1
%build
modified="$(sed -n '/^----/n;s/ - .*$//;p;q' "%{_sourcedir}/%{name}.changes")"
DATE="\"$(date -d "${modified}" "+%%b %%e %%Y")\""
TIME="\"$(date -d "${modified}" "+%%R")\""
find . -type f -regex ".*\.c\|.*\.cpp\|.*\.h" -exec sed -i "s/__DATE__/${DATE}/g;s/__TIME__/${TIME}/g" {} +
%if 0%{?suse_version} < 1220
%{?suse_update_config:%{suse_update_config}}
%endif
export RPM_OPT_FLAGS="$RPM_OPT_FLAGS -fPIE -DLDAP_DEPRECATED -fno-strict-aliasing"
export CFLAGS="$RPM_OPT_FLAGS"
export LDFLAGS="-pie"
aclocal
touch NEWS AUTHORS
automake
autoconf
./configure --prefix=/usr \
--sysconfdir=%{squidconfdir} \
--bindir=/usr/sbin \
--sbindir=/usr/sbin \
--localstatedir=/var \
--libexecdir=/usr/sbin \
--datadir=/usr/share/squid \
--mandir=%{_mandir} \
--with-dl \
--with-maxfd=4096 \
%ifarch %ix86 x86_64 ppc ppc64
--with-valgrind-debug \
%endif
--enable-snmp \
--enable-carp \
--enable-useragent-log \
--enable-auth="basic digest negotiate ntlm" \
--enable-basic-auth-helpers="LDAP MSNT NCSA PAM SMB YP getpwnam multi-domain-NTLM" \
--enable-ntlm-auth-helpers="SMB fakeauth no_check" \
--enable-digest-auth-helpers="ldap password" \
--enable-external-acl-helpers="ip_user ldap_group session unix_group wbinfo_group" \
--enable-ntlm-fail-open \
--enable-referer-log \
--enable-arp-acl \
--enable-htcp \
--enable-underscores \
--enable-stacktraces \
--enable-delay-pools \
--enable-useragent-log \
--enable-referer-log \
--enable-forward-log \
--enable-multicast-miss \
--enable-ssl \
--enable-cache-digests \
--enable-auth-on-acceleration \
--enable-storeio="aufs,coss,diskd,null,ufs" \
--enable-linux-netfilter \
--enable-removal-policies="heap,lru" \
--enable-icmp \
--with-samba-sources=/usr/include/samba \
--enable-large-cache-files \
--enable-x-accelerator-vary \
--enable-follow-x-forwarded-for
make DEFAULT_SWAP_DIR=/var/cache/squid \
DEFAULT_LOG_PREFIX=/var/log/squid \
DEFAULT_PID_FILE=/var/run/squid.pid \
SAMBAPREFIX=/usr
make -C squid_ldapauth-%{squid_ldapauth_version}
mkdir FAQ
cp -p %{S:10} FAQ
%install
mkdir -p $RPM_BUILD_ROOT/var/{cache,log}/squid
mkdir -p $RPM_BUILD_ROOT/usr/sbin
make install DESTDIR=$RPM_BUILD_ROOT SAMBAPREFIX=/usr
mv $RPM_BUILD_ROOT{/etc/squid/,/usr/share/squid/}mime.conf.default
mv $RPM_BUILD_ROOT{/etc/squid/,/usr/share/squid/}msntauth.conf.default
cp $RPM_BUILD_ROOT{/etc/squid/,/usr/share/squid/}msntauth.conf
ln -s /etc/squid/mime.conf $RPM_BUILD_ROOT/usr/share/squid # backward compatible
install -d -m 755 $RPM_BUILD_ROOT/etc/logrotate.d
install -m 644 %{S:6} $RPM_BUILD_ROOT/etc/logrotate.d/squid
install -d %{buildroot}%{_mandir}/man8/
install -m 644 doc/squid.8 $RPM_BUILD_ROOT/%{_mandir}/man8/
install -m 644 helpers/basic_auth/LDAP/squid_ldap_auth.8 $RPM_BUILD_ROOT/%{_mandir}/man8/
install -m 644 helpers/basic_auth/LDAP/squid_ldap_auth.8 $RPM_BUILD_ROOT/%{_mandir}/man8/
install -m 644 helpers/basic_auth/PAM/pam_auth.8 $RPM_BUILD_ROOT/%{_mandir}/man8/
install -m 644 helpers/external_acl/ldap_group/squid_ldap_group.8 $RPM_BUILD_ROOT/%{_mandir}/man8/
gzip -9 $RPM_BUILD_ROOT/%{_mandir}/man8/*.8
install -D %{S:2} $RPM_BUILD_ROOT/etc/init.d/squid
ln -sf /etc/init.d/squid $RPM_BUILD_ROOT/usr/sbin/rcsquid
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 $RPM_BUILD_ROOT/%{_libdir}/squid
mv $RPM_BUILD_ROOT/usr/sbin/cachemgr.cgi $RPM_BUILD_ROOT/%{_libdir}/squid
#nothing for squid-2.5.STABLE1:
install -d -m 755 doc/contrib
install contrib/*.pl doc/contrib
#rm doc/Programming-Guide/Makefile
install -m 644 %{S:7} doc
install -m 644 %{S:4} .
install -m 644 %{S:11} doc/contrib
install -m 644 %{S:12} doc/contrib
install -D -m 644 %{S:5} $RPM_BUILD_ROOT/etc/pam.d/squid
pushd squid_ldapauth-%{squid_ldapauth_version}
install -m 750 squid_ldapauth $RPM_BUILD_ROOT/usr/sbin/
cp README ../README.squid_ldapauth
cp CREDITS ../CREDITS.squid_ldapauth
cp squid_ldapauth.conf ..
popd
cp -a helpers/external_acl/ip_user/README README.ip_user
rm %{buildroot}/usr/sbin/Run*
install -d -m 755 $RPM_BUILD_ROOT/var/adm/fillup-templates
install -m 644 %{S:13} $RPM_BUILD_ROOT/var/adm/fillup-templates/sysconfig.squid
rm -f $RPM_BUILD_ROOT/etc/squid/squid.conf.default
rm -f $RPM_BUILD_ROOT%{_mandir}/man8/pam_auth.8
rm -f $RPM_BUILD_ROOT%{_mandir}/man8/squid.8
rm -f $RPM_BUILD_ROOT%{_mandir}/man8/squid_ldap_auth.8
rm -f $RPM_BUILD_ROOT%{_mandir}/man8/squid_ldap_group.8
rm -f $RPM_BUILD_ROOT%{_mandir}/man8/squid_unix_group.8
%clean
rm -rf $RPM_BUILD_ROOT
%pre
/usr/sbin/useradd -r -o -g nogroup -u 31 -s /bin/false -c "WWW-proxy squid" -d /var/cache/squid squid 2> /dev/null || :
%post
%{fillup_and_insserv squid}
%preun
%stop_on_removal squid
%postun
%restart_on_update squid
%{insserv_cleanup}
%verifyscript
%files
%defattr(-,root,root)
%attr(750,squid,root) %dir /var/cache/squid
%attr(750,squid,root) %dir /var/log/squid
%dir %{squidconfdir}
%config(noreplace) %{squidconfdir}/squid.conf
%config(noreplace) %{squidconfdir}/cachemgr.conf
%config(noreplace) /etc/logrotate.d/squid
%config(noreplace) %{squidconfdir}/mime.conf
%config(noreplace) %{squidconfdir}/msntauth.conf
%config /etc/pam.d/squid
%config /etc/init.d/squid
%dir /usr/share/squid
/usr/share/squid/errors
/usr/share/squid/icons
%config /usr/share/squid/mib.txt
/usr/share/squid/mime.conf
/usr/share/squid/mime.conf.default
/usr/share/squid/msntauth.conf
/usr/share/squid/msntauth.conf.default
/usr/sbin/cossdump
/usr/sbin/digest_ldap_auth
/usr/sbin/digest_pw_auth
/usr/sbin/diskd-daemon
/usr/sbin/fakeauth_auth
/usr/sbin/getpwname_auth
/usr/sbin/ip_user_check
%attr(750,squid,root) /usr/sbin/squid_ldapauth
/usr/sbin/logfile-daemon
/usr/sbin/msnt_auth
/usr/sbin/ncsa_auth
/usr/sbin/no_check.pl
/usr/sbin/ntlm_auth
%verify(not mode) %attr(4755,root,shadow)/usr/sbin/pam_auth
/usr/sbin/pinger
/usr/sbin/rcsquid
/usr/sbin/smb_auth
/usr/sbin/smb_auth.pl
/usr/sbin/smb_auth.sh
/usr/sbin/squid
/usr/sbin/squid_ldap_auth
/usr/sbin/squid_ldap_group
/usr/sbin/squid_session
/usr/sbin/squid_unix_group
/usr/sbin/squidclient
/usr/sbin/unlinkd
/usr/sbin/wbinfo_group.pl
/usr/sbin/yp_auth
/var/adm/fillup-templates/sysconfig.squid
%dir %{_libdir}/squid
%{_libdir}/squid/cachemgr.cgi
%doc %{_mandir}/man*/*
%doc CONTRIBUTORS COPYING COPYRIGHT CREDITS
%doc ChangeLog QUICKSTART README README.SuSE
#%doc doc/HTTP-codes.txt doc/draft-vixie-htcp-proto-04.txt
#%doc doc/Programming-Guide
%doc doc/scripts doc/contrib FAQ
%doc doc/debug-sections.txt src/squid.conf.default
%doc README.squid_ldapauth CREDITS.squid_ldapauth
%doc squid_ldapauth.conf doc/%{name}-%{version}-RELEASENOTES.html
%doc README.ip_user
%changelog