php-eaccelerator.spec 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  1. ##
  2. ## php-eaccelerator.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 version
  25. %define V_dist 0.9.5
  26. %define V_opkg 0.9.5
  27. # package information
  28. Name: php-eaccelerator
  29. Summary: Zend/PHP Accelerator
  30. URL: http://eaccelerator.net/
  31. Vendor: Dmitry Stogov et al.
  32. Packager: OpenPKG Foundation e.V.
  33. Distribution: OpenPKG Community
  34. Class: PLUS
  35. Group: Language
  36. License: GPL
  37. Version: %{V_opkg}
  38. Release: 20070622
  39. # package options
  40. %option with_apache yes
  41. # list of sources
  42. Source0: http://switch.dl.sourceforge.net/eaccelerator/eaccelerator-%{V_dist}.tar.bz2
  43. Patch0: php-eaccelerator.patch
  44. # build information
  45. Prefix: %{l_prefix}
  46. BuildRoot: %{l_buildroot}
  47. BuildPreReq: OpenPKG, openpkg >= 20040130, libtool, autoconf, automake
  48. PreReq: OpenPKG, openpkg >= 20040130
  49. BuildPreReq: php
  50. PreReq: php
  51. %if "%{with_apache}" == "yes"
  52. PreReq: apache, apache-php
  53. %endif
  54. AutoReq: no
  55. AutoReqProv: no
  56. %description
  57. eAccelerator is an accelerator, optimizer, encoder and dynamic
  58. content cache for PHP/Zend. It increases performance of PHP scripts
  59. by caching them in compiled state, so that the overhead of compiling
  60. is almost completely eliminated. Also it uses some optimizations to
  61. speed up execution of PHP scripts. eAccelerator typically reduces
  62. server load and increases the speed of PHP code by 1-10 times.
  63. eAccelerator is a fork of TurckMMCache.
  64. %track
  65. prog php-eaccelerator = {
  66. version = %{V_dist}
  67. url = http://prdownloads.sourceforge.net/eaccelerator/
  68. regex = eaccelerator-(\d+\.\d+\.\d+(?:-beta\d+)?)\.tar\.(gz|bz2)
  69. }
  70. %prep
  71. %setup -q -n eaccelerator-%{V_dist}
  72. %patch -p0
  73. %build
  74. # configure module
  75. %{l_prefix}/bin/phpize
  76. CC="%{l_cc}" \
  77. CFLAGS="%{l_cflags -O}" \
  78. CPPFLAGS="%{l_cppflags}" \
  79. LDFLAGS="%{l_ldflags}" \
  80. GREP="grep" \
  81. ./configure \
  82. --prefix=%{l_prefix} \
  83. --with-php-config=%{l_prefix}/bin/php-config \
  84. --enable-eaccelerator \
  85. --with-eaccelerator-userid=%{l_nusr} \
  86. --with-eaccelerator-crash-detection \
  87. --with-eaccelerator-optimizer \
  88. --with-eaccelerator-encoder \
  89. --with-eaccelerator-loader \
  90. --with-eaccelerator-sessions \
  91. --with-eaccelerator-shared-memory \
  92. --with-eaccelerator-content-caching \
  93. --with-eaccelerator-disassembler \
  94. --with-eaccelerator-info \
  95. --enable-shared \
  96. --disable-static
  97. # build module
  98. %{l_make} %{l_mflags -O}
  99. %install
  100. # create installation hierarchy
  101. rm -rf $RPM_BUILD_ROOT
  102. %{l_shtool} mkdir -f -p -m 755 \
  103. $RPM_BUILD_ROOT%{l_prefix}/bin \
  104. $RPM_BUILD_ROOT%{l_prefix}/libexec/php-eaccelerator \
  105. $RPM_BUILD_ROOT%{l_prefix}/lib/php-eaccelerator \
  106. $RPM_BUILD_ROOT%{l_prefix}/share/php-eaccelerator \
  107. $RPM_BUILD_ROOT%{l_prefix}/var/php-eaccelerator
  108. # install module
  109. %{l_shtool} install -c -m 755 \
  110. .libs/eaccelerator.so $RPM_BUILD_ROOT%{l_prefix}/libexec/php-eaccelerator/
  111. # install administration user interface
  112. %{l_shtool} install -c -m 644 \
  113. control.php dasm.php $RPM_BUILD_ROOT%{l_prefix}/lib/php-eaccelerator/
  114. # install PHP configuration
  115. %{l_shtool} install -c -m 644 \
  116. -e 's;^\(zend_extension="\)\(eaccelerator\.so.*\)$;\1%{l_prefix}/libexec/php-''eaccelerator/\2;' \
  117. -e 's;/tmp/eaccelerator;%{l_prefix}/var/php-''eaccelerator;' \
  118. -e 's/^\(eaccelerator\.log_file\)/; \1/' \
  119. -e 's;/var/log/httpd/eaccelerator_log;%{l_prefix}/var/php-''eaccelerator/php-''eaccelerator.log;' \
  120. -e 's;^\(eaccelerator.compress_level = "\)9\("\);\14\2;' \
  121. -e 's;shm_and_disk;shm_only;' \
  122. -e 's;^\(eaccelerator.allowed_admin_path = "\)\("\);\1%{l_prefix}/lib/php-''eaccelerator/\2;' \
  123. eaccelerator.ini $RPM_BUILD_ROOT%{l_prefix}/share/php-eaccelerator/
  124. # install encoder utility
  125. ( echo "#!/bin/sh"
  126. echo "exec %{l_prefix}/bin/php -q %{l_prefix}/libexec/php-eaccelerator/encoder.php \"\$@\""
  127. ) >encoder
  128. %{l_shtool} install -c -m 755 \
  129. encoder $RPM_BUILD_ROOT%{l_prefix}/bin/php-encoder
  130. %{l_shtool} install -c -m 644 \
  131. encoder.php $RPM_BUILD_ROOT%{l_prefix}/libexec/php-eaccelerator/
  132. # determine installation files
  133. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  134. %{l_files_std} \
  135. '%attr(1777,%{l_musr},%{l_mgrp}) %{l_prefix}/var/php-eaccelerator'
  136. %files -f files
  137. %clean
  138. rm -rf $RPM_BUILD_ROOT
  139. %post
  140. if [ ".$1" = .1 ]; then
  141. # add hook to PHP configuration
  142. phpini="$RPM_INSTALL_PREFIX/etc/php/php.ini"
  143. if [ -f $phpini ]; then
  144. cat $RPM_INSTALL_PREFIX/share/php-eaccelerator/eaccelerator.ini |\
  145. $RPM_INSTALL_PREFIX/lib/openpkg/rpmtool config \
  146. -a -i "$RPM_INSTALL_PREFIX:php-eaccelerator" -p ";" $phpini
  147. fi
  148. %if "%{with_apache}" == "yes"
  149. # add hook to Apache/PHP configuration
  150. phpini="$RPM_INSTALL_PREFIX/etc/apache/php.ini"
  151. if [ -f $phpini ]; then
  152. cat $RPM_INSTALL_PREFIX/share/php-eaccelerator/eaccelerator.ini |\
  153. $RPM_INSTALL_PREFIX/lib/openpkg/rpmtool config \
  154. -a -i "$RPM_INSTALL_PREFIX:php-eaccelerator" -p ";" $phpini
  155. fi
  156. # add hook to Apache configuration
  157. apacheconf="$RPM_INSTALL_PREFIX/etc/apache/apache.conf"
  158. if [ -f $apacheconf ]; then
  159. ( echo "Alias /php-eaccelerator $RPM_INSTALL_PREFIX/lib/php-eaccelerator"
  160. ) | $RPM_INSTALL_PREFIX/lib/openpkg/rpmtool config \
  161. -a -i "$RPM_INSTALL_PREFIX:php-eaccelerator" $apacheconf
  162. fi
  163. # display final hints on installation
  164. ( echo "You can access the online administration control page under"
  165. echo " http://localhost/php-eaccelerator/control.php"
  166. echo "The login is \"admin\" with password \"eAccelerator\"."
  167. ) | %{l_rpmtool} msg -b -t notice
  168. %endif
  169. fi
  170. %preun
  171. # before erase, remove log files
  172. [ $1 -eq 0 ] || exit 0
  173. rm -f $RPM_INSTALL_PREFIX/var/php-eaccelerator/* >/dev/null 2>&1 || true
  174. %postun
  175. if [ ".$1" = .0 ]; then
  176. # remove hook from PHP configuration
  177. phpini="$RPM_INSTALL_PREFIX/etc/php/php.ini"
  178. if [ -f $phpini ]; then
  179. $RPM_INSTALL_PREFIX/lib/openpkg/rpmtool config \
  180. -r -i "$RPM_INSTALL_PREFIX:php-eaccelerator" -p ";" $phpini
  181. fi
  182. %if "%{with_apache}" == "yes"
  183. # remove hook from Apache/PHP configuration
  184. phpini="$RPM_INSTALL_PREFIX/etc/apache/php.ini"
  185. if [ -f $phpini ]; then
  186. $RPM_INSTALL_PREFIX/lib/openpkg/rpmtool config \
  187. -r -i "$RPM_INSTALL_PREFIX:php-eaccelerator" -p ";" $phpini
  188. fi
  189. # remove hook from Apache configuration
  190. apacheconf="$RPM_INSTALL_PREFIX/etc/apache/apache.conf"
  191. if [ -f $apacheconf ]; then
  192. $RPM_INSTALL_PREFIX/lib/openpkg/rpmtool config \
  193. -r -i "$RPM_INSTALL_PREFIX:php-eaccelerator" $apacheconf
  194. fi
  195. %endif
  196. fi