Busybox: Upgrade to 1.21.1 (stable). lsof active.
[tomato.git] / release / src / router / php / makerpm
blob07bd372df4379102d8e948b345f292d70754d96d
1 #! /bin/sh
3 # Based slightly on an original by John H Terpstra but not much left of his.
4 # S Liddicott 1999 sam@campbellsci.co.uk
6 PREFIX="php"
7 TARDIR="`basename \`pwd\``"
8 RELEASE=${1:-1}
9 VERSION=${2:-`echo $TARDIR | sed "s/$PREFIX-//g"`}
11 if [ "$VERSION" = "" ]
12 then cat <<"EOH"
13 $PREFIX source needs to be installed in a folder that contains the version
14 number, e.g. ${PREFIX}5 or ${PREFIX}5b2
15 EOH
18 echo "Usage:"
19 echo "$0 <release> <version>"
20 echo
21 echo "e.g.:"
22 echo "$0 2"
23 echo -n "Building RPM version $VERSION, release: $RELEASE "
24 sleep 1 ; echo -n . ; sleep 1 ; echo -n . ; sleep 1 ; echo -n .
25 echo
27 TAR=php-$VERSION.tar.gz
28 SPEC=php-$VERSION.spec
29 PREQUIRES=`rpm -q --provides apache|grep "\(webserver\|httpd\)"`
30 if [ "$PREQUIRES" = "" ]
31 then PREQUIRES="webserver"
34 # write out the .spec file
35 sed -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'
40 Summary: PHP 5 - A powerful scripting language
41 Name: php5
42 Version: PVERSION
43 Release: PRELEASE
44 Group: Networking/Daemons
45 Source0: http://www.php.net/distributions/php-%{PACKAGE_VERSION}.tar.gz
46 Copyright: PHP License
47 BuildRoot: %{_tmppath}/%{name}-%{version}-buildroot
48 Requires: PREQUIRES
50 %description
51 PHP 5 is a powerful apache module that adds scripting and database connection
52 capabilities to the apache server. This version includes the "php_cgi" binary
53 for suExec and stand alone php scripts too.
55 %prep
56 %setup -q -n TARDIR
57 #mkdir manual; cd manual && tar xzf $RPM_SOURCE_DIR/php3-manual.tar.gz
58 ./buildconf
60 %build
61 # first the standalone (why can't you build both at once?)
62 # need to run this under sh or it breaks
64 sh ./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 \
78 make
79 mv sapi/cgi/php php.keepme
81 # then the apache module
82 test -f config.cache && rm -f config.cache
83 sh ./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 \
96 # --with-pgsql=shared \
98 make clean
99 make
100 # restore cgi version
101 mv php.keepme sapi/cgi/php
103 %install
104 rm -rf $RPM_BUILD_ROOT
105 mkdir -p $RPM_BUILD_ROOT%{_libdir}/apache
106 install -m 0755 .libs/libphp5.so $RPM_BUILD_ROOT%{_libdir}/apache
107 mkdir -p $RPM_BUILD_ROOT%{_bindir}
108 install -m 0755 sapi/cli/php $RPM_BUILD_ROOT%{_bindir}
109 install -m 0755 sapi/cgi/php $RPM_BUILD_ROOT%{_bindir}/php_cgi
110 mkdir -p $RPM_BUILD_ROOT%{_mandir}/man1
111 install -m 0755 sapi/cli/php.1 $RPM_BUILD_ROOT%{_mandir}/man1
112 mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}
113 install -m 0755 php.ini-recommended $RPM_BUILD_ROOT%{_sysconfdir}/php.ini
114 mkdir -p $RPM_BUILD_ROOT%{_libdir}/php/extensions
115 install -m 0755 modules/*.so $RPM_BUILD_ROOT%{_libdir}/php/extensions
117 %clean
118 rm -rf $RPM_BUILD_ROOT
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.
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.
139 * Mon Mar 04 2002 Arjen Lentz <agl@bitbike.com>
140 - Fix path and remove --with-imap due to conflicts with kerberos.
142 * Fri Jun 29 2001 Jani Taskinen <sniper@iki.fi>
143 - Removed some useless configure options. Made the tar names correct.
145 * Sun Apr 30 2000 Joey Smith <joey@samaritan.com>
146 - Small fix: Description still referred to package as PHP3.
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
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
154 * Mon Oct 12 1998 Cristian Gafton <gafton@redhat.com>
155 - rebuild for apache 1.3.3
157 * Thu Oct 08 1998 Preston Brown <pbrown@redhat.com>
158 - updated to 3.0.5, fixes nasty bugs in 3.0.4.
160 * Sun Sep 27 1998 Cristian Gafton <gafton@redhat.com>
161 - updated to 3.0.4 and recompiled for apache 1.3.2
163 * Thu Sep 03 1998 Preston Brown <pbrown@redhat.com>
164 - improvements; builds with apache-devel package installed.
166 * Tue Sep 01 1998 Preston Brown <pbrown@redhat.com>
167 - Made initial cut for PHP3.
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
178 %doc TODO CODING_STANDARDS CREDITS ChangeLog LICENSE NEWS
181 RPMBASE=/usr/src/redhat
182 for i in /usr/src/redhat /usr/src/packages /usr/src/RPM; do
183 if test -d $i; then
184 RPMBASE=$i
185 break
187 done
189 RPMDIR=${RPMBASE}/RPMS
190 SPECDIR=${RPMBASE}/SPECS
191 SRCDIR=${RPMBASE}/SOURCES
194 make clean
195 find . -name config.cache -exec rm -f '{}' \;
196 cd ..
197 tar czvf ${SRCDIR}/${TAR} $TARDIR )
199 cp -a $SPEC $SPECDIR/${SPEC}
200 #cp -a *.patch $SRCDIR
201 cd $SRCDIR
202 cd $SPECDIR
203 rpm -ba -v ${SPEC}