wok-next view php/receipt @ rev 1182
Add nbs
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Sun Aug 03 06:51:20 2008 +0000 (2008-08-03) |
parents | 443dbfefc6bf |
children | e679fb64c9d0 |
line source
1 # SliTaz package receipt.
3 PACKAGE="php"
4 VERSION="5.2.5"
5 CATEGORY="development"
6 SHORT_DESC="PHP web programming language."
7 MAINTAINER="pankso@slitaz.org"
8 DEPENDS="lighttpd zlib libxml2 sqlite"
9 BUILD_DEPENDS="sqlite-dev libxml2-dev zlib-dev mysql-dev postgresql postgresql-dev gettext openssl-dev"
10 TARBALL="$PACKAGE-$VERSION.tar.bz2"
11 WEB_SITE="http://www.php.net/"
12 WGET_URL="http://us2.php.net/distributions/$TARBALL"
14 # Rules to configure and make the package.
15 compile_rules()
16 {
17 cd $src
18 ./configure \
19 --prefix=/usr \
20 --sysconfdir=/etc \
21 --infodir=/usr/share/info \
22 --mandir=/usr/share/man \
23 --enable-fastcgi \
24 --enable-discard-path \
25 --enable-force-cgi-redirect \
26 --enable-mbstring \
27 --with-config-file-path=/etc \
28 --with-zlib \
29 --with-gettext \
30 --with-mysql=shared,usr \
31 --with-pgsql=shared,usr \
32 --with-ldap=shared
33 --disable-cli \
34 $CONFIGURE_ARGS
35 make
36 make INSTALL_ROOT=$PWD/_pkg install
37 }
39 # Rules to gen a SliTaz package suitable for Tazpkg.
40 genpkg_rules()
41 {
42 mkdir -p $fs/usr/bin $fs/etc $fs/usr/share
43 cp -a $src/sapi/cgi/php-cgi $fs/usr/bin
44 # Recommended config file and phpinfo.
45 cp $src/php.ini-recommended $fs/etc/php.ini
46 sed -e 's|extension_dir = "./"|extension_dir = "/usr/share/php/"|' \
47 -i $fs/etc/php.ini
48 cp -a stuff/phpinfo $fs/usr/share
49 for i in $(cd $WOK; ls -d php-*)
50 do
51 tazwok cook $i
52 done
53 }
55 # Post and pre install commans to stop
56 # and restart Web server if needed.
57 pre_install()
58 {
59 if [ -f "$1/var/run/lighttpd.pid" ]; then
60 /etc/init.d/lighttpd stop
61 fi
62 # Backup existing php.ini
63 if [ -f "$1/etc/php.ini" ]; then
64 echo -n "Creating php.ini backup..."
65 cp $1/etc/php.ini $1/etc/php.ini.bak
66 status
67 fi
68 }
69 post_install()
70 {
71 # Restore original php.ini
72 if [ -f "$1/etc/php.ini.bak" ]; then
73 echo -n "Restoring php.ini backup..."
74 mv -f $1/etc/php.ini.bak $1/etc/php.ini
75 status
76 fi
77 # Enable php
78 if [ -f $1/etc/lighttpd/lighttpd.conf ]; then
79 [ -f $1/usr/lib/lighttpd/mod_fastcgi.so ] || \
80 tazpkg get-install lighttpd-modules --root=$1/
81 sed -e 's|#fastcgi.server = ( ".php"|fastcgi.server = ( ".php"|' \
82 -e 's|#"bin-path" => "/usr/bin/php-cgi"|"bin-path" => "/usr/bin/php-cgi"|' \
83 -e 's|#"socket" => "/tmp/php.socket"|"socket" => "/tmp/php.socket"\n )))|' \
84 -i $1/etc/lighttpd/lighttpd.conf
85 grep -q mod_fastcgi $1/etc/lighttpd/lighttpd.conf || \
86 sed -e 's|server.modules = (|server.modules = (\n "mod_fastcgi",|' \
87 -i $1/etc/lighttpd/lighttpd.conf
88 fi
89 # Start Web server.
90 if [ -z "$1" -a ! -f "/var/run/lighttpd.pid" ]; then
91 /etc/init.d/lighttpd start
92 fi
93 }