## ## squid.spec -- OpenPKG RPM Package Specification ## Copyright (c) 2000-2009 OpenPKG Foundation e.V. ## ## 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 3 %define V_min 0 %define V_rev 16 # package information Name: squid Summary: World Wide Web Proxy Server URL: http://www.squid-cache.org/ Vendor: The Squid Project Packager: OpenPKG Foundation e.V. Distribution: OpenPKG Community Class: BASE Group: Web License: GPL Version: %{V_maj}.%{V_min}.%{V_rev} Release: 20090615 # package options %option with_fsl yes %option with_ssl no %option with_snmp no %option with_ntlm no %option with_largefile no %option with_icap no %option with_esi 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 >= 20060823, gcc, gcc::with_cxx = yes, perl PreReq: OpenPKG, openpkg >= 20060823 %if "%{with_fsl}" == "yes" BuildPreReq: fsl PreReq: fsl %endif %if "%{with_ssl}" == "yes" BuildPreReq: openssl PreReq: openssl %endif %if "%{with_ntlm}" == "yes" PreReq: samba %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. %track prog squid = { version = %{V_maj}.%{V_min}.STABLE%{V_rev} url = http://www.squid-cache.org/Versions/v%{V_maj}/%{V_maj}.%{V_min}/ regex = squid-(%{V_maj}\.\d+\.STABLE\d+)\.tar\.gz } %prep %setup -q -n squid-%{V_maj}.%{V_min}.STABLE%{V_rev} %if "%{with_ntlm}" == "yes" %{l_shtool} subst \ -e 's;/usr/bin/perl;%{l_prefix}/bin/perl;' \ -e 's;wbinfo;%{l_prefix}/bin/wbinfo;' \ helpers/external_acl/wbinfo_group/wbinfo_group.pl %endif find . -name "*.orig" -print | xargs rm -f %build # configure package %{l_shtool} subst \ -e 's;/cgi-bin/;/openpkg-cgi/;' \ tools/cachemgr.cc 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 \ --mandir=%{l_prefix}/man \ --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 %if "%{with_ntlm}" == "yes" --enable-auth="ntlm basic digest" \ --enable-external-acl-helpers="wbinfo_group" \ %else --enable-auth="basic digest" \ %endif %if "%{with_largefile}" == "yes" --with-large-files \ %endif %if "%{with_icap}" == "yes" --enable-icap-client \ %endif %if "%{with_esi}" == "yes" --enable-esi \ %endif --enable-basic-auth-helpers="NCSA" \ --enable-digest-auth-helpers="password" \ --enable-default-err-language=English \ --enable-err-languages=English \ --enable-storeio="ufs diskd null" \ --enable-removal-policies="lru heap" \ --enable-cache-digests \ --enable-forw-via-db \ --enable-useragent-log \ --enable-delay-pools \ --enable-x-accelerator-vary \ --enable-http-violations # 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 %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 strip $RPM_BUILD_ROOT%{l_prefix}/libexec/squid/* >/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' \ '%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