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.
 
 
 
 
 
 

273 lines
8.6 KiB

##
## squid.spec -- OpenPKG RPM Package Specification
## Copyright (c) 2000-2025 OpenPKG Project <http://openpkg.org/>
##
## 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 5
%define V_min 10
# package information
Name: squid
Summary: World Wide Web Proxy Server
URL: http://www.squid-cache.org/
Vendor: The Squid Project
Packager: OpenPKG Project
Distribution: OpenPKG Community
Class: BASE
Group: Web
License: GPL
Version: %{V_maj}.%{V_min}
Release: 20250304
# 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_ecap no
%option with_esi no
# list of sources
Source0: http://www.squid-cache.org/Versions/v%{V_maj}/squid-%{V_maj}.%{V_min}.tar.gz
Source1: rc.squid
Source2: fsl.squid
Source3: squid.conf
Source4: squid-passwd.sh
Patch0: squid.patch
# build information
BuildPreReq: OpenPKG, openpkg >= 20160101, gcc, gcc::with_cxx = yes, perl
PreReq: OpenPKG, openpkg >= 20160101, apache-utils
BuildPreReq: openssl, db, db::with_compat = yes
PreReq: openssl, db, db::with_compat = yes
%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
%if "%{with_ecap}" == "yes"
PreReq: libecap
BuildPreReq: libecap
%endif
%if "%{with_esi}" == "yes"
PreReq: libxml
BuildPreReq: libxml
%endif
%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}
url = http://www.squid-cache.org/Versions/v%{V_maj}/
regex = squid-(\d+\.\d+)\.tar\.gz
}
%prep
%setup -q
%patch -p0
%build
# patch sources
find . -name "*.orig" -print | xargs rm -f
%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
# configure package
%{l_shtool} subst \
-e 's;-lldap;-lldap -llber -lssl -lcrypto;g' \
configure
%{l_shtool} subst \
-e 's;/cgi-bin/;/openpkg-cgi/;' \
tools/cachemgr.cc
CC="%{l_cc}" \
CXX="%{l_cxx}" \
CFLAGS="%{l_cflags -O} -pthread" \
CXXFLAGS="%{l_cxxflags -O} -pthread" \
CPPFLAGS="%{l_cppflags}" \
LDFLAGS="%{l_fsl_ldflags} -pthread" \
%if "%{with_ecap}" == "yes"
LIBS="-lecap %{l_fsl_libs}" \
%else
LIBS="%{l_fsl_libs}" \
%endif
./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 \
--with-default-user=%{l_rusr} \
--without-mit-krb5 \
--without-heimdal-krb5 \
--without-gnutls \
%if "%{with_ssl}" == "yes"
--enable-ssl \
--with-openssl=%{l_prefix} \
%else
--without-openssl \
%endif
%if "%{with_snmp}" == "yes"
--enable-snmp \
%endif
--enable-auth \
%if "%{with_ntlm}" != "yes"
--disable-auth-ntlm \
%endif
%if "%{with_largefile}" == "yes"
--with-large-files \
%endif
%if "%{with_icap}" == "yes"
--enable-icap-client \
%endif
%if "%{with_ecap}" == "yes"
--enable-ecap \
%endif
%if "%{with_esi}" == "yes"
--enable-esi \
%endif
--enable-default-err-language=English \
--enable-err-languages=English \
--enable-storeio="ufs diskd" \
--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 \
--disable-strict-error-checking \
--disable-inline \
--disable-stacktraces \
--disable-arch-native
# build package
%{l_make} %{l_mflags -O}
%install
# 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/log \
$RPM_BUILD_ROOT%{l_prefix}/var/squid/run \
$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 -rf $RPM_BUILD_ROOT%{l_prefix}/var/squid/cache/squid
rm -rf $RPM_BUILD_ROOT%{l_prefix}/var/squid/run/squid
rm -rf $RPM_BUILD_ROOT%{l_prefix}/var/squid/logs
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
# install default configuration
%{l_shtool} install -c -m 644 %{l_value -s -a} \
%{SOURCE squid.conf} \
$RPM_BUILD_ROOT%{l_prefix}/etc/squid/
touch $RPM_BUILD_ROOT%{l_prefix}/etc/squid/squid.passwd
# install utility
%{l_shtool} mkdir -f -p -m 755 \
$RPM_BUILD_ROOT%{l_prefix}/sbin
%{l_shtool} install -c -m 755 %{l_value -s -a} \
%{SOURCE squid-passwd.sh} \
$RPM_BUILD_ROOT%{l_prefix}/sbin/squid-passwd
# 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
%post
if [ $1 -eq 1 ]; then
# initialize cache directory structure
$RPM_INSTALL_PREFIX/sbin/squid -z >/dev/null 2>&1
elif [ $1 -eq 2 ]; then
# after upgrade, restart service
eval `%{l_rc} squid status 2>/dev/null`
[ ".$squid_active" = .yes ] && %{l_rc} squid restart
fi
exit 0
%preun
if [ $1 -eq 0 ]; then
# before erase, stop service and remove log files
%{l_rc} squid stop 2>/dev/null
rm -rf $RPM_INSTALL_PREFIX/var/squid/cache/* >/dev/null 2>&1 || true
rm -rf $RPM_INSTALL_PREFIX/var/squid/run/* >/dev/null 2>&1 || true
rm -rf $RPM_INSTALL_PREFIX/var/squid/log/* >/dev/null 2>&1 || true
fi
exit 0