squid.spec 7.1 KB

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