apache.spec 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323
  1. ##
  2. ## apache.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: apache
  26. Summary: Apache HTTP Server
  27. URL: http://httpd.apache.org/
  28. Vendor: Apache Software Foundation
  29. Packager: OpenPKG Foundation e.V.
  30. Distribution: OpenPKG Community
  31. Class: BASE
  32. Group: Web
  33. License: ASF
  34. Version: 2.2.4
  35. Release: 20070723
  36. # package options
  37. %option with_mpm_prefork yes
  38. %option with_mpm_worker no
  39. %option with_mpm_event no
  40. %option with_suexec yes
  41. %option with_suexec_caller %{l_nusr}
  42. %option with_suexec_userdir public_html
  43. %option with_mod_deflate no
  44. %option with_mod_ssl no
  45. %option with_mod_dav no
  46. %option with_mod_ldap no
  47. %option with_mod_proxy no
  48. %option with_mod_cache no
  49. %option with_mod_diskcache no
  50. %option with_mod_memcache no
  51. %option with_mod_filecache no
  52. # fixing implicit inter-module dependencies and correlations
  53. %if "%{with_mpm_prefork}" == "yes"
  54. %undefine with_mpm_worker
  55. %undefine with_mpm_event
  56. %endif
  57. %if "%{with_mpm_worker}" == "yes"
  58. %undefine with_mpm_prefork
  59. %undefine with_mpm_event
  60. %endif
  61. %if "%{with_mpm_event}" == "yes"
  62. %undefine with_mpm_prefork
  63. %undefine with_mpm_worker
  64. %endif
  65. %if "%{with_mod_memcache}" == "yes" || "%{with_mod_diskcache}" == "yes"
  66. %undefine with_mod_cache
  67. %define with_mod_cache yes
  68. %endif
  69. # list of sources
  70. Source0: http://www.apache.org/dist/httpd/httpd-%{version}.tar.gz
  71. Source1: rc.apache
  72. Source2: apache.base
  73. Source3: apache.conf
  74. Source4: apache.sh
  75. Patch0: apache.patch
  76. # build information
  77. Prefix: %{l_prefix}
  78. BuildRoot: %{l_buildroot}
  79. BuildPreReq: OpenPKG, openpkg >= 20060823, perl, make
  80. PreReq: OpenPKG, openpkg >= 20060823, perl
  81. BuildPreReq: apr, pcre
  82. PreReq: apr, pcre
  83. %if "%{with_mpm_worker}" == "yes" || "%{with_mpm_event}" == "yes" || "%{with_mod_memcache}" == "yes"
  84. BuildPreReq: apr::with_threads = yes
  85. PreReq: apr::with_threads = yes
  86. %endif
  87. %if "%{with_mod_ldap}" == "yes"
  88. BuildPreReq: apr::with_ldap = yes
  89. PreReq: apr::with_ldap = yes
  90. %endif
  91. %if "%{with_mod_ssl}" == "yes"
  92. BuildPreReq: openssl >= 0.9.8
  93. PreReq: openssl >= 0.9.8
  94. %endif
  95. %if "%{with_mod_deflate}" == "yes"
  96. BuildPreReq: zlib
  97. PreReq: zlib
  98. %endif
  99. AutoReq: no
  100. AutoReqProv: no
  101. Conflicts: apache13
  102. %description
  103. The Apache Project is a collaborative software development effort
  104. aimed at creating a robust, commercial-grade, featureful, and
  105. freely-available source code implementation of an HTTP (Web) server.
  106. The project is jointly managed by a group of volunteers located
  107. around the world, using the Internet and the Web to communicate,
  108. plan, and develop the server and its related documentation. These
  109. volunteers are known as the Apache Group. In addition, hundreds
  110. of users have contributed ideas, code, and documentation to the
  111. project.
  112. %track
  113. prog apache = {
  114. version = %{version}
  115. url = http://www.apache.org/dist/httpd/
  116. regex = httpd-(2\.\d*[02468]\.\d+)\.tar\.gz
  117. }
  118. %prep
  119. # unpack Apache distribution
  120. %setup -q -n httpd-%{version}
  121. %patch -p0
  122. %{l_shtool} subst \
  123. -e 's;(" PLATFORM ");(%{l_openpkg_release -F "OpenPKG/%%t"});g' \
  124. server/core.c
  125. %build
  126. # configure package
  127. ( echo "ac_cv_func_uuid_create=no"
  128. ) >config.cache
  129. export CC="%{l_cc}"
  130. export CFLAGS="%{l_cflags -O}"
  131. export CPPFLAGS="%{l_cppflags}"
  132. export LDFLAGS="%{l_ldflags}"
  133. export LIBS=""
  134. case "%{l_platform -t}" in
  135. *-sunos* ) LIBS="$LIBS -lrt" ;;
  136. esac
  137. %if "%{with_mod_ldap}" == "yes"
  138. LIBS="$LIBS -lssl -lcrypto"
  139. %endif
  140. ./configure \
  141. --cache-file=./config.cache \
  142. --enable-layout=GNU \
  143. --prefix=%{l_prefix} \
  144. --with-program-name=apache \
  145. --sysconfdir=%{l_prefix}/etc/apache \
  146. --libexecdir=%{l_prefix}/libexec/apache \
  147. --includedir=%{l_prefix}/include/apache \
  148. --datadir=%{l_prefix}/share/apache \
  149. --localstatedir=%{l_prefix}/var/apache \
  150. --with-apr=%{l_prefix}/bin/apr-1-config \
  151. --with-apr-util=%{l_prefix}/bin/apu-1-config \
  152. --with-pcre=%{l_prefix} \
  153. %if "%{with_mpm_prefork}" == "yes"
  154. --with-mpm="prefork" \
  155. %endif
  156. %if "%{with_mpm_worker}" == "yes"
  157. --with-mpm="worker" \
  158. %endif
  159. %if "%{with_mpm_event}" == "yes"
  160. --with-mpm="event" \
  161. %endif
  162. %if "%{with_mpm_worker}" == "yes" || "%{with_mpm_event}" == "yes" || "%{with_mod_memcache}" == "yes"
  163. --enable-threads \
  164. %else
  165. --disable-threads \
  166. %endif
  167. %if "%{with_suexec}" == "yes"
  168. --enable-suexec \
  169. --with-suexec-bin=%{l_prefix}/sbin/suexec \
  170. --with-suexec-caller=%{with_suexec_caller} \
  171. --with-suexec-userdir=%{with_suexec_userdir} \
  172. --with-suexec-logfile=%{l_prefix}/var/apache/log/suexec.log \
  173. %endif
  174. %if "%{with_mod_deflate}" == "yes"
  175. --enable-deflate \
  176. --with-z=%{l_prefix} \
  177. %endif
  178. %if "%{with_mod_ssl}" == "yes"
  179. --enable-ssl \
  180. --with-ssl=%{l_prefix} \
  181. %endif
  182. %if "%{with_mod_dav}" == "yes"
  183. --enable-dav \
  184. --enable-dav-fs \
  185. %endif
  186. %if "%{with_mod_ldap}" == "yes"
  187. --enable-ldap \
  188. --enable-authnz-ldap \
  189. %endif
  190. %if "%{with_mod_proxy}" == "yes"
  191. --enable-proxy \
  192. --enable-proxy-connect \
  193. --enable-proxy-http \
  194. --enable-proxy-ftp \
  195. %endif
  196. %if "%{with_mod_cache}" == "yes"
  197. --enable-cache \
  198. %if "%{with_mod_diskcache}" == "yes"
  199. --enable-disk-cache \
  200. %endif
  201. %if "%{with_mod_memcache}" == "yes"
  202. --enable-mem-cache \
  203. %endif
  204. %endif
  205. %if "%{with_mod_filecache}" == "yes"
  206. --enable-file-cache \
  207. %endif
  208. --enable-expires \
  209. --enable-so \
  210. --enable-speling \
  211. --enable-rewrite \
  212. --enable-headers \
  213. --enable-info \
  214. --enable-mime-magic \
  215. --enable-vhost-alias \
  216. --enable-auth-digest \
  217. --enable-auth-dbm \
  218. --enable-authz-dbm \
  219. --enable-authz-owner \
  220. --enable-unique-id \
  221. --disable-shared
  222. # build package
  223. %{l_make} %{l_mflags}
  224. %install
  225. # install package
  226. rm -rf $RPM_BUILD_ROOT
  227. %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT
  228. # create additional directories
  229. %{l_shtool} mkdir -f -p -m 755 \
  230. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \
  231. $RPM_BUILD_ROOT%{l_prefix}/etc/apache/apache.d \
  232. $RPM_BUILD_ROOT%{l_prefix}/var/apache/run/apache.dav
  233. # adjust GNU libtool configuration for apxs(1) runtime
  234. %{l_shtool} install -c -m 755 \
  235. -e 's;^build_libtool_libs=no;build_libtool_libs=yes;' \
  236. %{l_prefix}/share/apr/build-1/libtool \
  237. $RPM_BUILD_ROOT%{l_prefix}/share/apache/build/libtool
  238. # install shell environment script
  239. %{l_shtool} install -c -m 644 %{l_value -s -a} \
  240. -e 's;@l_path@;%{l_build_path};' \
  241. -e 's;@l_ld_library_path@;%{l_build_ldlp};' \
  242. %{SOURCE apache.sh} \
  243. $RPM_BUILD_ROOT%{l_prefix}/etc/apache/
  244. # create default configuration
  245. l_hostname=`%{l_shtool} echo -e %h`
  246. l_domainname=`%{l_shtool} echo -e %d | cut -c2-`
  247. %{l_shtool} install -c -m 644 %{l_value -s -a} \
  248. -e "s;@l_hostname@;$l_hostname;g" \
  249. -e "s;@l_domainname@;$l_domainname;g" \
  250. %{SOURCE apache.base} \
  251. %{SOURCE apache.conf} \
  252. $RPM_BUILD_ROOT%{l_prefix}/etc/apache/
  253. mv $RPM_BUILD_ROOT%{l_prefix}/etc/apache/magic \
  254. $RPM_BUILD_ROOT%{l_prefix}/etc/apache/mime.magic
  255. # install run-command script
  256. %{l_shtool} install -c -m 755 %{l_value -s -a} \
  257. %{SOURCE rc.apache} \
  258. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  259. # strip down installation
  260. find $RPM_BUILD_ROOT%{l_prefix}/share/apache -name "*.orig" -print | xargs rm -f
  261. rm -f $RPM_BUILD_ROOT%{l_prefix}/share/apache/htdocs/apache_pb*
  262. rm -rf $RPM_BUILD_ROOT%{l_prefix}/etc/apache/{extra,original}
  263. rm -rf $RPM_BUILD_ROOT%{l_prefix}/libexec/apache
  264. rm -f $RPM_BUILD_ROOT%{l_prefix}/cgi/test-cgi
  265. strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
  266. strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* >/dev/null 2>&1 || true
  267. ( cd $RPM_BUILD_ROOT%{l_prefix}/share/apache/manual
  268. find . -name "*.xml" -print | xargs rm -f
  269. find . -name "*.xml.*" -print | xargs rm -f
  270. find . -name "*.xsl" -print | xargs rm -f
  271. rm -rf style/xsl
  272. rm -rf style/latex
  273. ) || exit $?
  274. # determine installation files
  275. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  276. %{l_files_std} \
  277. %if "%{with_suexec}" == "yes"
  278. '%attr(4755,%{l_susr},%{l_mgrp}) %{l_prefix}/sbin/suexec' \
  279. %endif
  280. '%config %{l_prefix}/etc/apache/*' \
  281. '%config %attr(444,%{l_musr},%{l_mgrp}) %{l_prefix}/etc/apache/apache.base' \
  282. '%dir %attr(750,%{l_nusr},%{l_ngrp}) %{l_prefix}/var/apache/run/apache.dav'
  283. %files -f files
  284. %clean
  285. rm -rf $RPM_BUILD_ROOT
  286. %post
  287. # after upgrade, restart service
  288. [ $1 -eq 2 ] || exit 0
  289. eval `%{l_rc} apache status 2>/dev/null`
  290. [ ".$apache_active" = .yes ] && %{l_rc} apache restart
  291. exit 0
  292. %preun
  293. # before erase, stop service and remove log files
  294. [ $1 -eq 0 ] || exit 0
  295. %{l_rc} apache stop 2>/dev/null
  296. rm -f $RPM_INSTALL_PREFIX/var/apache/log/* >/dev/null 2>&1 || true
  297. rm -f $RPM_INSTALL_PREFIX/var/apache/run/*/* >/dev/null 2>&1 || true
  298. rm -f $RPM_INSTALL_PREFIX/var/apache/run/* >/dev/null 2>&1 || true
  299. exit 0