wok-6.x view php/receipt @ rev 15149
php: fix post_install
| author | Pascal Bellard <pascal.bellard@slitaz.org> | 
|---|---|
| date | Thu Aug 15 13:25:02 2013 +0000 (2013-08-15) | 
| parents | ea4381b83496 | 
| children | 7b91061e7189 | 
 line source
     1 # SliTaz package receipt.
     3 PACKAGE="php"
     4 VERSION="5.4.13"
     5 CATEGORY="development"
     6 SHORT_DESC="PHP web programming language."
     7 MAINTAINER="pankso@slitaz.org"
     8 TARBALL="$PACKAGE-$VERSION.tar.bz2"
     9 WEB_SITE="http://www.php.net/"
    10 WGET_URL="http://www.php.net/distributions/$TARBALL"
    11 PROVIDE="php:lighttpd"
    13 DEPENDS="php-common lighttpd zlib libxml2 sqlite libssl"
    14 BUILD_DEPENDS="sqlite-dev libxml2-dev zlib-dev libmysqlclient mysql-dev \
    15 net-snmp-dev postgresql-dev gettext openssl-dev apache-dev apr-util-dev \
    16 c-client mhash-dev libpng-dev libunixODBC unixODBC-dev openldap-dev \
    17 libldap apr-dev libmcrypt-dev curl-dev cyrus-sasl-dev perl pkg-config \
    18 jpeg-dev net-snmp-dev libvpx-dev apache"
    20 # Rules to configure and make the package.
    21 compile_rules()
    22 {
    23 	cd $src
    24 	COMMON_ARGS="\
    25 --prefix=/usr \
    26 --sysconfdir=/etc \
    27 --infodir=/usr/share/info \
    28 --mandir=/usr/share/man \
    29 --enable-mbstring \
    30 --enable-sockets \
    31 --enable-ftp \
    32 --enable-zip \
    33 --enable-calendar \
    34 --enable-exif \
    35 --config-cache \
    36 --enable-dba=shared \
    37 --with-config-file-path=/etc \
    38 --with-zlib \
    39 --with-gettext \
    40 --with-mcrypt=shared,/usr \
    41 --with-mysql=shared,/usr \
    42 --with-mysqli=shared \
    43 --with-mysql-sock=/var/mysql/mysql.sock \
    44 --with-pdo-sqlite=shared,/usr \
    45 --with-pgsql=shared,/usr \
    46 --with-snmp=shared,/usr \
    47 --enable-soap=shared,/usr \
    48 --with-ldap=shared \
    49 --with-imap=shared --with-imap-ssl \
    50 --with-mhash \
    51 --with-gd=shared \
    52 --with-jpeg-dir=/usr \
    53 --with-png-dir=/usr \
    54 --with-vpx-dir=/usr \
    55 --with-openssl=shared \
    56 --with-unixODBC=shared,/usr \
    57 --with-pear=/usr/share/php \
    58 --with-pdo-mysql=shared \
    59 --with-pdo-pgsql=shared \
    60 --with-curl=shared \
    61 --enable-sqlite-utf8 \
    62 --with-sqlite3=shared,/usr \
    63 --with-sqlite=shared \
    64 "
    65 	sed -i 's/pam_start/pam_nostart/' configure
    66 	./configure $COMMON_ARGS $CONFIGURE_ARGS && \
    67 	make $MAKEFLAGS && make -j1 INSTALL_ROOT=$DESTDIR install
    68 	./configure $COMMON_ARGS $CONFIGURE_ARGS --with-apxs2=/usr/bin/apxs && \
    69 	make $MAKEFLAGS && {
    70 		mkdir -p $DESTDIR/etc/apache
    71 		cp /etc/apache/httpd.conf $DESTDIR/etc/apache/httpd.conf
    72 		make -j1 INSTALL_ROOT=$DESTDIR install
    73 	}
    74 	# Production config file.
    75 	mkdir -p $DESTDIR/etc
    76 	cp $src/php.ini-production $DESTDIR/etc/php.ini || exit 1
    77 	sed -e 's|extension_dir = "./"|extension_dir = "/usr/share/php/"|' \
    78 		-i $DESTDIR/etc/php.ini
    79 }
    81 # Rules to gen a SliTaz package suitable for Tazpkg.
    82 genpkg_rules()
    83 {
    84 	mkdir -p $fs/usr/bin $fs/usr/share/php
    85 	cp -a $src/sapi/cgi/php-cgi $fs/usr/bin
    86 }
    88 # Post and pre install commands to stop
    89 # and restart Web server if needed.
    90 pre_install()
    91 {
    92 	if [ -z "$1" -a ! -f "/var/run/lighttpd.pid" ]; then
    93 		/etc/init.d/lighttpd stop
    94 	fi
    95 }
    97 post_install()
    98 {
    99 	# Enable php
   100 	if [ -f $1/etc/lighttpd/lighttpd.conf ]; then
   101 	  [ -f $1/usr/lib/lighttpd/mod_fastcgi.so ] || \
   102 	  	tazpkg get-install lighttpd-modules --root=$1/
   103 	  sed -e 's|#fastcgi.server = ( ".php"|fastcgi.server = ( ".php"|' \
   104 	    -e 's|#"bin-path" => "/usr/bin/php-cgi"|"bin-path" => "/usr/bin/php-cgi"|' \
   105 	    -e 's|#"socket" => "/tmp/php.socket"|"socket" => "/tmp/php.socket"\n  )))|' \
   106 	    -i $1/etc/lighttpd/lighttpd.conf
   107 	  grep -q mod_fastcgi $1/etc/lighttpd/lighttpd.conf || \
   108 	  	sed -e 's|server.modules = (|server.modules = (\n  "mod_fastcgi",|' \
   109 	  	    -i $1/etc/lighttpd/lighttpd.conf
   110 	  grep -q php3 $1/etc/lighttpd/lighttpd.conf || \
   111 	  	sed -e 's|for PHP.*|for PHP.\nfastcgi.map-extensions = ( ".php3" => ".php", ".php4" => ".php", ".php5" => ".php" )|' \
   112 	  	    -i $1/etc/lighttpd/lighttpd.conf
   113 	fi
   114 	# Start Web server.
   115 	if [ -z "$1" -a ! -f /var/run/lighttpd.pid \
   116 		     -a -f /etc/init.d/lighttpd ]; then
   117 		/etc/init.d/lighttpd start
   118 	fi
   119 }