File squid-beta.spec of Package squid-beta

#
# spec file for package squid-beta (Version 3.0)
#
# Copyright (c) 2010 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/
#



Name:           squid-beta
BuildRequires:  expat gcc-c++ krb5 libexpat-devel libxml2-devel
BuildRequires:  openldap2-devel opensp-devel pam-devel sharutils
Summary:        Squid V3.0 WWW Proxy Server (new version)
Version:        3.0
Release:        438.<RELEASE35>
License:        GPL v2 or later
%define		ver PRE6
Url:            http://www.squid-cache.org
Group:          Productivity/Networking/Web/Proxy
Requires:       logrotate
Provides:       http_proxy
PreReq:         permissions
Conflicts:      squid squid2 squid23 squid3
AutoReqProv:    on
%if %suse_version > 800
PreReq:         /usr/sbin/useradd, %insserv_prereq, %fillup_prereq
%else
PreReq:         /usr/sbin/useradd
%endif
Source0:        http://www.squid-cache.org/Versions/v3/3.0/squid-%{version}.%{ver}.tar.bz2
#%define       squid_ldapauth_version 1.3
#Source1:      squid_ldapauth-%{squid_ldapauth_version}.tar.bz2
Source2:        rc.squid
Source3:        squid-3.0.PRE6-RELEASENOTES.html
Source5:        pam.squid
Source6:        unsquid.pl
Source7:        squid.logrotate
Source9:        squid.permissions
Patch:          squid-2.5.dif
#
# 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/
#
Patch01:        http://www.squid-cache.org/Versions/v3/3.0/changesets/10789.patch
Patch02:        http://www.squid-cache.org/Versions/v3/3.0/changesets/10790.patch
Patch03:        http://www.squid-cache.org/Versions/v3/3.0/changesets/10791.patch
Patch04:        http://www.squid-cache.org/Versions/v3/3.0/changesets/10792.patch
Patch05:        http://www.squid-cache.org/Versions/v3/3.0/changesets/10796.patch
Patch06:        http://www.squid-cache.org/Versions/v3/3.0/changesets/10797.patch
Patch07:        http://www.squid-cache.org/Versions/v3/3.0/changesets/10798.patch
Patch08:        http://www.squid-cache.org/Versions/v3/3.0/changesets/10800.patch
Patch09:        http://www.squid-cache.org/Versions/v3/3.0/changesets/10801.patch
Patch10:        http://www.squid-cache.org/Versions/v3/3.0/changesets/10802.patch
Patch11:        http://www.squid-cache.org/Versions/v3/3.0/changesets/10803.patch
Patch12:        http://www.squid-cache.org/Versions/v3/3.0/changesets/10804.patch
Patch13:        http://www.squid-cache.org/Versions/v3/3.0/changesets/10805.patch
Patch14:        http://www.squid-cache.org/Versions/v3/3.0/changesets/10806.patch
Patch15:        http://www.squid-cache.org/Versions/v3/3.0/changesets/10808.patch
Patch16:        http://www.squid-cache.org/Versions/v3/3.0/changesets/10809.patch
Patch17:        http://www.squid-cache.org/Versions/v3/3.0/changesets/10811.patch
Patch18:        http://www.squid-cache.org/Versions/v3/3.0/changesets/10812.patch
Patch19:        http://www.squid-cache.org/Versions/v3/3.0/changesets/10813.patch
Patch20:        http://www.squid-cache.org/Versions/v3/3.0/changesets/10814.patch
Patch21:        http://www.squid-cache.org/Versions/v3/3.0/changesets/10815.patch
Patch22:        http://www.squid-cache.org/Versions/v3/3.0/changesets/10816.patch
Patch23:        http://www.squid-cache.org/Versions/v3/3.0/changesets/10817.patch
Patch24:        http://www.squid-cache.org/Versions/v3/3.0/changesets/10818.patch
Patch25:        http://www.squid-cache.org/Versions/v3/3.0/changesets/10820.patch
Patch26:        http://www.squid-cache.org/Versions/v3/3.0/changesets/10821.patch
Patch27:        http://www.squid-cache.org/Versions/v3/3.0/changesets/10822.patch
Patch28:        http://www.squid-cache.org/Versions/v3/3.0/changesets/10823.patch
Patch29:        http://www.squid-cache.org/Versions/v3/3.0/changesets/10824.patch
Patch30:        http://www.squid-cache.org/Versions/v3/3.0/changesets/10825.patch
Patch31:        http://www.squid-cache.org/Versions/v3/3.0/changesets/10826.patch
Patch32:        http://www.squid-cache.org/Versions/v3/3.0/changesets/10827.patch
Patch33:        http://www.squid-cache.org/Versions/v3/3.0/changesets/10828.patch
Patch34:        http://www.squid-cache.org/Versions/v3/3.0/changesets/10829.patch
Patch35:        http://www.squid-cache.org/Versions/v3/3.0/changesets/10830.patch
Patch36:        http://www.squid-cache.org/Versions/v3/3.0/changesets/10831.patch
Patch37:        http://www.squid-cache.org/Versions/v3/3.0/changesets/10832.patch
Patch38:        http://www.squid-cache.org/Versions/v3/3.0/changesets/10833.patch
Patch39:        http://www.squid-cache.org/Versions/v3/3.0/changesets/10834.patch
Patch40:        http://www.squid-cache.org/Versions/v3/3.0/changesets/10836.patch
Patch41:        http://www.squid-cache.org/Versions/v3/3.0/changesets/10837.patch
Patch42:        http://www.squid-cache.org/Versions/v3/3.0/changesets/10838.patch
Patch43:        http://www.squid-cache.org/Versions/v3/3.0/changesets/10839.patch
Patch44:        http://www.squid-cache.org/Versions/v3/3.0/changesets/10840.patch
Patch45:        http://www.squid-cache.org/Versions/v3/3.0/changesets/10841.patch
Patch46:        http://www.squid-cache.org/Versions/v3/3.0/changesets/10843.patch
Patch47:        http://www.squid-cache.org/Versions/v3/3.0/changesets/10844.patch
Patch48:        http://www.squid-cache.org/Versions/v3/3.0/changesets/10845.patch
Patch49:        http://www.squid-cache.org/Versions/v3/3.0/changesets/10846.patch
Patch50:        http://www.squid-cache.org/Versions/v3/3.0/changesets/10847.patch
Patch51:        http://www.squid-cache.org/Versions/v3/3.0/changesets/10848.patch
Patch52:        http://www.squid-cache.org/Versions/v3/3.0/changesets/10849.patch
Patch53:        http://www.squid-cache.org/Versions/v3/3.0/changesets/10850.patch
Patch54:        http://www.squid-cache.org/Versions/v3/3.0/changesets/10851.patch
Patch55:        http://www.squid-cache.org/Versions/v3/3.0/changesets/10852.patch
Patch56:        http://www.squid-cache.org/Versions/v3/3.0/changesets/10853.patch
Patch57:        http://www.squid-cache.org/Versions/v3/3.0/changesets/10854.patch
Patch58:        http://www.squid-cache.org/Versions/v3/3.0/changesets/10855.patch
Patch59:        http://www.squid-cache.org/Versions/v3/3.0/changesets/10856.patch
Patch60:        http://www.squid-cache.org/Versions/v3/3.0/changesets/10857.patch
Patch61:        http://www.squid-cache.org/Versions/v3/3.0/changesets/10858.patch
Patch62:        http://www.squid-cache.org/Versions/v3/3.0/changesets/10859.patch
Patch63:        http://www.squid-cache.org/Versions/v3/3.0/changesets/10860.patch
Patch64:        http://www.squid-cache.org/Versions/v3/3.0/changesets/10861.patch
Patch65:        http://www.squid-cache.org/Versions/v3/3.0/changesets/10862.patch
Patch66:        http://www.squid-cache.org/Versions/v3/3.0/changesets/10863.patch
Patch67:        http://www.squid-cache.org/Versions/v3/3.0/changesets/10865.patch
Patch68:        http://www.squid-cache.org/Versions/v3/3.0/changesets/10866.patch
#
# Patch100:       squid-3.0-gcc.patch
Patch101:       squid-beta-3.0-libmxl2.patch
Patch102:       squid-beta-3.0-64bit.patch
Patch103:       squid-beta-3.0-ia64.patch
Patch104:       squid-beta-3.0.pre4-gcc41_wur.patch
Patch105:       squid-beta-3.0-openldap.patch
Patch106:       squid-beta-3.0-mem_node_64bit.patch
Patch107:       squid-beta-3.0-md5.patch
Patch108:       squid-beta-3.0.PRE6-array_bound.patch
Patch109:       squid3-3.0.RC1-gcc43_warn.patch
Patch110:       squid3-3.0.STABLE1-icap_memset.patch
Patch111:       squid3-3.0.STABLE1-snmp_strncat.patch
Patch112:       squid_dns_dos_bnc576087.patch
Patch113:       squid-3.0.PRE6-b9070_b9074_b9074_b9081_b9082_bnc525774.patch
Patch114:       squid-3.0.PRE6-bug2541-bnc577347.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%define		squidlibdir %{_libdir}/squid
%define		squidconfdir /etc/squid

