apache2.spec 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334
  1. ##
  2. ## apache2.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: apache2
  26. Summary: Apache HTTP Server (V2)
  27. URL: http://httpd.apache.org/
  28. Vendor: Apache Software Foundation
  29. Packager: OpenPKG Foundation e.V.
  30. Distribution: OpenPKG Community
  31. Class: PLUS
  32. Group: Web
  33. License: ASF
  34. Version: 2.2.4
  35. Release: 20070608
  36. # package options (generic)
  37. %option with_mpm prefork
  38. # package options (suexec related)
  39. %option with_suexec yes
  40. %option with_suexec_caller %{l_nusr}
  41. %option with_suexec_userdir public_html
  42. # package options (additionally used Apache modules)
  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. %option with_mod_expires no
  53. # fixing implicit inter-module dependencies and correlations
  54. %if "%{with_mod_memcache}" == "yes" || "%{with_mod_diskcache}" == "yes"
  55. %undefine with_mod_cache
  56. %define with_mod_cache yes
  57. %endif
  58. # list of sources
  59. Source0: http://www.apache.org/dist/httpd/httpd-%{version}.tar.gz
  60. Source1: rc.apache2
  61. Source2: apache2.base
  62. Source3: apache2.conf
  63. Source4: apache2.sh
  64. Patch0: apache2.patch
  65. # build information
  66. Prefix: %{l_prefix}
  67. BuildRoot: %{l_buildroot}
  68. BuildPreReq: OpenPKG, openpkg >= 20060823, perl, make
  69. PreReq: OpenPKG, openpkg >= 20060823, perl
  70. BuildPreReq: expat, libiconv, db
  71. PreReq: expat, libiconv, db
  72. %if "%{with_mod_deflate}" == "yes"
  73. BuildPreReq: zlib
  74. PreReq: zlib
  75. %endif
  76. %if "%{with_mod_ssl}" == "yes"
  77. BuildPreReq: openssl >= 0.9.8
  78. PreReq: openssl >= 0.9.8
  79. %endif
  80. %if "%{with_mod_ldap}" == "yes"
  81. BuildPreReq: openldap, openssl >= 0.9.8
  82. PreReq: openldap, openssl >= 0.9.8
  83. %endif
  84. AutoReq: no
  85. AutoReqProv: no
  86. Conflicts: apache
  87. %description
  88. The Apache Project is a collaborative software development effort
  89. aimed at creating a robust, commercial-grade, featureful, and
  90. freely-available source code implementation of an HTTP (Web) server.
  91. The project is jointly managed by a group of volunteers located
  92. around the world, using the Internet and the Web to communicate,
  93. plan, and develop the server and its related documentation. These
  94. volunteers are known as the Apache Group. In addition, hundreds
  95. of users have contributed ideas, code, and documentation to the
  96. project.
  97. NOTICE: This is Apache 2.2, which is the sucessor of Apache 2.0, a
  98. complete work-off of the old Apache 1.3 code-base, now based on the
  99. Apache Portable Runtime (APR). It is mostly configuration compatible
  100. to Apache 1.3, but the C API is completely incompatible.
  101. %track
  102. prog apache2 = {
  103. version = %{version}
  104. url = http://www.apache.org/dist/httpd/
  105. regex = httpd-(2.[02468]\.\d+)\.tar\.gz
  106. }
  107. %prep
  108. # some pre-flight checks on options specified
  109. %if "%{with_mpm}" != "prefork" && "%{with_mpm}" != "worker" && "%{with_mpm}" != "event"
  110. ( echo "Invalid value specified for option 'with_mpm'. Currently the"
  111. echo "only supported Multi-Processing Modules (MPMs) are ..."
  112. echo "- 'prefork' -- non-threaded, pre-forking web server (default)"
  113. echo "- 'worker' -- hybrid multi-threaded multi-process web server"
  114. echo "- 'event' -- event-based I/O multiplexing web server"
  115. ) | %{l_rpmtool} msg -b -t error
  116. exit 1
  117. %endif
  118. # unpack Apache distribution
  119. %setup -q -c
  120. %patch -p0 -d httpd-%{version}
  121. %{l_shtool} subst \
  122. -e 's;(" PLATFORM ");(%{l_openpkg_release -F "OpenPKG/%%t"});g' \
  123. httpd-%{version}/server/core.c
  124. %build
  125. # configure package
  126. ( cd httpd-%{version}
  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_mpm}" == "worker" || "%{with_mpm}" == "event" || "%{with_mod_memcache}" == "yes"
  138. THREADS="--enable-threads"
  139. %else
  140. THREADS="--disable-threads"
  141. %endif
  142. %if "%{with_mod_ldap}" == "yes"
  143. LIBS="$LIBS -lssl -lcrypto"
  144. %endif
  145. USE_BUNDLED_APR=YES \
  146. ./configure \
  147. --cache-file=./config.cache \
  148. --enable-layout=GNU \
  149. --prefix=%{l_prefix} \
  150. --with-program-name=apache2 \
  151. --sysconfdir=%{l_prefix}/etc/apache2 \
  152. --libexecdir=%{l_prefix}/libexec/apache2 \
  153. --with-mpm=%{with_mpm} \
  154. $THREADS \
  155. %if "%{with_suexec}" == "yes"
  156. --enable-suexec \
  157. --with-suexec-bin=%{l_prefix}/sbin/suexec \
  158. --with-suexec-caller=%{with_suexec_caller} \
  159. --with-suexec-userdir=%{with_suexec_userdir} \
  160. --with-suexec-logfile=%{l_prefix}/var/apache2/log/suexec.log \
  161. %endif
  162. %if "%{with_mod_deflate}" == "yes"
  163. --enable-deflate \
  164. --with-z=%{l_prefix} \
  165. %endif
  166. %if "%{with_mod_ssl}" == "yes"
  167. --enable-ssl \
  168. --with-ssl=%{l_prefix} \
  169. %endif
  170. %if "%{with_mod_dav}" == "yes"
  171. --enable-dav \
  172. --enable-dav-fs \
  173. %endif
  174. %if "%{with_mod_ldap}" == "yes"
  175. --enable-ldap \
  176. --enable-authnz-ldap \
  177. --with-ldap \
  178. --with-ldap-include=%{l_prefix}/include/ \
  179. --with-ldap-lib=%{l_prefix}/lib \
  180. %endif
  181. %if "%{with_mod_proxy}" == "yes"
  182. --enable-proxy \
  183. --enable-proxy-connect \
  184. --enable-proxy-http \
  185. --enable-proxy-ftp \
  186. %endif
  187. %if "%{with_mod_cache}" == "yes"
  188. --enable-cache \
  189. %if "%{with_mod_diskcache}" == "yes"
  190. --enable-disk-cache \
  191. %endif
  192. %if "%{with_mod_memcache}" == "yes"
  193. --enable-mem-cache \
  194. %endif
  195. %endif
  196. %if "%{with_mod_filecache}" == "yes"
  197. --enable-file-cache \
  198. %endif
  199. %if "%{with_mod_expires}" == "yes"
  200. --enable-expires \
  201. %endif
  202. --enable-so \
  203. --enable-speling \
  204. --enable-rewrite \
  205. --enable-headers \
  206. --enable-info \
  207. --enable-mime-magic \
  208. --enable-vhost-alias \
  209. --enable-auth-dbm \
  210. --disable-shared \
  211. --with-included-apr \
  212. --with-dbm=db42 \
  213. --with-berkeley-db=%{l_prefix} \
  214. --with-expat=%{l_prefix} \
  215. --with-iconv=%{l_prefix}
  216. # check whether requested MPM '%{with_mpm}' has been actually selected
  217. # setting might affect package dependencies, therefore fallbacks
  218. # are not acceptable
  219. if ! grep '^MPM_NAME = %{with_mpm}$' build/config_vars.mk >/dev/null 2>&1; then
  220. ( echo "The Multi-Processing Module (MPM) '%{with_mpm}' requested using the"
  221. echo "'with_mpm' option doesn't seem to be available on this particular"
  222. echo "platform. Please check corresponding 'config.log' for details."
  223. ) | %{l_rpmtool} msg -b -t error
  224. exit 1
  225. fi
  226. # build package
  227. %{l_make} %{l_mflags}
  228. ) || exit $?
  229. %install
  230. # install Apache
  231. rm -rf $RPM_BUILD_ROOT
  232. ( cd httpd-%{version}
  233. %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT
  234. rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/apache2/apache2.conf
  235. rm -fr $RPM_BUILD_ROOT%{l_prefix}/etc/apache2/{extra,original}
  236. ) || exit $?
  237. # adjust permissions
  238. chmod 755 $RPM_BUILD_ROOT%{l_prefix}/sbin/envvars
  239. # adjust GNU libtool configuration
  240. %{l_shtool} subst \
  241. -e 's;^build_libtool_libs=no;build_libtool_libs=yes;' \
  242. $RPM_BUILD_ROOT%{l_prefix}/share/apache2/build/libtool
  243. # install shell environment script
  244. %{l_shtool} install -c -m 644 %{l_value -s -a} \
  245. -e 's;@l_path@;%{l_build_path};' \
  246. -e 's;@l_ld_library_path@;%{l_build_ldlp};' \
  247. %{SOURCE apache2.sh} \
  248. $RPM_BUILD_ROOT%{l_prefix}/etc/apache2/
  249. # create default configuration
  250. l_hostname=`%{l_shtool} echo -e %h`
  251. l_domainname=`%{l_shtool} echo -e %d | cut -c2-`
  252. %{l_shtool} install -c -m 644 %{l_value -s -a} \
  253. -e "s;@l_hostname@;$l_hostname;g" \
  254. -e "s;@l_domainname@;$l_domainname;g" \
  255. %{SOURCE apache2.base} \
  256. %{SOURCE apache2.conf} \
  257. $RPM_BUILD_ROOT%{l_prefix}/etc/apache2/
  258. mv $RPM_BUILD_ROOT%{l_prefix}/etc/apache2/magic \
  259. $RPM_BUILD_ROOT%{l_prefix}/etc/apache2/mime.magic
  260. %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/apache2/apache2.d
  261. # install run-command script
  262. %{l_shtool} mkdir -f -p -m 755 \
  263. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
  264. %{l_shtool} install -c -m 755 %{l_value -s -a} \
  265. %{SOURCE rc.apache2} \
  266. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  267. # strip down installation
  268. strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
  269. strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* >/dev/null 2>&1 || true
  270. ( cd $RPM_BUILD_ROOT%{l_prefix}/share/apache2/manual
  271. find . -name "*.xml" -print | xargs rm -f
  272. find . -name "*.xml.*" -print | xargs rm -f
  273. find . -name "*.xsl" -print | xargs rm -f
  274. for html in `find . -name "*.html" -print`; do
  275. if [ -f "$html.en" ]; then
  276. mv $html.en $html
  277. rm -f $html.*
  278. fi
  279. done
  280. rm -rf style/xsl
  281. rm -rf style/latex
  282. ) || exit $?
  283. # determine installation files
  284. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  285. %{l_files_std} \
  286. %if "%{with_suexec}" == "yes"
  287. '%attr(4755,%{l_susr},%{l_mgrp}) %{l_prefix}/sbin/suexec' \
  288. %endif
  289. '%config %{l_prefix}/etc/apache2/*' \
  290. '%config %attr(444,%{l_musr},%{l_mgrp}) %{l_prefix}/etc/apache2/apache2.base'
  291. %files -f files
  292. %clean
  293. rm -rf $RPM_BUILD_ROOT
  294. %post
  295. # after upgrade, restart service
  296. [ $1 -eq 2 ] || exit 0
  297. eval `%{l_rc} apache2 status 2>/dev/null`
  298. [ ".$apache2_active" = .yes ] && %{l_rc} apache2 restart
  299. exit 0
  300. %preun
  301. # before erase, stop service and remove log files
  302. [ $1 -eq 0 ] || exit 0
  303. %{l_rc} apache2 stop 2>/dev/null
  304. rm -f $RPM_INSTALL_PREFIX/var/apache2/log/* >/dev/null 2>&1 || true
  305. exit 0