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