Update for new BUILD_DIR and SRC_DIR variables
[hvlinux.git] / stage5 / pkg / php
index 2ff7172..083a13f 100644 (file)
@@ -1,67 +1,69 @@
-#!/bin/sh
-set -o errexit
+#!/bin/bash
 
-# First argument of this script is the package name
+hvconfig_pre()
+{
+    # Since PHP 5, you need to explicitly bundle PHP with MySQL by --with-mysql
+    # directive (make sure you specified path to where MySQL is installed on
+    # your system).
 
-# Reading system configuration informations, functions and package versions.
-source ../sysinfos
-source ../functions
-source ../packages-list
+    # Build directory doesn't work:
+    #   gcc: Zend/zend_language_scanner.c: No such file or directory
+    # --mandir:
+    #   If not specified, php installs some man pages under /usr/php
+    #   (phpize.1, php.1 and php-config.1)
+    CONFIGURE_OPTS+=" \
+        --localstatedir=/var \
+        --datadir=/usr/share/php \
+        --mandir=/usr/share/man \
+        --with-config-file-path=/etc \
+        --enable-fpm \
+        --with-fpm-user=${HTTPD_USER} \
+        --with-fpm-group=${HTTPD_USER} \
+        --with-zlib \
+        --enable-bcmath \
+        --with-bz2 \
+        --enable-calendar \
+        --enable-dba=shared \
+        --with-gdbm \
+        --with-gmp \
+        --enable-ftp \
+        --with-gettext \
+        --enable-mbstring \
+        --with-readline \
+        --with-apxs2 \
+        --with-mysql=/usr \
+        --with-openssl=/usr \
+        --with-gd \
+        --with-freetype-dir=/usr \
+        --with-t1lib \
+        --enable-gd-native-ttf \
+        --enable-exif"
 
-# Applying patches (if any)
-apply_patches ${1}
+# IMAP
+#        --with-imap=/usr/lib/uw-imap \
+#        --with-imap-ssl=/usr/include/openssl"
+}
 
-cd ${LFS_TMP}/${1}
-sed -i 's/const char \*errpfx,/const DB_ENV *dbenv, & const/' ext/dba/dba_db4.c
+hvbuild_post()
+{
+    if [ -f /etc/php.ini ]; then
+        cp /etc/php.ini /etc/php.ini.old
+    fi
+    cp ${SRC_DIR}/php.ini-production /etc/php.ini
 
-# Since PHP 5, you need to explicitly bundle PHP with MySQL by --with-mysql directive
-# (make sure you specified path to where MySQL is installed on your system).
+    if [ "x${USE_HTTPD}" = "xyes" ]; then
+        # To enable PHP support in the Apache web server, a new AddType
+        # directive must be added to the httpd.conf file.
+        if ! grep -q "application/x-httpd-php" /etc/httpd/httpd.conf; then
+            echo "AddType application/x-httpd-php .php" >> /etc/httpd/httpd.conf
+        fi
 
-# Build directory doesn't work:
-# gcc: Zend/zend_language_scanner.c: No such file or directory
-./configure \
-    --prefix=/usr \
-    --sysconfdir=/etc \
-    --with-apxs2=/usr/sbin/apxs \
-    --enable-force-cgi-redirect \
-    --enable-discard-path \
-    --with-config-file-path=/etc \
-    --with-zlib \
-    --enable-bcmath \
-    --with-bz2 \
-    --with-gd \
-    --with-freetype-dir=/usr \
-    --with-t1lib \
-    --enable-gd-native-ttf \
-    --enable-calendar \
-    --enable-dba \
-    --enable-exif \
-    --enable-ftp \
-    --with-gettext \
-    --enable-mbstring \
-    --with-ncurses \
-    --with-readline \
-    --with-openssl=/usr \
-    --with-ldap \
-    --with-mysql=/usr \
-    --with-imap=/usr/lib/uw-imap \
-    --with-imap-ssl=/usr/include/openssl
-make
-make install
+        # Est-ce nĂ©cessaire?
+        #cgi.discard_path = 1
 
-if [ -f /etc/php.ini ]; then
-    cp /etc/php.ini /etc/php.ini.old
-fi
-cp ../${1}/php.ini-dist /etc/php.ini
-
-# To enable PHP support in the Apache web server, a new AddType directive
-# must be added to the httpd.conf file.
-if ! grep "application/x-httpd-php" /etc/apache/httpd.conf 1> /dev/null 2>&1; then
-    echo "AddType application/x-httpd-php .php" >> /etc/apache/httpd.conf
-fi
-
-if ! grep "DirectoryIndex" /etc/apache/httpd.conf | grep "index.php" 1> /dev/null 2>&1; then
-    sed -i -e "s!\(^DirectoryIndex index.html.*\)!\1 index.php!g" /etc/apache/httpd.conf
-fi
-
-exit $?
+        if ! grep -q "DirectoryIndex" /etc/httpd/httpd.conf | grep "index.php"; then
+            sed -i -e "s!\(^\s*DirectoryIndex index.html.*\)!\1 index.php!g" \
+                /etc/httpd/httpd.conf
+        fi
+    fi
+}