wok rev 1315

php*: add apache support
author Pascal Bellard <pascal.bellard@slitaz.org>
date Wed Aug 27 18:48:42 2008 +0000 (2008-08-27)
parents 32fa0b9984a6
children 0c811a59b200
files php-apache/receipt php-common/receipt php-ldap/receipt php-mysql/receipt php-pgsql/receipt php/receipt
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/php-apache/receipt	Wed Aug 27 18:48:42 2008 +0000
     1.3 @@ -0,0 +1,55 @@
     1.4 +# SliTaz package receipt.
     1.5 +
     1.6 +PACKAGE="php-apache"
     1.7 +VERSION="5.2.5"
     1.8 +CATEGORY="development"
     1.9 +SHORT_DESC="PHP module for apache."
    1.10 +MAINTAINER="pascal.bellard@slitaz.org"
    1.11 +DEPENDS="php-common apache"
    1.12 +WEB_SITE="http://www.php.net/"
    1.13 +WANTED="php"
    1.14 +PROVIDE="php:apache"
    1.15 +
    1.16 +# Rules to gen a SliTaz package suitable for Tazpkg.
    1.17 +genpkg_rules()
    1.18 +{
    1.19 +	mkdir -p $fs/usr/share
    1.20 +	cp -a $_pkg/usr/share/apache $fs/usr/share
    1.21 +}
    1.22 +
    1.23 +# Post and pre install commans to stop
    1.24 +# and restart Web server if needed.
    1.25 +pre_install()
    1.26 +{
    1.27 +	if [ -z "$1" -a -f "/var/run/apache/httpd.pid" ]; then
    1.28 +		/etc/init.d/apache stop
    1.29 +	fi
    1.30 +}
    1.31 +
    1.32 +post_install()
    1.33 +{
    1.34 +	grep -q php5_module $1/etc/apache/httpd.conf || {
    1.35 +	    sed -e 's|mod_rewrite.so|mod_rewrite.so\nLoadModule php5_module share/apache/modules/libphp5.so|' \
    1.36 +	    	-e 's|DirectoryIndex index.html|DirectoryIndex index.html index.php|' \
    1.37 +		-e 's|mime.types|mime.types\n    AddType application/x-httpd-php .php .php3 .php4 .php5\n    AddType application/x-httpd-php-source .phps|' \
    1.38 +	        -i $1/etc/apache/httpd.conf
    1.39 +	}
    1.40 +	[ -f $1/etc/apache/conf.d/phpinfo ] || \
    1.41 +		cat > $1/etc/apache/conf.d/phpinfo <<EOT
    1.42 +<IfModule mod_alias.c>
    1.43 +    Alias /phpinfo /usr/share/phpinfo
    1.44 +</IfModule>
    1.45 +<DirectoryMatch /usr/share/phpinfo/>
    1.46 +    DirectoryIndex index.php
    1.47 +    Options +FollowSymLinks
    1.48 +    AllowOverride None
    1.49 +    Order allow,deny
    1.50 +    Allow from all
    1.51 +</DirectoryMatch>
    1.52 +EOT
    1.53 +	# Start Web server.
    1.54 +	if [ -z "$1" -a ! -f "/var/run/apache/httpd.pid" ]; then
    1.55 +		/etc/init.d/apache start
    1.56 +	fi
    1.57 +}
    1.58 +
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/php-common/receipt	Wed Aug 27 18:48:42 2008 +0000
     2.3 @@ -0,0 +1,49 @@
     2.4 +# SliTaz package receipt.
     2.5 +
     2.6 +PACKAGE="php-common"
     2.7 +VERSION="5.2.5"
     2.8 +CATEGORY="development"
     2.9 +SHORT_DESC="Common files for PHP modules."
    2.10 +MAINTAINER="pascal.bellard@slitaz.org"
    2.11 +WEB_SITE="http://www.php.net/"
    2.12 +WANTED="php"
    2.13 +CONFIG_FILES="/etc/php.ini"
    2.14 +
    2.15 +# Rules to gen a SliTaz package suitable for Tazpkg.
    2.16 +genpkg_rules()
    2.17 +{
    2.18 +	mkdir -p $fs/usr/share $fs/etc
    2.19 +	cp -a $_pkg/usr/share/phpinfo $fs/usr/share
    2.20 +	cp -a $_pkg/usr/share/applications $fs/usr/share
    2.21 +	cp -a $_pkg/usr/share/pixmap $fs/usr/share
    2.22 +	cp $_pkg/etc/php.ini $fs/etc
    2.23 +}
    2.24 +
    2.25 +# Post and pre install commands
    2.26 +pre_install()
    2.27 +{
    2.28 +	# Backup existing php.ini
    2.29 +	if [ -f "$1/etc/php.ini" ]; then
    2.30 +		echo -n "Creating php.ini backup..."
    2.31 +		cp $1/etc/php.ini $1/etc/php.ini.bak
    2.32 +		status
    2.33 +	fi
    2.34 +}
    2.35 +post_install()
    2.36 +{
    2.37 +	( cd $1/ ; cpio -o -H newc | gzip -9 ) > \
    2.38 +		$1/$INSTALLED/$PACKAGE/volatile.cpio.gz <<EOT
    2.39 +etc/php.ini
    2.40 +EOT
    2.41 +	# Restore original php.ini
    2.42 +	if [ -f "$1/etc/php.ini.bak" ]; then
    2.43 +		echo -n "Restoring php.ini backup..."
    2.44 +		mv -f $1/etc/php.ini.bak $1/etc/php.ini 
    2.45 +		status
    2.46 +	fi
    2.47 +}
    2.48 +
    2.49 +repack_cleanup()
    2.50 +{
    2.51 +        zcat $INSTALLED/$PACKAGE/volatile.cpio.gz | ( cd $1 ; cpio -id )
    2.52 +}
     3.1 --- a/php-ldap/receipt	Wed Aug 27 18:41:39 2008 +0000
     3.2 +++ b/php-ldap/receipt	Wed Aug 27 18:48:42 2008 +0000
     3.3 @@ -20,9 +20,14 @@
     3.4  # and restart Web server if needed.
     3.5  pre_install()
     3.6  {
     3.7 -	if [ -z "$1" -a -f "/var/run/lighttpd.pid" ]; then
     3.8 -		/etc/init.d/lighttpd stop
     3.9 -	fi
    3.10 +	while read daemon file; do
    3.11 +		if [ -z "$1" -a -f "/var/run/$file" ]; then
    3.12 +			/etc/init.d/$daemon stop
    3.13 +		fi
    3.14 +	done <<EOT
    3.15 +apache apache/httpd.pid
    3.16 +lighttpd lighttpd.pid
    3.17 +EOT
    3.18  }
    3.19  
    3.20  post_install()
    3.21 @@ -30,8 +35,14 @@
    3.22  	grep -q ^extension=msql.so $1/etc/php.ini || \
    3.23  	    sed -e 's|;.*extension=msql.so|;   extension=msql.so\nextension=ldap.so|' -i $1/etc/php.ini
    3.24  	# Start Web server.
    3.25 -	if [ -z "$1" -a ! -f "/var/run/lighttpd.pid" ]; then
    3.26 -		/etc/init.d/lighttpd start
    3.27 -	fi
    3.28 +	while read daemon file; do
    3.29 +		if [ -z "$1" -a -f /etc/init.d/$daemon \
    3.30 +			     -a ! -f "/var/run/$file" ]; then
    3.31 +			/etc/init.d/$daemon start
    3.32 +		fi
    3.33 +	done <<EOT
    3.34 +apache apache/httpd.pid
    3.35 +lighttpd lighttpd.pid
    3.36 +EOT
    3.37  }
    3.38  
     4.1 --- a/php-mysql/receipt	Wed Aug 27 18:41:39 2008 +0000
     4.2 +++ b/php-mysql/receipt	Wed Aug 27 18:48:42 2008 +0000
     4.3 @@ -20,9 +20,14 @@
     4.4  # and restart Web server if needed.
     4.5  pre_install()
     4.6  {
     4.7 -	if [ -z "$1" -a -f "/var/run/lighttpd.pid" ]; then
     4.8 -		/etc/init.d/lighttpd stop
     4.9 -	fi
    4.10 +	while read daemon file; do
    4.11 +		if [ -z "$1" -a -f "/var/run/$file" ]; then
    4.12 +			/etc/init.d/$daemon stop
    4.13 +		fi
    4.14 +	done <<EOT
    4.15 +apache apache/httpd.pid
    4.16 +lighttpd lighttpd.pid
    4.17 +EOT
    4.18  }
    4.19  
    4.20  post_install()
    4.21 @@ -30,8 +35,14 @@
    4.22  	grep -q ^extension=msql.so $1/etc/php.ini || \
    4.23  	    sed -e 's|;.*extension=msql.so|;   extension=msql.so\nextension=mysql.so|' -i $1/etc/php.ini
    4.24  	# Start Web server.
    4.25 -	if [ -z "$1" -a ! -f "/var/run/lighttpd.pid" ]; then
    4.26 -		/etc/init.d/lighttpd start
    4.27 -	fi
    4.28 +	while read daemon file; do
    4.29 +		if [ -z "$1" -a -f /etc/init.d/$daemon \
    4.30 +			     -a ! -f "/var/run/$file" ]; then
    4.31 +			/etc/init.d/$daemon start
    4.32 +		fi
    4.33 +	done <<EOT
    4.34 +apache apache/httpd.pid
    4.35 +lighttpd lighttpd.pid
    4.36 +EOT
    4.37  }
    4.38  
     5.1 --- a/php-pgsql/receipt	Wed Aug 27 18:41:39 2008 +0000
     5.2 +++ b/php-pgsql/receipt	Wed Aug 27 18:48:42 2008 +0000
     5.3 @@ -20,9 +20,14 @@
     5.4  # and restart Web server if needed.
     5.5  pre_install()
     5.6  {
     5.7 -	if [ -z "$1" -a -f "/var/run/lighttpd.pid" ]; then
     5.8 -		/etc/init.d/lighttpd stop
     5.9 -	fi
    5.10 +	while read daemon file; do
    5.11 +		if [ -z "$1" -a -f "/var/run/$file" ]; then
    5.12 +			/etc/init.d/$daemon stop
    5.13 +		fi
    5.14 +	done <<EOT
    5.15 +apache apache/httpd.pid
    5.16 +lighttpd lighttpd.pid
    5.17 +EOT
    5.18  }
    5.19  
    5.20  post_install()
    5.21 @@ -30,8 +35,14 @@
    5.22  	grep -q ^extension=msql.so $1/etc/php.ini || \
    5.23  	    sed -e 's|;.*extension=msql.so|;   extension=msql.so\nextension=pgsql.so|' -i $1/etc/php.ini
    5.24  	# Start Web server.
    5.25 -	if [ -z "$1" -a ! -f "/var/run/lighttpd.pid" ]; then
    5.26 -		/etc/init.d/lighttpd start
    5.27 -	fi
    5.28 +	while read daemon file; do
    5.29 +		if [ -z "$1" -a -f /etc/init.d/$daemon \
    5.30 +			     -a ! -f "/var/run/$file" ]; then
    5.31 +			/etc/init.d/$daemon start
    5.32 +		fi
    5.33 +	done <<EOT
    5.34 +apache apache/httpd.pid
    5.35 +lighttpd lighttpd.pid
    5.36 +EOT
    5.37  }
    5.38  
     6.1 --- a/php/receipt	Wed Aug 27 18:41:39 2008 +0000
     6.2 +++ b/php/receipt	Wed Aug 27 18:48:42 2008 +0000
     6.3 @@ -5,36 +5,49 @@
     6.4  CATEGORY="development"
     6.5  SHORT_DESC="PHP web programming language."
     6.6  MAINTAINER="pankso@slitaz.org"
     6.7 -DEPENDS="lighttpd zlib libxml2 sqlite"
     6.8 -BUILD_DEPENDS="sqlite-dev libxml2-dev zlib-dev mysql-dev postgresql postgresql-dev gettext openssl-dev"
     6.9 +DEPENDS="php-common lighttpd zlib libxml2 sqlite"
    6.10 +BUILD_DEPENDS="sqlite-dev libxml2-dev zlib-dev mysql-dev postgresql postgresql-dev gettext openssl-dev apache-dev apache"
    6.11  TARBALL="$PACKAGE-$VERSION.tar.bz2"
    6.12  WEB_SITE="http://www.php.net/"
    6.13  WGET_URL="http://us2.php.net/distributions/$TARBALL"
    6.14 -CONFIG_FILES="/etc/php.ini"
    6.15 +PROVIDE="php:lighttpd"
    6.16  
    6.17  # Rules to configure and make the package.
    6.18  compile_rules()
    6.19  {
    6.20  	cd $src
    6.21 -	./configure \
    6.22 -		--prefix=/usr \
    6.23 -		--sysconfdir=/etc \
    6.24 -		--infodir=/usr/share/info \
    6.25 -		--mandir=/usr/share/man \
    6.26 -		--enable-fastcgi \
    6.27 -		--enable-discard-path \
    6.28 -		--enable-force-cgi-redirect \
    6.29 -		--enable-mbstring \
    6.30 -		--with-config-file-path=/etc \
    6.31 -		--with-zlib \
    6.32 -		--with-gettext \
    6.33 -		--with-mysql=shared,usr \
    6.34 -		--with-pgsql=shared,usr \
    6.35 -		--with-ldap=shared \
    6.36 -		--disable-cli \
    6.37 -		$CONFIGURE_ARGS
    6.38 -	make
    6.39 -	make INSTALL_ROOT=$PWD/_pkg install
    6.40 +	COMMON_ARGS="\
    6.41 +--prefix=/usr \
    6.42 +--sysconfdir=/etc \
    6.43 +--infodir=/usr/share/info \
    6.44 +--mandir=/usr/share/man \
    6.45 +--enable-fastcgi \
    6.46 +--enable-discard-path \
    6.47 +--enable-force-cgi-redirect \
    6.48 +--enable-mbstring \
    6.49 +--with-config-file-path=/etc \
    6.50 +--with-zlib \
    6.51 +--with-gettext \
    6.52 +--with-mysql=shared,usr \
    6.53 +--with-pgsql=shared,usr \
    6.54 +--with-ldap=shared \
    6.55 +--disable-cli"
    6.56 +	./configure $COMMON_ARGS $CONFIGURE_ARGS && \
    6.57 +	make && make INSTALL_ROOT=$PWD/_pkg install
    6.58 +	./configure $COMMON_ARGS --with-apxs2=/usr/bin/apxs $CONFIGURE_ARGS && \
    6.59 +	make && {
    6.60 +		mkdir -p _pkg/etc/apache
    6.61 +		cp /etc/apache/httpd.conf _pkg/etc/apache/httpd.conf
    6.62 +		make INSTALL_ROOT=$PWD/_pkg install
    6.63 +	}
    6.64 +	# Recommended config file and phpinfo.
    6.65 +	cp php.ini-recommended _pkg/etc/php.ini
    6.66 +	sed -e 's|extension_dir = "./"|extension_dir = "/usr/share/php/"|' \
    6.67 +	    -i _pkg/etc/php.ini
    6.68 +	cp -a ../stuff/phpinfo _pkg/usr/share
    6.69 +	mkdir _pkg/usr/share/applications _pkg/usr/share/pixmap
    6.70 +	cp ../stuff/php.desktop _pkg/usr/share/applications
    6.71 +	cp ../stuff/php.png _pkg/usr/share/pixmap
    6.72  }
    6.73  
    6.74  # Rules to gen a SliTaz package suitable for Tazpkg.
    6.75 @@ -42,43 +55,22 @@
    6.76  {
    6.77  	mkdir -p $fs/usr/bin $fs/etc $fs/usr/share
    6.78  	cp -a $src/sapi/cgi/php-cgi $fs/usr/bin
    6.79 -	# Recommended config file and phpinfo.
    6.80 -	cp $src/php.ini-recommended $fs/etc/php.ini
    6.81 -	sed -e 's|extension_dir = "./"|extension_dir = "/usr/share/php/"|' \
    6.82 -	    -i $fs/etc/php.ini
    6.83 -	cp -a stuff/phpinfo $fs/usr/share
    6.84  	for i in $(cd $WOK; ls -d php-*)
    6.85  	do
    6.86  		tazwok cook $i
    6.87  	done
    6.88  }
    6.89  
    6.90 -# Post and pre install commans to stop
    6.91 +# Post and pre install commands to stop
    6.92  # and restart Web server if needed.
    6.93  pre_install()
    6.94  {
    6.95  	if [ -f "$1/var/run/lighttpd.pid" ]; then
    6.96  		/etc/init.d/lighttpd stop
    6.97  	fi
    6.98 -	# Backup existing php.ini
    6.99 -	if [ -f "$1/etc/php.ini" ]; then
   6.100 -		echo -n "Creating php.ini backup..."
   6.101 -		cp $1/etc/php.ini $1/etc/php.ini.bak
   6.102 -		status
   6.103 -	fi
   6.104  }
   6.105  post_install()
   6.106  {
   6.107 -	( cd $1/ ; cpio -o -H newc | gzip -9 ) > \
   6.108 -		$1/$INSTALLED/$PACKAGE/volatile.cpio.gz <<EOT
   6.109 -etc/php.ini
   6.110 -EOT
   6.111 -	# Restore original php.ini
   6.112 -	if [ -f "$1/etc/php.ini.bak" ]; then
   6.113 -		echo -n "Restoring php.ini backup..."
   6.114 -		mv -f $1/etc/php.ini.bak $1/etc/php.ini 
   6.115 -		status
   6.116 -	fi
   6.117  	# Enable php
   6.118  	if [ -f $1/etc/lighttpd/lighttpd.conf ]; then
   6.119  	  [ -f $1/usr/lib/lighttpd/mod_fastcgi.so ] || \
   6.120 @@ -96,8 +88,3 @@
   6.121  		/etc/init.d/lighttpd start
   6.122  	fi
   6.123  }
   6.124 -
   6.125 -repack_cleanup()
   6.126 -{
   6.127 -        zcat $INSTALLED/$PACKAGE/volatile.cpio.gz | ( cd $1 ; cpio -id )
   6.128 -}