squid.spec 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  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: 20040301
  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. # build information
  50. Prefix: %{l_prefix}
  51. BuildRoot: %{l_buildroot}
  52. BuildPreReq: OpenPKG, openpkg >= 20040130, gcc, perl
  53. PreReq: OpenPKG, openpkg >= 20040130
  54. %if "%{with_fsl}" == "yes"
  55. BuildPreReq: fsl >= 1.3.0
  56. PreReq: fsl >= 1.3.0
  57. %endif
  58. %if "%{with_ssl}" == "yes"
  59. BuildPreReq: openssl
  60. PreReq: openssl
  61. %endif
  62. AutoReq: no
  63. AutoReqProv: no
  64. %description
  65. Squid is a full-featured Web proxy which supports proxying and
  66. caching of HTTP, FTP, and other URL's; proxying for SSL cache
  67. hierarchies; supporting ICP, HTCP, and CARP; supports Cache Digests
  68. transparent caching, etc.
  69. %track
  70. prog squid = {
  71. version = %{V_maj}.%{V_min}.STABLE%{V_rev}
  72. url = http://www.squid-cache.org/Versions/v2/2.5/
  73. regex = squid-(2\.\d+\.STABLE\d+)\.tar\.gz
  74. }
  75. %prep
  76. %setup -q -n squid-%{V_maj}.%{V_min}.STABLE%{V_rev}
  77. %build
  78. # configure package
  79. %{l_shtool} subst \
  80. -e 's;/cgi-bin/;/openpkg-cgi/;' \
  81. src/cachemgr.c
  82. CC="%{l_cc}" \
  83. CFLAGS="%{l_cflags -O}" \
  84. CPPFLAGS="%{l_cppflags}" \
  85. LDFLAGS="%{l_fsl_ldflags}" \
  86. LIBS="%{l_fsl_libs}" \
  87. ./configure \
  88. --prefix=%{l_prefix} \
  89. --sysconfdir=%{l_prefix}/etc/squid \
  90. --libexecdir=%{l_prefix}/libexec/squid \
  91. --localstatedir=%{l_prefix}/var/squid \
  92. --datadir=%{l_prefix}/share/squid \
  93. %if "%{with_ssl}" == "yes"
  94. --enable-ssl \
  95. --with-openssl=%{l_prefix} \
  96. %endif
  97. %if "%{with_snmp}" == "yes"
  98. --enable-snmp \
  99. %endif
  100. --enable-default-err-language=English \
  101. --enable-err-languages=English \
  102. --enable-storeio="ufs diskd null" \
  103. --enable-removal-policies="lru heap" \
  104. --enable-auth="basic digest" \
  105. --enable-cache-digests \
  106. --enable-forw-via-db \
  107. --enable-useragent-log \
  108. --enable-delay-pools
  109. # build package
  110. %{l_make} %{l_mflags}
  111. %install
  112. rm -rf $RPM_BUILD_ROOT
  113. # pregenerate some (not automatically created) installation directories
  114. %{l_shtool} mkdir -f -p -m 755 \
  115. $RPM_BUILD_ROOT%{l_prefix}/cgi \
  116. $RPM_BUILD_ROOT%{l_prefix}/etc/squid \
  117. $RPM_BUILD_ROOT%{l_prefix}/var/squid/logs \
  118. $RPM_BUILD_ROOT%{l_prefix}/var/squid/cache
  119. # install package
  120. %{l_make} %{l_mflags} install AM_MAKEFLAGS="DESTDIR=$RPM_BUILD_ROOT"
  121. # strip down installation
  122. rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/Run*
  123. rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/RunCache
  124. rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/squid/*.default
  125. rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/squid/*.orig
  126. %if "%{with_snmp}" != "yes"
  127. rm -f $RPM_BUILD_ROOT%{l_prefix}/share/squid/mib.txt
  128. %endif
  129. # move cache manager CGI to correct location
  130. mv $RPM_BUILD_ROOT%{l_prefix}/libexec/squid/cachemgr.cgi \
  131. $RPM_BUILD_ROOT%{l_prefix}/cgi/cachemgr.cgi
  132. # post-adjust default configuration
  133. %{l_shtool} subst \
  134. -e 's;^# \(cache_mgr\).*;\1 %{l_musr};' \
  135. -e 's;^# \(cache_effective_user\).*;\1 %{l_rusr};' \
  136. -e 's;^# \(cache_effective_group\).*;\1 %{l_rgrp};' \
  137. -e 's;^# \(http_port\).*;\1 127.0.0.1:3128;' \
  138. $RPM_BUILD_ROOT%{l_prefix}/etc/squid/squid.conf
  139. # install run-command script
  140. %{l_shtool} mkdir -f -p -m 755 \
  141. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
  142. %{l_shtool} install -c -m 755 %{l_value -s -a} \
  143. %{SOURCE rc.squid} \
  144. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  145. # install OSSP fsl configuration
  146. %{l_shtool} mkdir -f -p -m 755 \
  147. $RPM_BUILD_ROOT%{l_prefix}/etc/fsl
  148. %{l_shtool} install -c -m 644 %{l_value -s -a} \
  149. %{SOURCE fsl.squid} \
  150. $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/
  151. # strip executables
  152. strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
  153. strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* >/dev/null 2>&1 || true
  154. # determine installation files
  155. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  156. %{l_files_std} \
  157. '%config %{l_prefix}/etc/squid/squid.conf' \
  158. '%not %dir %{l_prefix}/etc/fsl' \
  159. '%config %{l_prefix}/etc/fsl/fsl.squid' \
  160. '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/squid/*'
  161. %files -f files
  162. %clean
  163. rm -rf $RPM_BUILD_ROOT
  164. %post
  165. if [ $1 -eq 1 ]; then
  166. # initialize cache directory structure
  167. $RPM_INSTALL_PREFIX/sbin/squid -z >/dev/null 2>&1
  168. fi
  169. # after upgrade, restart service
  170. [ $1 -eq 2 ] || exit 0
  171. eval `%{l_rc} squid status 2>/dev/null`
  172. [ ".$squid_active" = .yes ] && %{l_rc} squid restart
  173. exit 0
  174. %preun
  175. # before erase, stop service and remove log files
  176. [ $1 -eq 0 ] || exit 0
  177. %{l_rc} squid stop 2>/dev/null
  178. rm -rf $RPM_INSTALL_PREFIX/var/squid/cache/[0-9ABCDEF][0-9ABCDEF] >/dev/null 2>&1 || true
  179. rm -rf $RPM_INSTALL_PREFIX/var/squid/logs/* >/dev/null 2>&1 || true
  180. exit 0