php-xcache.spec 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. ##
  2. ## php-xcache.spec -- OpenPKG RPM Package Specification
  3. ## Copyright (c) 2000-2017 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 3.2.0
  25. %define V_dist 3.2.0
  26. # package information
  27. Name: php-xcache
  28. Summary: PHP/Zend Cache
  29. URL: http://xcache.lighttpd.net/
  30. Vendor: mOo
  31. Packager: OpenPKG Foundation e.V.
  32. Distribution: OpenPKG Community
  33. Class: PLUS
  34. Group: Language
  35. License: PHP
  36. Version: %{V_opkg}
  37. Release: 20151017
  38. # package options
  39. %option with_apache no
  40. %option with_fpm no
  41. # list of sources
  42. Source0: http://xcache.lighttpd.net/pub/Releases/%{V_dist}/xcache-%{V_dist}.tar.gz
  43. Source1: php-xcache.ini
  44. # build information
  45. BuildPreReq: OpenPKG, openpkg >= 20160101, libtool, autoconf, automake
  46. PreReq: OpenPKG, openpkg >= 20160101
  47. BuildPreReq: php
  48. PreReq: php
  49. %if "%{with_apache}" == "yes"
  50. PreReq: apache, apache-php
  51. %endif
  52. %if "%{with_fpm}" == "yes"
  53. PreReq: php-fpm
  54. %endif
  55. %description
  56. XCache is a PHP/Zend opcode cache. It optimizes performance by
  57. removing the compilation time of PHP scripts by caching the compiled
  58. state of PHP scripts into RAM and uses the compiled version straight
  59. from the RAM. This will increase the rate of page generation time by
  60. up to 5 times.
  61. %track
  62. prog php-xcache = {
  63. version = %{V_dist}
  64. url = http://xcache.lighttpd.net/wiki/ReleaseArchive
  65. regex = XCache\s+(\d+(\.\d+)+)
  66. }
  67. %prep
  68. %setup -q -n xcache-%{V_dist}
  69. %build
  70. # configure module
  71. %{l_prefix}/bin/phpize
  72. CC="%{l_cc}" \
  73. CFLAGS="%{l_cflags -O}" \
  74. CPPFLAGS="%{l_cppflags}" \
  75. LDFLAGS="%{l_ldflags}" \
  76. GREP="grep" \
  77. ./configure \
  78. --prefix=%{l_prefix} \
  79. --with-php-config=%{l_prefix}/bin/php-config \
  80. --enable-xcache \
  81. --enable-shared \
  82. --disable-static
  83. # build module
  84. %{l_make} %{l_mflags}
  85. %install
  86. # create installation hierarchy
  87. %{l_shtool} mkdir -f -p -m 755 \
  88. $RPM_BUILD_ROOT%{l_prefix}/bin \
  89. $RPM_BUILD_ROOT%{l_prefix}/libexec/php-xcache \
  90. $RPM_BUILD_ROOT%{l_prefix}/share/php-xcache
  91. # install module
  92. %{l_shtool} install -c -m 755 \
  93. .libs/xcache.so $RPM_BUILD_ROOT%{l_prefix}/libexec/php-xcache/
  94. # install PHP configuration
  95. %{l_shtool} install -c -m 644 %{l_value -s -a} \
  96. %{SOURCE php-xcache.ini} $RPM_BUILD_ROOT%{l_prefix}/share/php-xcache/
  97. # determine installation files
  98. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std}
  99. %files -f files
  100. %clean
  101. %post
  102. if [ ".$1" = .1 ]; then
  103. # add hook to PHP configuration
  104. phpini="$RPM_INSTALL_PREFIX/etc/php/php.ini"
  105. if [ -f $phpini ]; then
  106. cat $RPM_INSTALL_PREFIX/share/php-xcache/php-xcache.ini |\
  107. $RPM_INSTALL_PREFIX/lib/openpkg/rpmtool config \
  108. -a -i "$RPM_INSTALL_PREFIX:php-xcache" -p ";" $phpini
  109. fi
  110. %if "%{with_apache}" == "yes"
  111. # add hook to Apache/PHP configuration
  112. phpini="$RPM_INSTALL_PREFIX/etc/apache/apache-php.ini"
  113. if [ -f $phpini ]; then
  114. cat $RPM_INSTALL_PREFIX/share/php-xcache/php-xcache.ini |\
  115. $RPM_INSTALL_PREFIX/lib/openpkg/rpmtool config \
  116. -a -i "$RPM_INSTALL_PREFIX:php-xcache" -p ";" $phpini
  117. fi
  118. %endif
  119. %if "%{with_fpm}" == "yes"
  120. # add hook to PHP-FPM configuration
  121. phpini="$RPM_INSTALL_PREFIX/etc/php-fpm/php-fpm.ini"
  122. if [ -f $phpini ]; then
  123. cat $RPM_INSTALL_PREFIX/share/php-xcache/php-xcache.ini |\
  124. $RPM_INSTALL_PREFIX/lib/openpkg/rpmtool config \
  125. -a -i "$RPM_INSTALL_PREFIX:php-xcache" -p ";" $phpini
  126. fi
  127. %endif
  128. fi
  129. %postun
  130. if [ ".$1" = .0 ]; then
  131. # remove hook from PHP configuration
  132. phpini="$RPM_INSTALL_PREFIX/etc/php/php.ini"
  133. if [ -f $phpini ]; then
  134. $RPM_INSTALL_PREFIX/lib/openpkg/rpmtool config \
  135. -r -i "$RPM_INSTALL_PREFIX:php-xcache" -p ";" $phpini
  136. fi
  137. %if "%{with_apache}" == "yes"
  138. # remove hook from Apache/PHP configuration
  139. phpini="$RPM_INSTALL_PREFIX/etc/apache/apache-php.ini"
  140. if [ -f $phpini ]; then
  141. $RPM_INSTALL_PREFIX/lib/openpkg/rpmtool config \
  142. -r -i "$RPM_INSTALL_PREFIX:php-xcache" -p ";" $phpini
  143. fi
  144. %endif
  145. %if "%{with_fpm}" == "yes"
  146. # remove hook from Apache/PHP configuration
  147. phpini="$RPM_INSTALL_PREFIX/etc/php-fpm/php-fpm.ini"
  148. if [ -f $phpini ]; then
  149. $RPM_INSTALL_PREFIX/lib/openpkg/rpmtool config \
  150. -r -i "$RPM_INSTALL_PREFIX:php-xcache" -p ";" $phpini
  151. fi
  152. %endif
  153. fi