%define base_name squid
%define pkg_epoch 7
%define pkg_version 3.5.19
%define pkg_release 1%{?_dist_release}
%define uid 23
%define gid 23
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.xz
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
Patch201: squid-3.1.0.9-config.patch
Patch202: squid-3.1.0.9-location.patch
Patch203: squid-3.0.STABLE1-perlpath.patch
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 libdb-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
%patch201 -p1 -b .config
%patch202 -p1 -b .location
%patch203 -p1 -b .perlpath
%build
CXXFLAGS="$RPM_OPT_FLAGS -fPIC"
CFLAGS="$RPM_OPT_FLAGS -fPIC"
LDFLAGS="$RPM_LD_FLAGS -pie -Wl,-z,relro -Wl,-z,now -Wl,--warn-shared-textrel"
%configure \
--libexecdir=%{_libdir}/%{base_name} \
--datadir=%{_datadir}/%{base_name} \
--sysconfdir=%{_sysconfdir}/%{base_name} \
--with-logdir=%{_localstatedir}/log/%{base_name} \
--disable-dependency-tracking \
--enable-eui \
--enable-follow-x-forwarded-for \
--enable-arp-acl \
--enable-auth \
--enable-auth-basic="DB,LDAP,MSNT-multi-domain,NCSA,NIS,PAM,POP3,SASL,SMB,getpwnam" \
--enable-auth-digest="file,LDAP,eDirectory" \
--enable-auth-negotiate="kerberos" \
--enable-auth-ntlm="smb_lm,fake" \
--enable-external-acl-helpers="LDAP_group,time_quota,session,unix_group,wbinfo_group" \
--enable-cache-digests \
--enable-cachemgr-hostname=localhost \
--enable-delay-pools \
--enable-epoll \
--enable-icap-client \
--enable-ident-lookups \
%ifnarch ppc64 ia64 x86_64 s390x
--with-large-files \
%endif
--enable-linux-netfilter \
--enable-referer-log \
--enable-removal-policies="heap,lru" \
--enable-snmp \
--enable-ssl \
--enable-ssl-crtd \
--enable-storeio="aufs,diskd,ufs,rock" \
--enable-diskio \
--enable-useragent-log \
--enable-wccpv2 \
--with-aio \
--with-default-user="%{base_name}" \
--with-filedescriptors=16384 \
--with-dl \
--with-openssl \
--with-pthreads \
--disable-arch-native \
--with-pic
%{__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}
%pretrans
for l in zh-cn zh-tw; do
if [ -d /usr/share/squid/errors/$l -a ! -L /usr/share/squid/errors/$l ]; then
rm -rf /usr/share/squid/errors/$l
fi
done
%pre
if ! getent group %{base_name} >/dev/null 2>&1; then
/usr/sbin/groupadd -g %{gid} %{base_name}
fi
if ! getent passwd %{base_name} >/dev/null 2>&1 ; then
/usr/sbin/useradd -g %{gid} -u %{uid} -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}/*
%attr(0755,root,root) %{_initdir}/%{base_name}
%attr(0755,root,root) %{_libdir}/%{base_name}/cachemgr.cgi
%attr(4750,root,%{base_name}) %{_libdir}/%{base_name}/basic_*
%attr(4750,root,%{base_name}) %{_libdir}/%{base_name}/cert_*
%attr(4750,root,%{base_name}) %{_libdir}/%{base_name}/digest_*
%attr(4750,root,%{base_name}) %{_libdir}/%{base_name}/diskd
%attr(4750,root,%{base_name}) %{_libdir}/%{base_name}/ext_*
%attr(4750,root,%{base_name}) %{_libdir}/%{base_name}/helper*
%attr(4750,root,%{base_name}) %{_libdir}/%{base_name}/log_*
%attr(4750,root,%{base_name}) %{_libdir}/%{base_name}/negotiate_*
%attr(4750,root,%{base_name}) %{_libdir}/%{base_name}/ntlm_*
%attr(4750,root,%{base_name}) %{_libdir}/%{base_name}/ssl_crtd
%attr(4750,root,%{base_name}) %{_libdir}/%{base_name}/storeid_*
%attr(4750,root,%{base_name}) %{_libdir}/%{base_name}/unlinkd
%attr(4750,root,%{base_name}) %{_libdir}/%{base_name}/url_*
# 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}/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}/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
* Wed Jun 29 2016 Tomohiro "Tomo-p" KATO 3.5.19-1
- new upstream release.
* Fri Apr 29 2016 Tomohiro "Tomo-p" KATO 3.5.17-1
- new upstream release.
* Tue Apr 12 2016 Tomohiro "Tomo-p" KATO 3.5.16-1
- new upstream release.
* Thu Jun 18 2015 Tomohiro "Tomo-p" KATO 3.5.5-1
- new upstream release.
* Mon Jul 7 2014 Tomohiro "Tomo-p" KATO 3.4.6-1
- new upstream release.
* Sat Jan 12 2013 Masahiro INOUE 3.1.23-1
- new upstream release
* Sat Dec 08 2012 Masahiro INOUE 3.1.22-1
- new upstream release
* Thu Nov 22 2012 Masahiro INOUE 3.1.21-1
- new upstream release
* Thu Aug 23 2012 Masahiro INOUE 3.1.20-1
- new upstream release
* 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