wok 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 9d3578b1f87d
children 8fce3057a659
files php-mysql/receipt php/receipt
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/php-mysql/receipt	Fri Jul 25 08:39:27 2008 +0000
     1.3 @@ -0,0 +1,37 @@
     1.4 +# SliTaz package receipt.
     1.5 +
     1.6 +PACKAGE="php-mysql"
     1.7 +VERSION="5.2.5"
     1.8 +CATEGORY="development"
     1.9 +SHORT_DESC="mysql module for PHP web programming language."
    1.10 +MAINTAINER="pascal.bellard@slitaz.org"
    1.11 +DEPENDS="libmysqlclient php"
    1.12 +WEB_SITE="http://www.php.net/"
    1.13 +WANTED="php"
    1.14 +
    1.15 +# Rules to gen a SliTaz package suitable for Tazpkg.
    1.16 +genpkg_rules()
    1.17 +{
    1.18 +	mkdir -p $fs/usr/share/php
    1.19 +	cp $(find $_pkg | grep mysql.so) $fs/usr/share/php/
    1.20 +}
    1.21 +
    1.22 +# Post and pre install commans to stop
    1.23 +# and restart Web server if needed.
    1.24 +pre_install()
    1.25 +{
    1.26 +	if [ -z "$1" -a -f "/var/run/lighttpd.pid" ]; then
    1.27 +		/etc/init.d/lighttpd stop
    1.28 +	fi
    1.29 +}
    1.30 +
    1.31 +post_install()
    1.32 +{
    1.33 +	grep -q ^extension=msql.so $1/etc/php.ini || \
    1.34 +	    sed -e 's|;.*extension=msql.so|;   extension=msql.so\nextension=mysql.so|' -i $1/etc/php.ini
    1.35 +	# Start Web server.
    1.36 +	if [ -z "$1" -a ! -f "/var/run/lighttpd.pid" ]; then
    1.37 +		/etc/init.d/lighttpd start
    1.38 +	fi
    1.39 +}
    1.40 +
     2.1 --- a/php/receipt	Fri Jul 25 08:10:49 2008 +0200
     2.2 +++ b/php/receipt	Fri Jul 25 08:39:27 2008 +0000
     2.3 @@ -6,7 +6,7 @@
     2.4  SHORT_DESC="PHP web programming language."
     2.5  MAINTAINER="pankso@slitaz.org"
     2.6  DEPENDS="lighttpd zlib libxml2 sqlite"
     2.7 -BUILD_DEPENDS="sqlite-dev libxml2-dev zlib-dev"
     2.8 +BUILD_DEPENDS="sqlite-dev libxml2-dev zlib-dev mysql-dev"
     2.9  TARBALL="$PACKAGE-$VERSION.tar.bz2"
    2.10  WEB_SITE="http://www.php.net/"
    2.11  WGET_URL="http://us2.php.net/distributions/$TARBALL"
    2.12 @@ -26,9 +26,11 @@
    2.13  		--enable-mbstring \
    2.14  		--with-config-file-path=/etc \
    2.15  		--with-zlib \
    2.16 +		--with-mysql=shared,usr \
    2.17  		--disable-cli \
    2.18  		$CONFIGURE_ARGS
    2.19  	make
    2.20 +	make INSTALL_ROOT=$PWD/_pkg install
    2.21  }
    2.22  
    2.23  # Rules to gen a SliTaz package suitable for Tazpkg.
    2.24 @@ -38,15 +40,19 @@
    2.25  	cp -a $src/sapi/cgi/php-cgi $fs/usr/bin
    2.26  	# Recommended config file and phpinfo.
    2.27  	cp $src/php.ini-recommended $fs/etc/php.ini
    2.28 +	sed -e 's|extension_dir = "./"|extension_dir = "/usr/share/php/"|' \
    2.29 +	    -i $fs/etc/php.ini
    2.30  	cp -a stuff/phpinfo $fs/usr/share
    2.31 +	for i in $(cd $WOK; ls -d php-*)
    2.32 +	do
    2.33 +		tazwok cook $i
    2.34 +	done
    2.35  }
    2.36  
    2.37  # Post and pre install commans to stop
    2.38  # and restart Web server if needed.
    2.39  pre_install()
    2.40  {
    2.41 -	local root
    2.42 -	root=$1
    2.43  	if [ -f "$1/var/run/lighttpd.pid" ]; then
    2.44  		/etc/init.d/lighttpd stop
    2.45  	fi
    2.46 @@ -65,6 +71,18 @@
    2.47  		mv -f $1/etc/php.ini.bak $1/etc/php.ini 
    2.48  		status
    2.49  	fi
    2.50 +	# Enable php
    2.51 +	if [ -f $1/etc/lighttpd/lighttpd.conf ]; then
    2.52 +	  [ -f $1/usr/lib/lighttpd/mod_fastcgi.so ] || \
    2.53 +	  	tazpkg get-install lighttpd-modules --root=$1/
    2.54 +	  sed -e 's|#fastcgi.server = ( ".php"|fastcgi.server = ( ".php"|' \
    2.55 +	    -e 's|#"bin-path" => "/usr/bin/php-cgi"|"bin-path" => "/usr/bin/php-cgi"|' \
    2.56 +	    -e 's|#"socket" => "/tmp/php.socket"|"socket" => "/tmp/php.socket"\n  )))|' \
    2.57 +	    -i $1/etc/lighttpd/lighttpd.conf
    2.58 +	  grep -q mod_fastcgi $1/etc/lighttpd/lighttpd.conf || \
    2.59 +	  	sed -e 's|server.modules = (|server.modules = (\n  "mod_fastcgi",|' \
    2.60 +	  	    -i $1/etc/lighttpd/lighttpd.conf
    2.61 +	fi
    2.62  	# Start Web server.
    2.63  	if [ -z "$1" -a ! -f "/var/run/lighttpd.pid" ]; then
    2.64  		/etc/init.d/lighttpd start