wok-6.x view php/receipt @ rev 12795

slitaz-base-files: fix genpkg_rules
author Pascal Bellard <pascal.bellard@slitaz.org>
date Fri May 18 09:43:02 2012 +0200 (2012-05-18)
parents 850218586bdf
children 5e702bac8175
line source
1 # SliTaz package receipt.
3 PACKAGE="php"
4 VERSION="5.2.17"
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://us2.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 apache libtool"
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-fastcgi \
30 --enable-discard-path \
31 --enable-force-cgi-redirect \
32 --enable-mbstring \
33 --enable-sockets \
34 --enable-ftp \
35 --enable-zip \
36 --enable-calendar \
37 --enable-exif \
38 --enable-dba=shared \
39 --enable-dbase=shared \
40 --with-config-file-path=/etc \
41 --with-zlib \
42 --with-gettext \
43 --with-mcrypt=shared,/usr \
44 --with-mysql=shared,/usr \
45 --with-mysqli=shared \
46 --with-pgsql=shared,/usr \
47 --with-snmp=shared,/usr \
48 --enable-soap=shared,/usr \
49 --with-ldap=shared \
50 --with-imap=shared --with-imap-ssl \
51 --with-mhash=shared \
52 --with-gd=shared \
53 --with-jpeg-dir=/usr \
54 --with-png-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 "
62 sed -i 's/pam_start/pam_nostart/' configure
63 ./configure $COMMON_ARGS && \
64 make $MAKEFLAGS && make INSTALL_ROOT=$DESTDIR install
65 ./configure $COMMON_ARGS --with-apxs2=/usr/bin/apxs && \
66 make $MAKEFLAGS && {
67 mkdir -p $DESTDIR/etc/apache
68 cp /etc/apache/httpd.conf $DESTDIR/etc/apache/httpd.conf
69 make INSTALL_ROOT=$DESTDIR install
70 }
71 # Recommended config file.
72 mkdir -p $DESTDIR/etc
73 cp $src/php.ini-recommended $DESTDIR/etc/php.ini || exit 1
74 sed -e 's|extension_dir = "./"|extension_dir = "/usr/share/php/"|' \
75 -i $DESTDIR/etc/php.ini
76 }
78 # Rules to gen a SliTaz package suitable for Tazpkg.
79 genpkg_rules()
80 {
81 mkdir -p $fs/usr/bin $fs/usr/share/php
82 cp -a $src/sapi/cgi/php-cgi $fs/usr/bin
83 }
85 # Post and pre install commands to stop and restart Web server if needed.
86 pre_install()
87 {
88 if [ -f "$1/var/run/lighttpd.pid" ]; then
89 /etc/init.d/lighttpd stop
90 fi
91 }
93 post_install()
94 {
95 # Enable php
96 if [ -f $1/etc/lighttpd/lighttpd.conf ]; then
97 [ -f $1/usr/lib/lighttpd/mod_fastcgi.so ] || \
98 tazpkg get-install lighttpd-modules --root=$1/
99 sed -e 's|#fastcgi.server = ( ".php"|fastcgi.server = ( ".php"|' \
100 -e 's|#"bin-path" => "/usr/bin/php-cgi"|"bin-path" => "/usr/bin/php-cgi"|' \
101 -e 's|#"socket" => "/tmp/php.socket"|"socket" => "/tmp/php.socket"\n )))|' \
102 -i $1/etc/lighttpd/lighttpd.conf
103 grep -q mod_fastcgi $1/etc/lighttpd/lighttpd.conf || \
104 sed -e 's|server.modules = (|server.modules = (\n "mod_fastcgi",|' \
105 -i $1/etc/lighttpd/lighttpd.conf
106 grep -q php3 $1/etc/lighttpd/lighttpd.conf || \
107 sed -e 's|for PHP.*|for PHP.\nfastcgi.map-extensions = ( ".php3" => ".php", ".php4" => ".php", ".php5" => ".php" )|' \
108 -i $1/etc/lighttpd/lighttpd.conf
109 fi
110 # Start Web server.
111 if [ -z "$1" -a ! -f "/var/run/lighttpd.pid" ]; then
112 /etc/init.d/lighttpd start
113 fi
114 }