%description
A recent development snapshot of the squid V3.0 WWW proxy server.



Authors:
--------
    Duane Wessels <wessels@ircache.net>

%prep
%setup -q -n squid-%{version}.%{ver}
%patch -p0
%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
# %patch20 -p1
%patch21 -p1
%patch22 -p1
%patch23 -p1
%patch24 -p1
%patch25 -p1
%patch26 -p1
%patch27 -p1
%patch28 -p1
%patch29 -p1
%patch30 -p1
%patch31 -p1
%patch32 -p1
%patch33 -p1
%patch34 -p1
%patch35 -p1
%patch36 -p1
%patch37 -p1
%patch38 -p1
%patch39 -p1
%patch40 -p1
%patch41 -p1
%patch42 -p1
%patch43 -p1
%patch44 -p1
%patch45 -p1
%patch46 -p1
%patch47 -p1
%patch48 -p1
%patch49 -p1
%patch50 -p1
%patch51 -p1
%patch52 -p1
%patch53 -p1
%patch54 -p1
%patch55 -p1
%patch56 -p1
%patch57 -p1
%patch58 -p1
%patch59 -p1
%patch60 -p1
%patch61 -p1
%patch62 -p1
%patch63 -p1
%patch64 -p1
%patch65 -p1
%patch66 -p1
%patch67 -p1
%patch68 -p1
# %patch69 -p1
# %patch70 -p1
# %patch71 -p1
# %patch72 -p1
# %patch73 -p1
# %patch74 -p1
# %patch75 -p1
# %patch76 -p1
# %patch77 -p1
# %patch78 -p1
# %patch79 -p1
# %patch80 -p1
# %patch81 -p1
# %patch82 -p1
# %patch83 -p1
# %patch84 -p1
# %patch85 -p1
# %patch86 -p1
# %patch87 -p1
# %patch88 -p1
# %patch89 -p1
# %patch90 -p1
# %patch91 -p1
# %patch92 -p1
# %patch93 -p1
# %patch94 -p1
# %patch95 -p1
# %patch96 -p1
# %patch100 -p1
%patch101 -p1
perl -p -i -e 's|SAMBAPREFIX=/usr/local/samba|SAMBAPREFIX=/usr|' helpers/basic_auth/SMB/Makefile.in
perl -p -i -e 's|SAMBAPREFIX=/usr/local/samba|SAMBAPREFIX=/usr|' helpers/ntlm_auth/SMB/Makefile.in
perl -p -i -e 's|/usr/local/bin/perl|/usr/bin/perl|' `find -name "*.pl"`
if [ "%_lib" = "lib64" ]; then
# %patch102 -p1
 :
