php-eaccelerator.spec 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. ##
  2. ## php-eaccelerator.spec -- OpenPKG RPM Package Specification
  3. ## Copyright (c) 2000-2010 OpenPKG Foundation e.V. <http://openpkg.net/>
  4. ##
  5. ## Permission to use, copy, modify, and distribute this software for
  6. ## any purpose with or without fee is hereby granted, provided that
  7. ## the above copyright notice and this permission notice appear in all
  8. ## copies.
  9. ##
  10. ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  11. ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  12. ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  13. ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
  14. ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  15. ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  16. ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  17. ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  18. ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  19. ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  20. ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  21. ## SUCH DAMAGE.
  22. ##
  23. # package version
  24. %define V_opkg 0.9.6.1
  25. %define V_subdir 0.9.6.1
  26. %define V_tarball 0.9.6.1
  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: 20100601
  39. # package options
  40. %option with_apache yes
  41. # list of sources
  42. Source0: http://bart.eaccelerator.net/source/%{V_subdir}/eaccelerator-%{V_tarball}.tar.bz2
  43. Patch0: php-eaccelerator.patch
  44. # build information
  45. BuildPreReq: OpenPKG, openpkg >= 20100101, libtool, autoconf, automake
  46. PreReq: OpenPKG, openpkg >= 20100101
  47. BuildPreReq: php
  48. PreReq: php
  49. %if "%{with_apache}" == "yes"
  50. PreReq: apache, apache-php
  51. %endif
  52. %description
  53. eAccelerator is an accelerator, optimizer and dynamic content cache
  54. for PHP/Zend. It increases performance of PHP scripts by caching
  55. them in compiled state, so that the overhead of compiling is almost
  56. completely eliminated. Also it uses some optimizations to speed up
  57. execution of PHP scripts. eAccelerator typically reduces server load
  58. and increases the speed of PHP code by 1-10 times. eAccelerator is a
  59. fork of TurckMMCache.
  60. %track
  61. prog php-eaccelerator = {
  62. version = %{V_tarball}
  63. url = http://bart.eaccelerator.net/source/
  64. regex = (\d+(\.\d+)+)/
  65. url = http://bart.eaccelerator.net/source/__NEWVER__/
  66. regex = eaccelerator-(\d+(\.\d+)+)\.tar\.bz2
  67. }
  68. %prep
  69. %setup -q -n eaccelerator-%{V_tarball}
  70. %patch -p0
  71. %build
  72. # configure module
  73. %{l_prefix}/bin/phpize
  74. CC="%{l_cc}" \
  75. CFLAGS="%{l_cflags -O}" \
  76. CPPFLAGS="%{l_cppflags}" \
  77. LDFLAGS="%{l_ldflags}" \
  78. GREP="grep" \
  79. ./configure \
  80. --prefix=%{l_prefix} \
  81. --with-php-config=%{l_prefix}/bin/php-config \
  82. --enable-eaccelerator \
  83. --with-eaccelerator-userid=%{l_nusr} \
  84. --with-eaccelerator-crash-detection \
  85. --with-eaccelerator-optimizer \
  86. --with-eaccelerator-disassembler \
  87. --with-eaccelerator-info \
  88. --without-eaccelerator-debug \
  89. --enable-shared \
  90. --disable-static
  91. # build module
  92. %{l_make} %{l_mflags -O}
  93. %install
  94. # create installation hierarchy
  95. rm -rf $RPM_BUILD_ROOT
  96. %{l_shtool} mkdir -f -p -m 755 \
  97. $RPM_BUILD_ROOT%{l_prefix}/bin \
  98. $RPM_BUILD_ROOT%{l_prefix}/libexec/php-eaccelerator \
  99. $RPM_BUILD_ROOT%{l_prefix}/lib/php-eaccelerator \
  100. $RPM_BUILD_ROOT%{l_prefix}/share/php-eaccelerator \
  101. $RPM_BUILD_ROOT%{l_prefix}/var/php-eaccelerator
  102. # install module
  103. %{l_shtool} install -c -m 755 \
  104. .libs/eaccelerator.so $RPM_BUILD_ROOT%{l_prefix}/libexec/php-eaccelerator/
  105. # install administration user interface
  106. %{l_shtool} install -c -m 644 \
  107. control.php dasm.php $RPM_BUILD_ROOT%{l_prefix}/lib/php-eaccelerator/
  108. # install PHP configuration
  109. %{l_shtool} install -c -m 644 \
  110. -e 's;^\(zend_extension="\)\(eaccelerator\.so.*\)$;\1%{l_prefix}/libexec/php-''eaccelerator/\2;' \
  111. -e 's;/tmp/eaccelerator;%{l_prefix}/var/php-''eaccelerator;' \
  112. -e 's/^\(eaccelerator\.log_file\)/; \1/' \
  113. -e 's;/var/log/httpd/eaccelerator_log;%{l_prefix}/var/php-''eaccelerator/php-''eaccelerator.log;' \
  114. -e 's;^\(eaccelerator.compress_level = "\)9\("\);\14\2;' \
  115. -e 's;shm_and_disk;shm_only;' \
  116. -e 's;^\(eaccelerator.allowed_admin_path = "\)\("\);\1%{l_prefix}/lib/php-''eaccelerator/\2;' \
  117. eaccelerator.ini $RPM_BUILD_ROOT%{l_prefix}/share/php-eaccelerator/
  118. # determine installation files
  119. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  120. %{l_files_std} \
  121. '%attr(1777,%{l_musr},%{l_mgrp}) %{l_prefix}/var/php-eaccelerator'
  122. %files -f files
  123. %clean
  124. %post
  125. if [ ".$1" = .1 ]; then
  126. # add hook to PHP configuration
  127. phpini="$RPM_INSTALL_PREFIX/etc/php/php.ini"
  128. if [ -f $phpini ]; then
  129. cat $RPM_INSTALL_PREFIX/share/php-eaccelerator/eaccelerator.ini |\
  130. $RPM_INSTALL_PREFIX/lib/openpkg/rpmtool config \
  131. -a -i "$RPM_INSTALL_PREFIX:php-eaccelerator" -p ";" $phpini
  132. fi
  133. %if "%{with_apache}" == "yes"
  134. # add hook to Apache/PHP configuration
  135. phpini="$RPM_INSTALL_PREFIX/etc/apache/php.ini"
  136. if [ -f $phpini ]; then
  137. cat $RPM_INSTALL_PREFIX/share/php-eaccelerator/eaccelerator.ini |\
  138. $RPM_INSTALL_PREFIX/lib/openpkg/rpmtool config \
  139. -a -i "$RPM_INSTALL_PREFIX:php-eaccelerator" -p ";" $phpini
  140. fi
  141. # add hook to Apache configuration
  142. apacheconf="$RPM_INSTALL_PREFIX/etc/apache/apache.conf"
  143. if [ -f $apacheconf ]; then
  144. ( echo "Alias /php-eaccelerator $RPM_INSTALL_PREFIX/lib/php-eaccelerator"
  145. ) | $RPM_INSTALL_PREFIX/lib/openpkg/rpmtool config \
  146. -a -i "$RPM_INSTALL_PREFIX:php-eaccelerator" $apacheconf
  147. fi
  148. # display final hints on installation
  149. ( echo "You can access the online administration control page under"
  150. echo " http://localhost/php-eaccelerator/control.php"
  151. echo "The login is \"admin\" with password \"eAccelerator\"."
  152. ) | %{l_rpmtool} msg -b -t notice
  153. %endif
  154. fi
  155. %preun
  156. # before erase, remove log files
  157. [ $1 -eq 0 ] || exit 0
  158. rm -f $RPM_INSTALL_PREFIX/var/php-eaccelerator/* >/dev/null 2>&1 || true
  159. %postun
  160. if [ ".$1" = .0 ]; then
  161. # remove hook from PHP configuration
  162. phpini="$RPM_INSTALL_PREFIX/etc/php/php.ini"
  163. if [ -f $phpini ]; then
  164. $RPM_INSTALL_PREFIX/lib/openpkg/rpmtool config \
  165. -r -i "$RPM_INSTALL_PREFIX:php-eaccelerator" -p ";" $phpini
  166. fi
  167. %if "%{with_apache}" == "yes"
  168. # remove hook from Apache/PHP configuration
  169. phpini="$RPM_INSTALL_PREFIX/etc/apache/php.ini"
  170. if [ -f $phpini ]; then
  171. $RPM_INSTALL_PREFIX/lib/openpkg/rpmtool config \
  172. -r -i "$RPM_INSTALL_PREFIX:php-eaccelerator" -p ";" $phpini
  173. fi
  174. # remove hook from Apache configuration
  175. apacheconf="$RPM_INSTALL_PREFIX/etc/apache/apache.conf"
  176. if [ -f $apacheconf ]; then
  177. $RPM_INSTALL_PREFIX/lib/openpkg/rpmtool config \
  178. -r -i "$RPM_INSTALL_PREFIX:php-eaccelerator" $apacheconf
  179. fi
  180. %endif
  181. fi