wok-next view php/receipt @ rev 1143

Add php-mysql
author Pascal Bellard <pascal.bellard@slitaz.org>
date Fri Jul 25 08:39:27 2008 +0000 (2008-07-25)
parents 10710b8535bc
children 443dbfefc6bf
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"
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-mysql=shared,usr \
30 --disable-cli \
31 $CONFIGURE_ARGS
32 make
33 make INSTALL_ROOT=$PWD/_pkg install
34 }
36 # Rules to gen a SliTaz package suitable for Tazpkg.
37 genpkg_rules()
38 {
39 mkdir -p $fs/usr/bin $fs/etc $fs/usr/share
40 cp -a $src/sapi/cgi/php-cgi $fs/usr/bin
41 # Recommended config file and phpinfo.
42 cp $src/php.ini-recommended $fs/etc/php.ini
43 sed -e 's|extension_dir = "./"|extension_dir = "/usr/share/php/"|' \
44 -i $fs/etc/php.ini
45 cp -a stuff/phpinfo $fs/usr/share
46 for i in $(cd $WOK; ls -d php-*)
47 do
48 tazwok cook $i
49 done
50 }
52 # Post and pre install commans to stop
53 # and restart Web server if needed.
54 pre_install()
55 {
56 if [ -f "$1/var/run/lighttpd.pid" ]; then
57 /etc/init.d/lighttpd stop
58 fi
59 # Backup existing php.ini
60 if [ -f "$1/etc/php.ini" ]; then
61 echo -n "Creating php.ini backup..."
62 cp $1/etc/php.ini $1/etc/php.ini.bak
63 status
64 fi
65 }
66 post_install()
67 {
68 # Restore original php.ini
69 if [ -f "$1/etc/php.ini.bak" ]; then
70 echo -n "Restoring php.ini backup..."
71 mv -f $1/etc/php.ini.bak $1/etc/php.ini
72 status
73 fi
74 # Enable php
75 if [ -f $1/etc/lighttpd/lighttpd.conf ]; then
76 [ -f $1/usr/lib/lighttpd/mod_fastcgi.so ] || \
77 tazpkg get-install lighttpd-modules --root=$1/
78 sed -e 's|#fastcgi.server = ( ".php"|fastcgi.server = ( ".php"|' \
79 -e 's|#"bin-path" => "/usr/bin/php-cgi"|"bin-path" => "/usr/bin/php-cgi"|' \
80 -e 's|#"socket" => "/tmp/php.socket"|"socket" => "/tmp/php.socket"\n )))|' \
81 -i $1/etc/lighttpd/lighttpd.conf
82 grep -q mod_fastcgi $1/etc/lighttpd/lighttpd.conf || \
83 sed -e 's|server.modules = (|server.modules = (\n "mod_fastcgi",|' \
84 -i $1/etc/lighttpd/lighttpd.conf
85 fi
86 # Start Web server.
87 if [ -z "$1" -a ! -f "/var/run/lighttpd.pid" ]; then
88 /etc/init.d/lighttpd start
89 fi
90 }