fi
%ifarch ia64
%patch103 -p1
%endif
%patch104 -p1
%patch105 -p1
%patch106 -p1
%patch107 -p0
%patch108 -p1
%patch109 -p1
%patch110 -p1
%patch111 -p1
%patch112 -p1
%patch113 -p0
%patch114 -p0

%build
export CFLAGS="$RPM_OPT_FLAGS -fPIE -fPIC -fno-strict-aliasing"
export CXXFLAGS="$RPM_OPT_FLAGS -fPIC -fno-strict-aliasing"
export LDFLAGS='-pie'
autoreconf -fi
./configure --prefix=/usr \
	--sysconfdir=%{squidconfdir} \
	--bindir=/usr/sbin \
	--sbindir=/usr/sbin \
	--localstatedir=/var \
	--libexecdir=/usr/sbin \
	--datadir=/usr/share/squid \
	--libdir=%{_libdir} \
	--with-dl \
	--sharedstatedir=/var/squid \
	--enable-storeio=aufs,coss,diskd,null,ufs \
	--enable-disk-io=AIO,Blocking,DiskDaemon,DiskThreads \
	--enable-removal-policies=heap,lru \
	--enable-icmp \
	--enable-delay-pools \
	--enable-esi \
	--enable-useragent-log \
	--enable-referer-log \
	--enable-kill-parent-hack \
	--enable-snmp \
	--enable-arp-acl \
	--enable-htcp \
	--enable-ssl \
	--enable-forw-via-db \
	--enable-cache-digests \
	--enable-poll \
	--enable-linux-netfilter \
	--enable-large-files \
	--enable-underscores \
	--enable-auth=basic,digest,ntlm,negotiate \
	--enable-basic-auth-helpers=LDAP,MSNT,NCSA,PAM,SMB,YP,getpwnam,multi-domain-NTLM \
	--enable-ntlm-auth-helpers=SMB,no_check,fakeauth \
	--enable-digest-auth-helpers=password \
	--enable-ntlm-fail-open \
	--enable-icap-client \
	--enable-external-acl-helpers=ip_user,ldap_group,unix_group,wbinfo_group \
	--enable-stacktraces \
	--enable-x-accelerator-vary
