makerpm 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. #! /bin/sh
  2. # Based slightly on an original by John H Terpstra but not much left of his.
  3. # S Liddicott 1999 sam@campbellsci.co.uk
  4. PREFIX="php"
  5. TARDIR="`basename \`pwd\``"
  6. RELEASE=${1:-1}
  7. VERSION=${2:-`echo $TARDIR | sed "s/$PREFIX-//g"`}
  8. if [ "$VERSION" = "" ]
  9. then cat <<"EOH"
  10. $PREFIX source needs to be installed in a folder that contains the version
  11. number, e.g. ${PREFIX}5 or ${PREFIX}5b2
  12. EOH
  13. fi
  14. echo "Usage:"
  15. echo "$0 <release> <version>"
  16. echo
  17. echo "e.g.:"
  18. echo "$0 2"
  19. echo -n "Building RPM version $VERSION, release: $RELEASE "
  20. sleep 1 ; echo -n . ; sleep 1 ; echo -n . ; sleep 1 ; echo -n .
  21. echo
  22. TAR=php-$VERSION.tar.gz
  23. SPEC=php-$VERSION.spec
  24. PREQUIRES=`rpm -q --provides apache|grep "\(webserver\|httpd\)"`
  25. if [ "$PREQUIRES" = "" ]
  26. then PREQUIRES="webserver"
  27. fi
  28. # write out the .spec file
  29. sed -e "s/PVERSION/$VERSION/g" \
  30. -e "s/PRELEASE/$RELEASE/g" \
  31. -e "s/TARDIR/$TARDIR/g" \
  32. -e "s/PREQUIRES/$PREQUIRES/g" \
  33. > $SPEC <<'EOF'
  34. Summary: PHP 5 - A powerful scripting language
  35. Name: php5
  36. Version: PVERSION
  37. Release: PRELEASE
  38. Group: Networking/Daemons
  39. Source0: http://www.php.net/distributions/php-%{PACKAGE_VERSION}.tar.gz
  40. Copyright: PHP License
  41. BuildRoot: %{_tmppath}/%{name}-%{version}-buildroot
  42. Requires: PREQUIRES
  43. %description
  44. PHP 5 is a powerful apache module that adds scripting and database connection
  45. capabilities to the apache server. This version includes the "php_cgi" binary
  46. for suExec and stand alone php scripts too.
  47. %prep
  48. %setup -q -n TARDIR
  49. #mkdir manual; cd manual && tar xzf $RPM_SOURCE_DIR/php3-manual.tar.gz
  50. ./buildconf
  51. %build
  52. # first the standalone (why can't you build both at once?)
  53. # need to run this under sh or it breaks
  54. sh ./configure --prefix=/usr \
  55. --with-config-file-path=%{_sysconfdir} \
  56. --disable-cli \
  57. --without-pear \
  58. --enable-force-cgi-redirect \
  59. --enable-safe-mode \
  60. --with-exec-dir=/usr/bin \
  61. --with-mysql \
  62. --with-zlib \
  63. --enable-xml \
  64. --enable-wddx \
  65. --with-gd \
  66. --enable-shared \
  67. make
  68. mv sapi/cgi/php php.keepme
  69. # then the apache module
  70. test -f config.cache && rm -f config.cache
  71. sh ./configure --prefix=/usr \
  72. --with-apxs=/usr/sbin/apxs \
  73. --enable-cli \
  74. --with-config-file-path=%{_sysconfdir} \
  75. --enable-safe-mode \
  76. --with-exec-dir=/usr/bin \
  77. --with-mysql \
  78. --with-zlib \
  79. --enable-xml \
  80. --enable-wddx \
  81. --with-gd \
  82. --enable-shared \
  83. # --with-pgsql=shared \
  84. make clean
  85. make
  86. # restore cgi version
  87. mv php.keepme sapi/cgi/php
  88. %install
  89. rm -rf $RPM_BUILD_ROOT
  90. mkdir -p $RPM_BUILD_ROOT%{_libdir}/apache
  91. install -m 0755 .libs/libphp5.so $RPM_BUILD_ROOT%{_libdir}/apache
  92. mkdir -p $RPM_BUILD_ROOT%{_bindir}
  93. install -m 0755 sapi/cli/php $RPM_BUILD_ROOT%{_bindir}
  94. install -m 0755 sapi/cgi/php $RPM_BUILD_ROOT%{_bindir}/php_cgi
  95. mkdir -p $RPM_BUILD_ROOT%{_mandir}/man1
  96. install -m 0755 sapi/cli/php.1 $RPM_BUILD_ROOT%{_mandir}/man1
  97. mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}
  98. install -m 0755 php.ini-recommended $RPM_BUILD_ROOT%{_sysconfdir}/php.ini
  99. mkdir -p $RPM_BUILD_ROOT%{_libdir}/php/extensions
  100. install -m 0755 modules/*.so $RPM_BUILD_ROOT%{_libdir}/php/extensions
  101. %clean
  102. rm -rf $RPM_BUILD_ROOT
  103. %changelog
  104. * Thu Nov 27 2003 Marcus Boerger <helly@php.net>
  105. - Fix requirements for older systems.
  106. - Fix rpm build directory for the major distributions.
  107. - Fix config dir.
  108. - Rename package to php.
  109. - Add gd extension.
  110. - Support building of shared extensions.
  111. - Build CLI only once.
  112. * Thu Oct 31 2003 Marcus Boerger <helly@php.net>
  113. - Update version to 5.
  114. - Remove unsure external requirements.
  115. - Remove non existing directories
  116. - Fix targets.
  117. - Install both CLI and CGI.
  118. - Install manpage.
  119. - Install ini.
  120. * Mon Mar 04 2002 Arjen Lentz <agl@bitbike.com>
  121. - Fix path and remove --with-imap due to conflicts with kerberos.
  122. * Fri Jun 29 2001 Jani Taskinen <sniper@iki.fi>
  123. - Removed some useless configure options. Made the tar names correct.
  124. * Sun Apr 30 2000 Joey Smith <joey@samaritan.com>
  125. - Small fix: Description still referred to package as PHP3.
  126. * Wed Jul 21 1999 Sam Liddicott <sam@campbellsci.co.uk>
  127. - added php4b1 and modified cgi building rules so it doesn't break module
  128. * Wed Mar 17 1999 Sam Liddicott <sam@campbellsci.co.uk>
  129. - Stuffed in 3.0.7 source tar and added "php" as a build destination
  130. * Mon Oct 12 1998 Cristian Gafton <gafton@redhat.com>
  131. - rebuild for apache 1.3.3
  132. * Thu Oct 08 1998 Preston Brown <pbrown@redhat.com>
  133. - updated to 3.0.5, fixes nasty bugs in 3.0.4.
  134. * Sun Sep 27 1998 Cristian Gafton <gafton@redhat.com>
  135. - updated to 3.0.4 and recompiled for apache 1.3.2
  136. * Thu Sep 03 1998 Preston Brown <pbrown@redhat.com>
  137. - improvements; builds with apache-devel package installed.
  138. * Tue Sep 01 1998 Preston Brown <pbrown@redhat.com>
  139. - Made initial cut for PHP3.
  140. %files
  141. %defattr(-,root,root)
  142. %{_libdir}/apache/libphp5.so
  143. %{_bindir}/php
  144. %{_bindir}/php_cgi
  145. %{_mandir}/man1/php.1*
  146. %{_sysconfdir}/php.ini
  147. %{_libdir}/php/extensions/*.so
  148. %doc TODO CODING_STANDARDS CREDITS ChangeLog LICENSE NEWS
  149. EOF
  150. RPMBASE=/usr/src/redhat
  151. for i in /usr/src/redhat /usr/src/packages /usr/src/RPM; do
  152. if test -d $i; then
  153. RPMBASE=$i
  154. break
  155. fi
  156. done
  157. RPMDIR=${RPMBASE}/RPMS
  158. SPECDIR=${RPMBASE}/SPECS
  159. SRCDIR=${RPMBASE}/SOURCES
  160. (
  161. make clean
  162. find . -name config.cache -exec rm -f '{}' \;
  163. cd ..
  164. tar czvf ${SRCDIR}/${TAR} $TARDIR )
  165. cp -a $SPEC $SPECDIR/${SPEC}
  166. #cp -a *.patch $SRCDIR
  167. cd $SRCDIR
  168. cd $SPECDIR
  169. rpm -ba -v ${SPEC}