squid31.spec 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  1. ##
  2. ## squid31.spec -- OpenPKG RPM Package Specification
  3. ## Copyright (c) 2000-2009 OpenPKG Foundation e.V. <http://openpkg.net/>
  4. ##
  5. ## Permission to use, copy, modify, and distribute this software for
  6. ## any purpose with or without fee is hereby granted, provided that
  7. ## the above copyright notice and this permission notice appear in all
  8. ## copies.
  9. ##
  10. ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  11. ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  12. ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  13. ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
  14. ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  15. ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  16. ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  17. ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  18. ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  19. ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  20. ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  21. ## SUCH DAMAGE.
  22. ##
  23. # FIXME: rse: with_ecap=yes still does not build
  24. # package version
  25. %define V_maj 3
  26. %define V_min 1
  27. %define V_rev 0.8
  28. # package information
  29. Name: squid31
  30. Summary: World Wide Web Proxy Server
  31. URL: http://www.squid-cache.org/
  32. Vendor: The Squid Project
  33. Packager: OpenPKG Foundation e.V.
  34. Distribution: OpenPKG Community
  35. Class: BASE
  36. Group: Web
  37. License: GPL
  38. Version: %{V_maj}.%{V_min}.%{V_rev}
  39. Release: 20090524
  40. # package options
  41. %option with_fsl yes
  42. %option with_ssl no
  43. %option with_snmp no
  44. %option with_ntlm no
  45. %option with_largefile no
  46. %option with_icap no
  47. %option with_ecap no
  48. %option with_esi no
  49. # list of sources
  50. Source0: http://www.squid-cache.org/Versions/v%{V_maj}/%{V_maj}.%{V_min}/squid-%{V_maj}.%{V_min}.%{V_rev}.tar.gz
  51. Source1: rc.squid
  52. Source2: fsl.squid
  53. Patch0: squid31.patch
  54. # build information
  55. Prefix: %{l_prefix}
  56. BuildRoot: %{l_buildroot}
  57. BuildPreReq: OpenPKG, openpkg >= 20060823, gcc, gcc::with_cxx = yes, perl
  58. PreReq: OpenPKG, openpkg >= 20060823
  59. %if "%{with_fsl}" == "yes"
  60. BuildPreReq: fsl
  61. PreReq: fsl
  62. %endif
  63. %if "%{with_ssl}" == "yes"
  64. BuildPreReq: openssl
  65. PreReq: openssl
  66. %endif
  67. %if "%{with_ntlm}" == "yes"
  68. PreReq: samba
  69. %endif
  70. %if "%{with_ecap}" == "yes"
  71. PreReq: libecap
  72. BuildPreReq: libecap
  73. %endif
  74. AutoReq: no
  75. AutoReqProv: no
  76. Provides: squid = %{version}
  77. %description
  78. Squid is a full-featured Web proxy which supports proxying and
  79. caching of HTTP, FTP, and other URL's; proxying for SSL cache
  80. hierarchies; supporting ICP, HTCP, and CARP; supports Cache Digests
  81. transparent caching, etc.
  82. %track
  83. prog squid31 = {
  84. version = %{V_maj}.%{V_min}.%{V_rev}
  85. url = http://www.squid-cache.org/Versions/v%{V_maj}/%{V_maj}.%{V_min}/
  86. regex = squid-(%{V_maj}\.\d+(?:\.\d+)+)\.tar\.gz
  87. }
  88. %prep
  89. %setup -q -n squid-%{V_maj}.%{V_min}.%{V_rev}
  90. %patch -p0
  91. %if "%{with_ntlm}" == "yes"
  92. %{l_shtool} subst \
  93. -e 's;/usr/bin/perl;%{l_prefix}/bin/perl;' \
  94. -e 's;wbinfo;%{l_prefix}/bin/wbinfo;' \
  95. helpers/external_acl/wbinfo_group/wbinfo_group.pl
  96. %endif
  97. find . -name "*.orig" -print | xargs rm -f
  98. %build
  99. # configure package
  100. %{l_shtool} subst \
  101. -e 's;/cgi-bin/;/openpkg-cgi/;' \
  102. tools/cachemgr.cc
  103. CC="%{l_cc}" \
  104. CFLAGS="%{l_cflags -O}" \
  105. CPPFLAGS="%{l_cppflags}" \
  106. LDFLAGS="%{l_fsl_ldflags}" \
  107. LIBS="%{l_fsl_libs}" \
  108. ./configure \
  109. --prefix=%{l_prefix} \
  110. --sysconfdir=%{l_prefix}/etc/squid \
  111. --libexecdir=%{l_prefix}/libexec/squid \
  112. --mandir=%{l_prefix}/man \
  113. --localstatedir=%{l_prefix}/var/squid \
  114. --datadir=%{l_prefix}/share/squid \
  115. %if "%{with_ssl}" == "yes"
  116. --enable-ssl \
  117. --with-openssl=%{l_prefix} \
  118. %endif
  119. %if "%{with_snmp}" == "yes"
  120. --enable-snmp \
  121. %endif
  122. %if "%{with_ntlm}" == "yes"
  123. --enable-auth="ntlm basic digest" \
  124. --enable-external-acl-helpers="wbinfo_group" \
  125. %else
  126. --enable-auth="basic digest" \
  127. %endif
  128. %if "%{with_largefile}" == "yes"
  129. --with-large-files \
  130. %endif
  131. %if "%{with_icap}" == "yes"
  132. --enable-icap-client \
  133. %endif
  134. %if "%{with_ecap}" == "yes"
  135. --enable-ecap \
  136. %endif
  137. %if "%{with_esi}" == "yes"
  138. --enable-esi \
  139. %endif
  140. --enable-basic-auth-helpers="NCSA" \
  141. --enable-digest-auth-helpers="password" \
  142. --enable-default-err-language=English \
  143. --enable-err-languages=English \
  144. --enable-storeio="ufs diskd" \
  145. --enable-removal-policies="lru heap" \
  146. --enable-cache-digests \
  147. --enable-forw-via-db \
  148. --enable-useragent-log \
  149. --enable-delay-pools \
  150. --enable-x-accelerator-vary \
  151. --enable-http-violations
  152. # build package
  153. %{l_make} %{l_mflags}
  154. %install
  155. rm -rf $RPM_BUILD_ROOT
  156. # pregenerate some (not automatically created) installation directories
  157. %{l_shtool} mkdir -f -p -m 755 \
  158. $RPM_BUILD_ROOT%{l_prefix}/cgi \
  159. $RPM_BUILD_ROOT%{l_prefix}/etc/squid \
  160. $RPM_BUILD_ROOT%{l_prefix}/var/squid/logs \
  161. $RPM_BUILD_ROOT%{l_prefix}/var/squid/cache
  162. # install package
  163. %{l_make} %{l_mflags} install AM_MAKEFLAGS="DESTDIR=$RPM_BUILD_ROOT"
  164. # strip down installation
  165. rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/Run*
  166. rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/RunCache
  167. rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/squid/*.default
  168. %if "%{with_snmp}" != "yes"
  169. rm -f $RPM_BUILD_ROOT%{l_prefix}/share/squid/mib.txt
  170. %endif
  171. # move cache manager CGI to correct location
  172. mv $RPM_BUILD_ROOT%{l_prefix}/libexec/squid/cachemgr.cgi \
  173. $RPM_BUILD_ROOT%{l_prefix}/cgi/cachemgr.cgi
  174. # post-adjust default configuration
  175. %{l_shtool} subst \
  176. -e 's;^# \(cache_mgr\).*;\1 %{l_musr};' \
  177. -e 's;^# \(cache_effective_user\).*;\1 %{l_rusr};' \
  178. -e 's;^# \(cache_effective_group\).*;\1 %{l_rgrp};' \
  179. -e 's;^# \(http_port\).*;\1 127.0.0.1:3128;' \
  180. $RPM_BUILD_ROOT%{l_prefix}/etc/squid/squid.conf
  181. # install run-command script
  182. %{l_shtool} mkdir -f -p -m 755 \
  183. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
  184. %{l_shtool} install -c -m 755 %{l_value -s -a} \
  185. %{SOURCE rc.squid} \
  186. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  187. # install OSSP fsl configuration
  188. %{l_shtool} mkdir -f -p -m 755 \
  189. $RPM_BUILD_ROOT%{l_prefix}/etc/fsl
  190. %{l_shtool} install -c -m 644 %{l_value -s -a} \
  191. %{SOURCE fsl.squid} \
  192. $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/
  193. # strip executables
  194. strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
  195. strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* >/dev/null 2>&1 || true
  196. strip $RPM_BUILD_ROOT%{l_prefix}/libexec/squid/* >/dev/null 2>&1 || true
  197. # determine installation files
  198. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  199. %{l_files_std} \
  200. '%config %{l_prefix}/etc/squid/squid.conf' \
  201. '%config %{l_prefix}/etc/fsl/fsl.squid' \
  202. '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/squid/*'
  203. %files -f files
  204. %clean
  205. rm -rf $RPM_BUILD_ROOT
  206. %post
  207. if [ $1 -eq 1 ]; then
  208. # initialize cache directory structure
  209. $RPM_INSTALL_PREFIX/sbin/squid -z >/dev/null 2>&1
  210. fi
  211. # after upgrade, restart service
  212. [ $1 -eq 2 ] || exit 0
  213. eval `%{l_rc} squid status 2>/dev/null`
  214. [ ".$squid_active" = .yes ] && %{l_rc} squid restart
  215. exit 0
  216. %preun
  217. # before erase, stop service and remove log files
  218. [ $1 -eq 0 ] || exit 0
  219. %{l_rc} squid stop 2>/dev/null
  220. rm -rf $RPM_INSTALL_PREFIX/var/squid/cache/[0-9ABCDEF][0-9ABCDEF] >/dev/null 2>&1 || true
  221. rm -rf $RPM_INSTALL_PREFIX/var/squid/logs/* >/dev/null 2>&1 || true
  222. exit 0