%define base_name squid
%define pkg_epoch 7
%define pkg_version 3.1.16
%define pkg_release 1%{?_dist_release}
Summary: The Squid proxy caching server
Summary(ja): Squid ウェブプロキシキャッシュ
Name: %{base_name}
Epoch: %{pkg_epoch}
Version: %{pkg_version}
Release: %{pkg_release}
Source0: %{base_name}-%{version}.tar.bz2
Source1: %{base_name}.init
Source2: %{base_name}.logrotate
Source3: %{base_name}.sysconfig
Source4: %{base_name}.pam
License: GPLv2+
Group: Applications/Services
URL: http://www.squid-cache.org
Requires: bash >= 2.0
Requires(pre): shadow-utils
Requires(post): %{_syssbindir}/chkconfig
Requires(preun): %{_syssbindir}/chkconfig
BuildRequires: openldap-devel pam-devel openssl-devel krb5-devel
BuildRequires: cyrus-sasl-devel libcap-devel
BuildRoot: %{_tmppath}/%{base_name}-%{version}-root
Conflicts: squid30
Obsoletes: squid-novm
Vendor: Project Vine
Distribution: Vine Linux
Packager: miyabi
%description
Squid is a high-performance proxy caching server for Web clients,
supporting FTP, gopher, and HTTP data objects. Unlike traditional
caching software, Squid handles all requests in a single,
non-blocking, I/O-driven process. Squid keeps meta data and especially
hot objects cached in RAM, caches DNS lookups, supports non-blocking
DNS lookups, and implements negative caching of failed requests.
Squid consists of a main server program squid, a Domain Name System
lookup program (dnsserver), a program for retrieving FTP data
(ftpget), and some management and client tools.
%description -l ja
Squid はウェブクライアントのための高性能のプロキシキャッシュサーバで、
FTP, gopher, HTTP データオブジェクトに対応しています。これまでの
キャッシュソフトウェアと違い、 Squid は全ての要求を、単一の
ブロックしない I/O ドリブンのプロセスで処理します。 Squid はメタデータや
ホットなオブジェクトを RAM に保持し、 DNS 問い合わせをキャッシュします。
ブロック無しの DNS 問い合わせをサポートし、失敗した要求のネガティブ
キャッシングが実装されています。
Squid は、メインのサーバプログラム squid と、 Domain Name System
問い合わせプログラム (dnsserver) と、 FTP データを取得するプログラム
(ftpget) と、いくつかの管理用またはクライアントツールから成ります。
%prep
%setup -q
%build
export CXXFLAGS="-fPIE %{optflags}" ; export CFLAGS="-fPIE -Os -g -pipe -fsigned-char %{optflags}" ; export LDFLAGS="-pie" ;
%configure \
--libexecdir=%{_libdir}/%{base_name} \
--sysconfdir=%{_sysconfdir}/%{base_name} \
--datadir=%{_datadir}/%{base_name} \
--disable-dependency-tracking \
--enable-arp-acl \
--enable-auth="basic,digest,ntlm,negotiate" \
--enable-basic-auth-helpers="LDAP,MSNT,NCSA,PAM,SMB,YP,getpwnam,multi-domain-NTLM,SASL" \
--enable-negotiate-auth-helpers="squid_kerb_auth" \
--enable-cache-digests \
--enable-cachemgr-hostname=localhost \
--enable-delay-pools \
--enable-digest-auth-helpers="password" \
--enable-epoll \
--enable-external-acl-helpers="ip_user,ldap_group,unix_group,wbinfo_group" \
--enable-icap-client \
--enable-ident-lookups \
%ifnarch ppc64 ia64 x86_64 s390x
--with-large-files \
%endif
--enable-linux-netfilter \
--enable-ntlm-auth-helpers="smb_lm,fakeauth" \
--enable-referer-log \
--enable-removal-policies="heap,lru" \
--enable-snmp \
--enable-ssl \
--enable-storeio="aufs,diskd,ufs" \
--enable-useragent-log \
--enable-wccpv2 \
--with-aio \
--with-default-user="%{base_name}" \
--with-logdir=%{_localstatedir}/log/%{base_name} \
--with-filedescriptors=16384 \
--with-dl \
--with-pthreads
export CXXFLAGS="-fPIE" ; export CFLAGS="-fPIE -Os -g -pipe -fsigned-char" ; export LDFLAGS="-pie" ;
%{__make} \
%{?_smp_mflags} \
DEFAULT_SWAP_DIR="%{_localstatedir}/cache/%{base_name}"
%install
[ "${RPM_BUILD_ROOT}" != "/" ] && %{__rm} -rf ${RPM_BUILD_ROOT}
%{__make} install \
DESTDIR="${RPM_BUILD_ROOT}" \
DEFAULT_SWAP_DIR="%{_localstatedir}/cache/%{base_name}"
echo "
#
# This is %{_sysconfdir}/httpd/conf.d/%{base_name}.conf
#
ScriptAlias /Squid/cgi-bin/cachemgr.cgi %{_libdir}/%{base_name}/cachemgr.cgi
# Only allow access from localhost by default
order allow,deny
allow from localhost.localdomain
# Add additional allowed hosts as needed
# allow from .example.com
" > ${RPM_BUILD_ROOT}/%{base_name}.httpd.tmp
mkdir -p ${RPM_BUILD_ROOT}%{_initdir}
mkdir -p ${RPM_BUILD_ROOT}%{_sysconfdir}/logrotate.d
mkdir -p ${RPM_BUILD_ROOT}%{_sysconfdir}/sysconfig
mkdir -p ${RPM_BUILD_ROOT}%{_sysconfdir}/pam.d
mkdir -p ${RPM_BUILD_ROOT}%{_sysconfdir}/httpd/conf.d/
install -m 755 %{SOURCE1} ${RPM_BUILD_ROOT}%{_initdir}/%{base_name}
install -m 644 %{SOURCE2} ${RPM_BUILD_ROOT}%{_sysconfdir}/logrotate.d/%{base_name}
install -m 644 %{SOURCE3} ${RPM_BUILD_ROOT}%{_sysconfdir}/sysconfig/%{base_name}
install -m 644 %{SOURCE4} ${RPM_BUILD_ROOT}%{_sysconfdir}/pam.d/%{base_name}
install -m 644 ${RPM_BUILD_ROOT}/%{base_name}.httpd.tmp ${RPM_BUILD_ROOT}%{_sysconfdir}/httpd/conf.d/%{base_name}.conf
mkdir -p ${RPM_BUILD_ROOT}%{_localstatedir}/log/%{base_name}
mkdir -p ${RPM_BUILD_ROOT}%{_localstatedir}/cache/%{base_name}
chmod 644 contrib/url-normalizer.pl contrib/rredir.* contrib/user-agents.pl
iconv -f ISO88591 -t UTF8 ChangeLog -o ChangeLog.tmp
mv -f ChangeLog.tmp ChangeLog
# remove unpackaged files from the buildroot
rm -f ${RPM_BUILD_ROOT}/%{base_name}.httpd.tmp
%clean
[ "${RPM_BUILD_ROOT}" != "/" ] && %{__rm} -rf ${RPM_BUILD_ROOT}
%pre
if ! getent group %{base_name} >/dev/null 2>&1; then
/usr/sbin/groupadd -g 23 %{base_name}
fi
if ! getent passwd %{base_name} >/dev/null 2>&1 ; then
/usr/sbin/useradd -g 23 -u 23 -d %{_localstatedir}/cache/%{base_name} -r -s /sbin/nologin %{base_name} >/dev/null 2>&1 || exit 1
fi
for i in %{_localstatedir}/log/%{base_name} %{_localstatedir}/cache/%{base_name} ; do
if [ -d $i ] ; then
for adir in `find $i -maxdepth 0 \! -user %{base_name}`; do
chown -R %{base_name}:%{base_name} $adir
done
fi
done
exit 0
%post
if ! /sbin/chkconfig %{base_name}; then
/sbin/chkconfig --add %{base_name}
fi
if [ "$1" -eq "2" ]; then
%{_initdir}/%{base_name} condrestart
fi
%preun
if [ "$1" -eq "0" ]; then
%{_initdir}/%{base_name} stop
rm -f %{_localstatedir}/log/%{base_name}/*
/sbin/chkconfig --del %{base_name}
fi
%triggerin -- samba-common
/usr/sbin/usermod -a -G wbpriv %{base_name} >/dev/null 2>&1 || \
chgrp %{base_name} %{_localstatedir}/cache/samba/winbindd_privileged >/dev/null 2>&1 || :
%files
%defattr(-,root,root,-)
# Directory
%dir %{_sysconfdir}/%{base_name}/
%dir %{_libdir}/%{base_name}
%dir %{_datadir}/%{base_name}
%attr(0750,%{base_name},%{base_name}) %dir %{_localstatedir}/log/%{base_name}
%attr(0750,%{base_name},%{base_name}) %dir %{_localstatedir}/cache/%{base_name}
# Program Files
%attr(0755,root,root) %{_sbindir}/%{base_name}
%attr(0755,root,root) %{_bindir}/squidclient
%attr(0755,root,root) %{_initdir}/%{base_name}
%attr(0755,root,root) %{_libdir}/%{base_name}/cachemgr.cgi
%attr(4750,root,%{base_name}) %{_libdir}/%{base_name}/digest_pw_auth
%attr(4750,root,%{base_name}) %{_libdir}/%{base_name}/diskd
%attr(4750,root,%{base_name}) %{_libdir}/%{base_name}/fakeauth_auth
%attr(4750,root,%{base_name}) %{_libdir}/%{base_name}/getpwname_auth
%attr(4750,root,%{base_name}) %{_libdir}/%{base_name}/ip_user_check
%attr(4750,root,%{base_name}) %{_libdir}/%{base_name}/msnt_auth
%attr(4750,root,%{base_name}) %{_libdir}/%{base_name}/ncsa_auth
%attr(4750,root,%{base_name}) %{_libdir}/%{base_name}/negotiate_kerb_auth
%attr(4750,root,%{base_name}) %{_libdir}/%{base_name}/negotiate_kerb_auth_test
%attr(4750,root,%{base_name}) %{_libdir}/%{base_name}/ntlm_smb_lm_auth
%attr(4750,root,%{base_name}) %{_libdir}/%{base_name}/pam_auth
%attr(4750,root,%{base_name}) %{_libdir}/%{base_name}/sasl_auth
%attr(4750,root,%{base_name}) %{_libdir}/%{base_name}/smb_auth
%attr(4750,root,%{base_name}) %{_libdir}/%{base_name}/smb_auth.pl
%attr(4750,root,%{base_name}) %{_libdir}/%{base_name}/smb_auth.sh
%attr(4750,root,%{base_name}) %{_libdir}/%{base_name}/squid_kerb_auth
%attr(4750,root,%{base_name}) %{_libdir}/%{base_name}/squid_kerb_auth_test
%attr(4750,root,%{base_name}) %{_libdir}/%{base_name}/squid_ldap_auth
%attr(4750,root,%{base_name}) %{_libdir}/%{base_name}/squid_ldap_group
%attr(4750,root,%{base_name}) %{_libdir}/%{base_name}/squid_unix_group
%attr(4750,root,%{base_name}) %{_libdir}/%{base_name}/unlinkd
%attr(4750,root,%{base_name}) %{_libdir}/%{base_name}/wbinfo_group.pl
%attr(4750,root,%{base_name}) %{_libdir}/%{base_name}/yp_auth
# Config Files
%attr(0640,root,%{base_name}) %config(noreplace) %{_sysconfdir}/%{base_name}/%{base_name}.conf
%attr(0644,root,%{base_name}) %config(noreplace) %{_sysconfdir}/%{base_name}/cachemgr.conf
%config(noreplace) %{_sysconfdir}/%{base_name}/mime.conf
%config(noreplace) %{_sysconfdir}/%{base_name}/msntauth.conf
%config(noreplace) %{_sysconfdir}/%{base_name}/errorpage.css
%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/httpd/conf.d/%{base_name}.conf
%config(noreplace) %{_sysconfdir}/sysconfig/%{base_name}
%config(noreplace) %{_sysconfdir}/pam.d/%{base_name}
%config(noreplace) %{_sysconfdir}/logrotate.d/%{base_name}
# Sample Config Files
%config %{_sysconfdir}/%{base_name}/%{base_name}.conf.default
%config %{_sysconfdir}/%{base_name}/cachemgr.conf.default
%config %{_sysconfdir}/%{base_name}/mime.conf.default
%config %{_sysconfdir}/%{base_name}/msntauth.conf.default
%config %{_sysconfdir}/%{base_name}/errorpage.css.default
# Data Files
%{_datadir}/%{base_name}/*
# Document Files
%doc README ChangeLog QUICKSTART
%doc contrib/url-normalizer.pl contrib/rredir.* contrib/user-agents.pl
%{_mandir}/man8/*
%{_mandir}/man1/*
%{_sysconfdir}/%{base_name}/%{base_name}.conf.documented
%changelog
* Mon Oct 17 2011 Masahiro INOUE 3.1.16-1
- new upstream release
- add BuildRequires - libcap-devel
* Fri Jun 10 2011 Masahiro INOUE 3.1.12-2
- files in libexec moved to libdir
* Tue May 17 2011 Masahiro INOUE 3.1.12-1
- initial build for Vine Linux
- This package is based on Vine Linux - squid-3.0.STABLE25-2