# 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 	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 || :
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
ln -s /etc/squid/mime.conf $RPM_BUILD_ROOT/usr/share/squid # backward compatible
install -d -m 755 $RPM_BUILD_ROOT/etc/permissions.d
install -m 644 %{SOURCE9} $RPM_BUILD_ROOT/etc/permissions.d/squid
install -d -m 755 $RPM_BUILD_ROOT/etc/logrotate.d
install -m 644 %{SOURCE7} $RPM_BUILD_ROOT/etc/logrotate.d/squid
install -d %{buildroot}%{_mandir}/man8/
#chown squid:root -R $RPM_BUILD_ROOT/var/{cache,log}/squid
chmod 750 $RPM_BUILD_ROOT/var/{cache,log}/squid
install -D %{SOURCE2} $RPM_BUILD_ROOT/etc/init.d/squid
ln -sf /etc/init.d/squid $RPM_BUILD_ROOT/usr/sbin/rcsquid
mkdir -p $RPM_BUILD_ROOT/%{_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 -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
install -d -m 755 doc/contrib
install %{SOURCE6} doc/contrib
install -D -m 644 %{SOURCE5} $RPM_BUILD_ROOT/etc/pam.d/squid
#chown squid:shadow $RPM_BUILD_ROOT/usr/sbin/pam_auth
chmod g+s $RPM_BUILD_ROOT/usr/sbin/pam_auth
rm %{buildroot}/usr/sbin/Run*
rm -rf %{buildroot}%{squidconfdir}/errors
for i in errors/*; do
	if [ -d $i ]; then
		mkdir -p %{buildroot}/usr/share/squid/$i
		install -m 644 $i/* %{buildroot}/usr/share/squid/$i
	fi
done
ln -fs /usr/share/squid/errors/English %{buildroot}%{squidconfdir}/errors
# remove unpackaged files
#rm $RPM_BUILD_ROOT/usr/man/man8/*.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
%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 squid}

%preun
%stop_on_removal squid

%postun
%restart_on_update squid
%insserv_cleanup
%verifyscript
%verify_permissions -e /usr/sbin/pam_auth

%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) %{squidconfdir}/errors
%config(noreplace) /etc/logrotate.d/squid
%config(noreplace) %{squidconfdir}/mime.conf
%config(noreplace) %{squidconfdir}/msntauth.conf
%config(noreplace) %{squidconfdir}/msntauth.conf.default
%config(noreplace) %{squidconfdir}/squid.conf.default
%config /etc/pam.d/squid
%config /etc/init.d/squid
/etc/permissions.d/squid
%dir /usr/share/squid
/usr/share/squid/errors
/usr/share/squid/icons
%config /usr/share/squid/mib.txt
%_sbindir/diskd
%_sbindir/digest_pw_auth
%_sbindir/fakeauth_auth
%_sbindir/getpwname_auth
%_sbindir/ip_user_check
%_sbindir/msnt_auth
%_sbindir/ncsa_auth
%_sbindir/no_check.pl
%_sbindir/ntlm_auth
%verify(not mode) %attr(4755,root,shadow) %_sbindir/pam_auth
%_sbindir/pinger
%_sbindir/rcsquid
%_sbindir/smb_auth
%_sbindir/smb_auth.sh
%_sbindir/smb_auth.pl
%_sbindir/squid
%_sbindir/squid_ldap_auth
%_sbindir/squid_ldap_group
%_sbindir/squid_unix_group
%_sbindir/squidclient
%_sbindir/unlinkd
%_sbindir/wbinfo_group.pl
%_sbindir/yp_auth
/usr/share/squid/mime.conf
/usr/share/squid/mime.conf.default
%dir %{_libdir}/squid
%{_libdir}/squid/cachemgr.cgi
%doc %{_mandir}/man*/*
%doc CONTRIBUTORS COPYING COPYRIGHT CREDITS ChangeLog
%doc QUICKSTART README RELEASENOTES.html SPONSORS
%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