lighttpd.spec 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  1. ##
  2. ## lighttpd.spec -- OpenPKG RPM Package Specification
  3. ## Copyright (c) 2000-2007 OpenPKG Foundation e.V. <http://openpkg.net/>
  4. ## Copyright (c) 2000-2007 Ralf S. Engelschall <http://engelschall.com/>
  5. ##
  6. ## Permission to use, copy, modify, and distribute this software for
  7. ## any purpose with or without fee is hereby granted, provided that
  8. ## the above copyright notice and this permission notice appear in all
  9. ## copies.
  10. ##
  11. ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  12. ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  13. ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  14. ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
  15. ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  16. ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  17. ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  18. ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  19. ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  20. ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  21. ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  22. ## SUCH DAMAGE.
  23. ##
  24. # package information
  25. Name: lighttpd
  26. Summary: Flexible High-Performance Web Server
  27. URL: http://www.lighttpd.net/
  28. Vendor: Jan Kneschke
  29. Packager: OpenPKG Foundation e.V.
  30. Distribution: OpenPKG Community
  31. Class: BASE
  32. Group: Web
  33. License: MIT-style
  34. Version: 1.4.13
  35. Release: 20070204
  36. # package options
  37. %option with_fsl yes
  38. %option with_pcre yes
  39. %option with_bzip2 no
  40. %option with_ipv6 no
  41. %option with_mysql no
  42. %option with_ssl no
  43. %option with_lua no
  44. # list of sources
  45. Source0: http://www.lighttpd.net/download/lighttpd-%{version}.tar.gz
  46. Source1: lighttpd.conf
  47. Source2: rc.lighttpd
  48. Source3: fsl.lighttpd
  49. # build information
  50. Prefix: %{l_prefix}
  51. BuildRoot: %{l_buildroot}
  52. BuildPreReq: OpenPKG, openpkg >= 20060823, make, gcc
  53. PreReq: OpenPKG, openpkg >= 20060823
  54. BuildPreReq: zlib
  55. PreReq: zlib
  56. %if "%{with_bzip2}" == "yes"
  57. BuildPreReq: bzip2
  58. PreReq: bzip2
  59. %endif
  60. %if "%{with_fsl}" == "yes"
  61. BuildPreReq: fsl >= 1.5.0
  62. PreReq: fsl >= 1.5.0
  63. %endif
  64. %if "%{with_mysql}" == "yes"
  65. BuildPreReq: mysql, zlib
  66. PreReq: mysql, zlib
  67. %endif
  68. %if "%{with_pcre}" == "yes"
  69. BuildPreReq: pcre
  70. PreReq: pcre
  71. %endif
  72. %if "%{with_ssl}" == "yes"
  73. BuildPreReq: openssl
  74. PreReq: openssl
  75. %endif
  76. %if "%{with_lua}" == "yes"
  77. BuildPreReq: lua
  78. PreReq: lua
  79. %endif
  80. AutoReq: no
  81. AutoReqProv: no
  82. %description
  83. lighttpd is a secure, fast, compliant and very flexible web-server
  84. which has been optimized for high-performance environments. It has
  85. a very low memory footprint compared to other webservers and takes
  86. care of cpu-load. Its advanced feature-set (FastCGI, CGI, Auth,
  87. output compression, URL-rewriting and many more) make lighttpd the
  88. perfect web-server software for every server that is suffering load
  89. problems. As lighttpd is hard to pronounce you might call it lighty
  90. instead.
  91. %track
  92. prog lighttpd = {
  93. version = %{version}
  94. url = http://www.lighttpd.net/download/
  95. regex = lighttpd-(\d+\.\d+\.\d+)\.tar\.gz
  96. }
  97. %prep
  98. %setup -q
  99. %{l_shtool} subst \
  100. -e 's;\(/etc/lighttpd/lighttpd.conf\);%{l_prefix}\1;' \
  101. doc/lighttpd.1
  102. %build
  103. # configure program
  104. CC="%{l_cc}" \
  105. CFLAGS="%{l_cflags -O}" \
  106. CXXFLAGS="%{l_cxxflags -O}" \
  107. LDFLAGS="%{l_ldflags} %{l_fsl_ldflags}" \
  108. LIBS="%{l_fsl_libs}" \
  109. ./configure \
  110. --prefix=%{l_prefix} \
  111. --sysconfdir=%{l_prefix}/etc/lighttpd \
  112. --libdir=%{l_prefix}/lib/lighttpd \
  113. %if "%{with_ipv6}" == "yes"
  114. --enable-ipv6 \
  115. %else
  116. --disable-ipv6 \
  117. %endif
  118. --without-ldap \
  119. %if "%{with_mysql}" == "yes"
  120. --with-mysql=%{l_prefix}/bin/mysql_config \
  121. %else
  122. --without-mysql \
  123. %endif
  124. %if "%{with_pcre}" == "yes"
  125. --with-pcre \
  126. %else
  127. --without-pcre \
  128. %endif
  129. %if "%{with_bzip2}" == "yes"
  130. --with-bzip2 \
  131. %else
  132. --without-bzip2 \
  133. %endif
  134. %if "%{with_lua}" == "yes"
  135. --with-lua \
  136. %else
  137. --without-lua \
  138. %endif
  139. %if "%{with_ssl}" == "yes"
  140. --with-openssl=%{l_prefix}
  141. %else
  142. --without-openssl
  143. %endif
  144. # build program
  145. %{l_make} %{l_mflags -O}
  146. %install
  147. rm -rf $RPM_BUILD_ROOT
  148. # create directories
  149. %{l_shtool} mkdir -f -p -m 755 \
  150. $RPM_BUILD_ROOT%{l_prefix}/etc/lighttpd \
  151. $RPM_BUILD_ROOT%{l_prefix}/var/lighttpd/log
  152. # install lighttpd
  153. %{l_make} %{l_mflags} install AM_MAKEFLAGS="DESTDIR=$RPM_BUILD_ROOT"
  154. # install default configuration
  155. %{l_shtool} install -c -m 640 %{l_value -s -a} \
  156. -e 's;@l_openpkg_release@;%{l_openpkg_release -F "OpenPKG-%%t"};' \
  157. %{SOURCE lighttpd.conf} \
  158. $RPM_BUILD_ROOT%{l_prefix}/etc/lighttpd/
  159. # install run-command script
  160. %{l_shtool} mkdir -f -p -m 755 \
  161. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
  162. %{l_shtool} install -c -m 755 %{l_value -s -a} \
  163. %{SOURCE rc.lighttpd} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  164. # install OSSP fsl configuration
  165. %{l_shtool} mkdir -f -p -m 755 \
  166. $RPM_BUILD_ROOT%{l_prefix}/etc/fsl
  167. %{l_shtool} install -c -m 644 %{l_value -s -a} \
  168. %{SOURCE fsl.lighttpd} \
  169. $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/
  170. # strip installation
  171. strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
  172. strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* >/dev/null 2>&1 || true
  173. # determine installation files
  174. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std} \
  175. '%not %dir %{l_prefix}/etc/fsl' \
  176. '%config %{l_prefix}/etc/fsl/fsl.lighttpd' \
  177. '%config %attr(0600,%{l_susr},%{l_mgrp}) %{l_prefix}/etc/lighttpd/*' \
  178. '%dir %attr(0775,%{l_mgrp},%{l_ngrp}) %{l_prefix}/var/lighttpd/log'
  179. %files -f files
  180. %clean
  181. rm -rf $RPM_BUILD_ROOT
  182. %post
  183. # after upgrade, restart service
  184. [ $1 -eq 2 ] || exit 0
  185. eval `%{l_rc} lighttpd status 2>/dev/null`
  186. [ ".$lighttpd_active" = .yes ] && %{l_rc} lighttpd restart
  187. exit 0
  188. %preun
  189. # before erase, stop service and remove log files
  190. [ $1 -eq 0 ] || exit 0
  191. %{l_rc} lighttpd stop 2>/dev/null
  192. rm -rf $RPM_INSTALL_PREFIX/var/lighttpd/log/* >/dev/null 2>&1 || true
  193. exit 0