You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
198 lines
6.5 KiB
198 lines
6.5 KiB
## |
|
## squid.spec -- OpenPKG RPM Specification |
|
## Copyright (c) 2000-2003 The OpenPKG Project <http://www.openpkg.org/> |
|
## Copyright (c) 2000-2003 Ralf S. Engelschall <rse@engelschall.com> |
|
## Copyright (c) 2000-2003 Cable & Wireless <http://www.cw.com/> |
|
## |
|
## Permission to use, copy, modify, and distribute this software for |
|
## any purpose with or without fee is hereby granted, provided that |
|
## the above copyright notice and this permission notice appear in all |
|
## copies. |
|
## |
|
## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED |
|
## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
|
## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
|
## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR |
|
## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
|
## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
|
## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF |
|
## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
|
## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
|
## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT |
|
## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
|
## SUCH DAMAGE. |
|
## |
|
|
|
# package version |
|
%define V_maj 2 |
|
%define V_min 5 |
|
%define V_rev 3 |
|
|
|
# package information |
|
Name: squid |
|
Summary: Character Set Conversion Tool |
|
URL: http://www.squid-cache.org/ |
|
Vendor: The Squid Project |
|
Packager: The OpenPKG Project |
|
Distribution: OpenPKG [BASE] |
|
Group: Web |
|
License: GPL |
|
Version: %{V_maj}.%{V_min}.%{V_rev} |
|
Release: 20030731 |
|
|
|
# package options |
|
%option with_fsl yes |
|
%option with_ssl no |
|
%option with_snmp no |
|
|
|
# list of sources |
|
Source0: http://www.squid-cache.org/Versions/v%{V_maj}/%{V_maj}.%{V_min}/squid-%{V_maj}.%{V_min}.STABLE%{V_rev}.tar.gz |
|
Source1: rc.squid |
|
Source2: fsl.squid |
|
|
|
# build information |
|
Prefix: %{l_prefix} |
|
BuildRoot: %{l_buildroot} |
|
BuildPreReq: OpenPKG, openpkg >= 20030718, gcc, perl |
|
PreReq: OpenPKG, openpkg >= 20030718 |
|
%if "%{with_fsl}" == "yes" |
|
BuildPreReq: fsl >= 1.2.0 |
|
PreReq: fsl >= 1.2.0 |
|
%endif |
|
%if "%{with_ssl}" == "yes" |
|
BuildPreReq: openssl |
|
PreReq: openssl |
|
%endif |
|
AutoReq: no |
|
AutoReqProv: no |
|
|
|
%description |
|
Squid is a full-featured Web proxy which supports proxying and |
|
caching of HTTP, FTP, and other URL's; proxying for SSL cache |
|
hierarchies; supporting ICP, HTCP, and CARP; supports Cache Digests |
|
transparent caching, etc. |
|
|
|
%prep |
|
%setup -q -n squid-%{V_maj}.%{V_min}.STABLE%{V_rev} |
|
|
|
%build |
|
# configure package |
|
%{l_shtool} subst \ |
|
-e 's;/cgi-bin/;/openpkg-cgi/;' \ |
|
src/cachemgr.c |
|
CC="%{l_cc}" \ |
|
CFLAGS="%{l_cflags -O}" \ |
|
CPPFLAGS="%{l_cppflags}" \ |
|
LDFLAGS="%{l_fsl_ldflags}" \ |
|
LIBS="%{l_fsl_libs}" \ |
|
./configure \ |
|
--prefix=%{l_prefix} \ |
|
--sysconfdir=%{l_prefix}/etc/squid \ |
|
--libexecdir=%{l_prefix}/libexec/squid \ |
|
--localstatedir=%{l_prefix}/var/squid \ |
|
--datadir=%{l_prefix}/share/squid \ |
|
%if "%{with_ssl}" == "yes" |
|
--enable-ssl \ |
|
--with-openssl=%{l_prefix} \ |
|
%endif |
|
%if "%{with_snmp}" == "yes" |
|
--enable-snmp \ |
|
%endif |
|
--enable-default-err-language=English \ |
|
--enable-err-languages=English \ |
|
--enable-storeio="ufs diskd null" \ |
|
--enable-removal-policies="lru heap" \ |
|
--enable-auth="basic digest" \ |
|
--enable-cache-digests \ |
|
--enable-forw-via-db \ |
|
--enable-useragent-log \ |
|
--enable-delay-pools |
|
|
|
# build package |
|
%{l_make} %{l_mflags} |
|
|
|
%install |
|
rm -rf $RPM_BUILD_ROOT |
|
|
|
# pregenerate some (not automatically created) installation directories |
|
%{l_shtool} mkdir -f -p -m 755 \ |
|
$RPM_BUILD_ROOT%{l_prefix}/cgi \ |
|
$RPM_BUILD_ROOT%{l_prefix}/etc/squid \ |
|
$RPM_BUILD_ROOT%{l_prefix}/var/squid/logs \ |
|
$RPM_BUILD_ROOT%{l_prefix}/var/squid/cache |
|
|
|
# install package |
|
%{l_make} %{l_mflags} install AM_MAKEFLAGS="DESTDIR=$RPM_BUILD_ROOT" |
|
|
|
# strip down installation |
|
rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/Run* |
|
rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/RunCache |
|
rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/squid/*.default |
|
rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/squid/*.orig |
|
%if "%{with_snmp}" != "yes" |
|
rm -f $RPM_BUILD_ROOT%{l_prefix}/share/squid/mib.txt |
|
%endif |
|
|
|
# move cache manager CGI to correct location |
|
mv $RPM_BUILD_ROOT%{l_prefix}/libexec/squid/cachemgr.cgi \ |
|
$RPM_BUILD_ROOT%{l_prefix}/cgi/cachemgr.cgi |
|
|
|
# post-adjust default configuration |
|
%{l_shtool} subst \ |
|
-e 's;^# \(cache_mgr\).*;\1 %{l_musr};' \ |
|
-e 's;^# \(cache_effective_user\).*;\1 %{l_rusr};' \ |
|
-e 's;^# \(cache_effective_group\).*;\1 %{l_rgrp};' \ |
|
-e 's;^# \(http_port\).*;\1 127.0.0.1:3128;' \ |
|
$RPM_BUILD_ROOT%{l_prefix}/etc/squid/squid.conf |
|
|
|
# install run-command script |
|
%{l_shtool} mkdir -f -p -m 755 \ |
|
$RPM_BUILD_ROOT%{l_prefix}/etc/rc.d |
|
%{l_shtool} install -c -m 755 %{l_value -s -a} \ |
|
%{SOURCE rc.squid} \ |
|
$RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/ |
|
|
|
# install OSSP fsl configuration |
|
%{l_shtool} mkdir -f -p -m 755 \ |
|
$RPM_BUILD_ROOT%{l_prefix}/etc/fsl |
|
%{l_shtool} install -c -m 644 %{l_value -s -a} \ |
|
%{SOURCE fsl.squid} \ |
|
$RPM_BUILD_ROOT%{l_prefix}/etc/fsl/ |
|
|
|
# strip executables |
|
strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true |
|
strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* >/dev/null 2>&1 || true |
|
|
|
# determine installation files |
|
%{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \ |
|
%{l_files_std} \ |
|
'%config %{l_prefix}/etc/squid/squid.conf' \ |
|
'%not %dir %{l_prefix}/etc/fsl' \ |
|
'%config %{l_prefix}/etc/fsl/fsl.squid' \ |
|
'%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/squid/*' |
|
|
|
%files -f files |
|
|
|
%clean |
|
rm -rf $RPM_BUILD_ROOT |
|
|
|
%post |
|
if [ $1 -eq 1 ]; then |
|
# initialize cache directory structure |
|
$RPM_INSTALL_PREFIX/sbin/squid -z >/dev/null 2>&1 |
|
fi |
|
|
|
# after upgrade, restart service |
|
[ $1 -eq 2 ] || exit 0 |
|
eval `%{l_rc} squid status 2>/dev/null` |
|
[ ".$squid_active" = .yes ] && %{l_rc} squid restart |
|
exit 0 |
|
|
|
%preun |
|
# before erase, stop service and remove log files |
|
[ $1 -eq 0 ] || exit 0 |
|
%{l_rc} squid stop 2>/dev/null |
|
rm -rf $RPM_INSTALL_PREFIX/var/squid/cache/[0-9ABCDEF][0-9ABCDEF] >/dev/null 2>&1 || true |
|
rm -rf $RPM_INSTALL_PREFIX/var/squid/logs/* >/dev/null 2>&1 || true |
|
exit 0 |
|
|
|
|