Skip to Content.
Sympa Menu

sm-discuss - [SM-Discuss] php spell rework

sm-discuss AT lists.ibiblio.org

Subject: Public SourceMage Discussion List

List archive

Chronological Thread  
  • From: David Kowis <dkowis AT shlrm.org>
  • To: sm-discuss AT lists.ibiblio.org
  • Subject: [SM-Discuss] php spell rework
  • Date: Wed, 09 Sep 2009 15:05:42 -0500

Because this is a reasonably important spell and because I spent hours
trying to get various configs to work, because the spell was doing some
odd things I have rewritten the spell. Not entirely, but significantly.

I want more people to test this:
http://bugs.sourcemage.org/show_bug.cgi?id=15399

The patch is attached to the bug, and I'll attach it here as well.

Before I shove this into the regular grimoire, I'd like for more people
to test it. I've tested a couple piles of the spell and the dependencies
and configuration options are behaving like they should. I'd like for a
couple other people to test it to be sure it does what they need it to do.

KTHX,
David
diff --git a/php-pear/php/CONFIGURE b/php-pear/php/CONFIGURE
index 87f57c7..b0a85ca 100755
--- a/php-pear/php/CONFIGURE
+++ b/php-pear/php/CONFIGURE
@@ -1,3 +1,13 @@
+. $GRIMOIRE/config_query_multi.function &&
+message "${MESSAGE_COLOR}PEAR support will enable the CLI version and force
depends on libxml2" &&
+message "It will also enable some PCRE support (internal
reccomended)${DEFAULT_COLOR}" &&
+# prior pear enabledness
+if list_find "$PHP5_OPTS" "--enable-pear=${INSTALL_ROOT}/usr/share/pear" ;
then
+ PHP5_PEAR="y"
+fi &&
+
+config_query PHP5_PEAR "Do you want PEAR support?" y &&
+
config_query_option PHP5_OPTS "Enable IPv6?" n \
"--enable-ipv6" "--disable-ipv6" &&

@@ -13,7 +23,7 @@ config_query_option PHP5_OPTS "Enable FTP support?" y \
config_query_option PHP5_OPTS "Enable calendar support?" y \
"--enable-calendar" "--disable-calendar" &&

-config_query_option PHP5_OPTS "Enable pcntl support (CLI/CGI only)" n \
+config_query_option PHP5_OPTS "Enable pcntl support (Only affects CLI/CGI)"
n \
"--enable-pcntl" "--disable-pcntl" &&

message "${MESSAGE_COLOR}Both FastCGI and CGI can be enabled at the same
time${DEFAULT_COLOR}" &&
@@ -24,26 +34,67 @@ config_query_option PHP5_OPTS "Enable FastCGI SAPI?" n \
config_query_option PHP5_OPTS "Enable CGI SAPI?" y \
"--enable-cgi" "--disable-cgi" &&

-config_query_option PHP5_OPTS "Enable CLI version? (needed for PEAR and
CGI/FastCGI)" y \
- "--enable-cli" "--disable-cli" &&
+if [[ "${PHP5_PEAR}" == "y" ]] || list_find "$PHP5_OPTS" "--enable-cgi" ||
list_find "$PHP5_OPTS" "--enable-fastcgi" ; then
+ message "${MESSAGE_COLOR}Enabling CLI version for PEAR/CGI/FastCGI
support${DEFAULT_COLOR}" &&
+ PHP5_OPTS="$PHP5_OPTS --enable-cli"
+else
+ config_query_option PHP5_OPTS "Enable CLI version?" y \
+ "--enable-cli" "--disable-cli"
+fi &&

config_query_option PHP5_OPTS "Enable multibyte support?" n \
"--enable-mbstring --enable-mbregex" \
"--disable-mbstring --disable-mbregex" &&

-config_query_option PHP5_OPTS "Enable the DBA database drivers?
(qdbm/gdbm/db/flatfile)" n \
- "--enable-dba" "--disable-dba" &&
+message "${MESSAGE_COLOR}See http://us.php.net/dba.installation for more
info${DEFAULT_COLOR}" &&
+message "${MESSAGE_COLOR}Not recommended: dbm, ndbm. NOTE: qdbm conflicts
with dbm and gdbm${DEFAULT_COLOR}" &&
+config_query_multi PHP5_DBA_DRIVERS "Select dbm-style database drivers (if
any)" none gdbm db4 flatfile inifile qdbm &&
+
+if ! list_find "${PHP5_DBA_DRIVERS}" "none"; then
+ if list_find "${PHP5_DBA_DRIVERS}" "flatfile"; then
+ PHP5_OPTS="$PHP5_OPTS --enable-inifile"
+ fi
+ if list_find "${PHP5_DBA_DRIVERS}" "flatfile"; then
+ PHP5_OPTS="$PHP5_OPTS --enable-flatfile"
+ fi
+fi &&

-if list_find "${PHP5_OPTS}" "--enable-dba"; then
- config_query_option PHP5_OPTS "Enable DBA inifile support?" y \
- "--enable-inifile" "--disable-inifile" &&
- config_query_option PHP5_OPTS "Enable DBA flatfile support?" y \
- "--enable-flatfile" "--disable-flatfile"
+# get the native simple drivers
+local DB_DRIVERS="mysql mysqli pgsql sqlite sqlite3 firebird unixODBC iODBC"
+config_query_multi PHP5_DATABASE_DRIVERS "Select vendor specific database
drivers to install (if any)" \
+ none all $DB_DRIVERS &&
+
+if ! list_find "${PHP5_DATABASE_DRIVERS}" "none"; then
+ PHP5_OPTS="$PHP5_OPTS --enable-dba" &&
+ for foo in $DB_DRIVERS; do
+ if list_find "${PHP5_DATABASE_DRIVERS}" "$foo" || list_find
"${PHP5_DATABASE_DRIVERS}" "all"; then
+ PHP5_OPTS="$PHP5_OPTS --with-$foo"
+ else
+ PHP5_OPTS="$PHP5_OPTS --without-$foo"
+ fi
+ done
fi &&

-config_query_option PHP5_OPTS "Enable the PDO database drivers?
(mysql/postgresql/oracle/*odbc)" y \
+#ask if they want the PDO drivers for the drivers they selected
+config_query_option PHP5_OPTS "Enable PHP Data Objects?" y \
"--enable-pdo" "--disable-pdo" &&

+if list_find "$PHP5_OPTS" "--enable-pdo"; then
+ local PDO_DRIVERS="mysql pgsql firebird unixODBC iODBC" &&
+ for foo in $PDO_DRIVERS; do
+ if list_find "${PHP5_DATABASE_DRIVERS}" "$foo" || list_find
"${PHP5_DATABASE_DRIVERS}" "all"; then
+ # odbc special case
+ if [[ "$foo" == "unixODBC" ]]; then
+ config_query_option PHP5_OPTS "Enable PDO
driver for unixodbc?" n "--with-pdo-odbc=unixODBC,${INSTALL_ROOT}/usr" ""
+ elif [[ "$foo" == "iODBC" ]]; then
+ config_query_option PHP5_OPTS "Enable PDO
driver for libiodbc?" n "--with-pdo-odbc=iODBC,${INSTALL_ROOT}/usr" ""
+ else
+ config_query_option PHP5_OPTS "Enable PDO
driver for $foo?" n "--with-pdo-$foo=${INSTALL_ROOT}/usr" "--without-pdo-$foo"
+ fi
+ fi
+ done
+fi &&
+
config_query_option PHP5_OPTS "Enable shmop support?" n \
"--enable-shmop" "--disable-shmop" &&

@@ -63,4 +114,12 @@ config_query_list PHP5_APACHE "Which Apache module to
build?" \
none handler filter &&

config_query_list PHP5_GD "Which GD library to use?" \
- none internal external
+ none internal external &&
+
+if [[ "$PHP5_PEAR" == "y" ]]; then
+ config_query_list PHP5_PCRE "Which PCRE library to use (internal
reccomended)?" \
+ internal external
+else
+ config_query_list PHP5_PCRE "Which PCRE library to use (internal
reccomended)?" \
+ internal external none
+fi
diff --git a/php-pear/php/DEPENDS b/php-pear/php/DEPENDS
index b967707..bcc89af 100755
--- a/php-pear/php/DEPENDS
+++ b/php-pear/php/DEPENDS
@@ -1,7 +1,19 @@
. ${GRIMOIRE}/FUNCTIONS &&

-depends flex &&
+# takes two params
+# $1 is the driver name
+# $2 is the spell name (for depending)
+function db_driver_depends() {
+ local db_driver="$1"
+ local db_spell="$2"
+ if list_find "$PHP5_DATABASE_DRIVERS" "$db_driver" || list_find
"$PHP5_DATABASE_DRIVERS" "all"; then
+ depends $db_spell "--with-$db_driver"
+ else
+ OPTS="$OPTS --without-$db_driver"
+ fi
+}

+depends flex &&
# Officially these are optional, but we require them because some other
# optional extensions depend on it, and they're omnipresent anyway
depends readline "--with-readline" &&
@@ -11,10 +23,14 @@ optional_depends bzip2 \
"--with-bz2" "--without-bz2" \
"for compression support" &&

-optional_depends libxml2 \
- '--enable-xml --enable-dom --with-xmlrpc' \
- '--disable-xml --disable-dom --without-xmlrpc
--disable-xmlreader --disable-xmlwriter --disable-simplexml' \
- 'For XML support (required for SOAP and PEAR)' &&
+if [[ "$PHP5_PEAR" == "y" ]]; then
+ depends libxml2 '--enable-xml --enable-dom --with-xmlrpc'
+else
+ optional_depends libxml2 \
+ '--enable-xml --enable-dom
--with-xmlrpc' \
+ '--disable-xml --disable-dom
--without-xmlrpc --disable-xmlreader --disable-xmlwriter --disable-simplexml'
\
+ 'For XML support (required for SOAP)'
+fi

optional_depends libxslt \
"--with-xsl" "--without-xsl" \
@@ -22,14 +38,9 @@ optional_depends libxslt \

if is_depends_enabled $SPELL libxml2 ; then
config_query_option PHP5_OPTS "Enable SOAP support?" n \
- "--enable-soap" "--disable-soap" &&
- if list_find "${PHP5_OPTS}" "--enable-cli"; then
- config_query_option PHP5_OPTS "Enable PEAR support?" y \
- "--enable-pear=${INSTALL_ROOT}/usr/share/pear" \
- "--without-pear"
- fi
+ "--enable-soap" "--disable-soap"
else
- PHP5_OPTS="${PHP5_OPTS} --disable-soap --without-pear"
+ PHP5_OPTS="${PHP5_OPTS} --disable-soap"
fi &&

optional_depends pth \
@@ -41,18 +52,27 @@ case "${PHP5_APACHE}" in
filter) depends APACHE2;;
esac &&

-optional_depends pcre \
- "--with-pcre-regex=${INSTALL_ROOT}/usr
--with-pcre=${INSTALL_ROOT}/usr" \
- "--without-pcre-regex --without-pcre" \
- "for perl regular expressions support (required for PEAR)"
&&
+if [[ "$PHP5_PCRE" == "none" ]]; then
+ PHP5_OPTS="$PHP5_OPTS --without-pcre-regex --without-pcre"
+elif [[ "$PHP5_PCRE" == "external" ]]; then
+ depends pcre "--with-pcre-regex=${INSTALL_ROOT}/usr
--with-pcre=${INSTALL_ROOT}/usr"
+fi &&

optional_depends C-CLIENT \
"--with-imap=${INSTALL_ROOT}/usr" "--without-imap" \
"for IMAP support" &&

+optional_depends openssl \
+ "--with-openssl" "--without-openssl" \
+ "for OpenSSL support" &&
+
if list_find "${OPTS}" "--with-imap"; then
- optional_depends openssl "--with-imap-ssl" "--without-imap-ssl" \
- "for SSL support with IMAP"
+ if is_depends_enabled $SPELL openssl; then
+ OPTS="$OPTS --with-imap-ssl"
+ else
+ optional_depends openssl "--with-imap-ssl"
"--without-imap-ssl" \
+ "for SSL
support with IMAP (but not elsewhere)"
+ fi
fi &&

optional_depends MAIL-TRANSPORT-AGENT \
@@ -93,10 +113,6 @@ optional_depends gmp \
"--with-gmp" "--without-gmp" \
"GNU multi-precision library support" &&

-optional_depends openssl \
- "--with-openssl" "--without-openssl" \
- "for OpenSSL support" &&
-
optional_depends krb5 \
"--with-kerberos" "--without-kerberos" \
"for Kerberos support" &&
@@ -110,85 +126,47 @@ optional_depends icu \
"--without-icu-dir" \
"for ICU unicode support" &&

-optional_depends ODBC-MGR "" "" "for ODBC support" &&
-
-case $(get_spell_provider $SPELL ODBC-MGR) in
- unixodbc) OPTS="${OPTS} --with-unixODBC=${INSTALL_ROOT}/usr
--without-iodbc" ;;
- libiodbc) OPTS="${--with-iodbc=${INSTALL_ROOT}}/usr --without-unixODBC" ;;
-esac &&
-
-optional_depends mysql "" "--without-mysql" "for MySQL support" &&
-if is_depends_enabled $SPELL mysql && [[ "${VERSION:0:3}" == "5.3" ]]; then
- config_query PHP5_MYSQLND "Do you want to use the MySQL Native Driver
[mysqlnd]? (experimental)" y &&
-
- if [[ "${PHP5_MYSQLND}" == "y" ]]; then
- PHP5_OPTS="${PHP5_OPTS} --with-mysql=mysqlnd"
- else
- PHP5_OPTS="${PHP5_OPTS} --with-mysql"
- fi
- config_query_option PHP5_OPTS "Do you want to build the MySQLi
extension?" n \
- "--with-mysqli" "--without-mysqli"
-elif is_depends_enabled $SPELL mysql && [[ "${VERSION:0:3}" != "5.3" ]]; then
- PHP5_OPTS="${PHP5_OPTS} --with-mysql"
+# new database madness
+# DB_DRIVERS="mysql mysqli pgsql sqlite sqlite3 firebird unixODBC iODBC"
+# PDO_DRIVERS="mysql pgsql firebird unixODBC iODBC"
+if list_find "$PHP5_DATABASE_DRIVERS" "mysql" || list_find
"$PHP5_DATABASE_DRIVERS" "all"; then
+ depends mysql "" &&
+ if [[ "${VERSION:0:3}" == "5.3" ]]; then
+ config_query PHP5_MYSQLND "Do you want to use the MySQL
Native Driver [mysqlnd]? (expiremental)" n &&
+ if [[ "${PHP5_MYSQLND}" == "y" ]]; then
+ PHP5_OPTS="$PHP5_OPTS --with-mysql=mysqlnd"
+ else
+ PHP5_OPTS="$PHP5_OPTS --with-mysql"
+ fi
+ fi
+else
+ OPTS="$OPTS --without-mysql"
fi &&
-
-optional_depends postgresql \
- "--with-pgsql" "--without-pgsql" \
- "for native Postgresql support" &&
-
-optional_depends sqlite \
- "--with-sqlite3=${INSTALL_ROOT}/usr --enable-sqlite-utf8"
"--without-sqlite" \
- "for SQLite support" &&
-
-if list_find "${PHP5_OPTS}" "--enable-pdo"; then
-
- if is_depends_enabled $SPELL postgresql ; then
- config_query_option PHP5_OPTS "Do you want to build the SQLite PDO
driver?" y \
- "--with-pdo-sqlite=${INSTALL_ROOT}/usr"
"--without-pdo-sqlite"
- fi &&
- optional_depends firebird \
- "--with-pdo-firebird=${INSTALL_ROOT}/opt/firebird"
"--without-pdo-firebird" \
- "for native Firebird support" &&
-
- if is_depends_enabled $SPELL postgresql ; then
- config_query_option PHP5_OPTS "Do you also want to build the PostgreSQL
PDO driver?" n \
- "--with-pdo-pgsql" "--without-pdo-pgsql"
- fi &&
-
- if is_depends_enabled $SPELL mysql ; then
- if [[ "${VERSION:0:3}" == "5.3" ]] && [[ "${PHP5_MYSQLND}" == "y" ]];
then
- config_query_option PHP5_OPTS "Do you also want to build the MySQL
PDO driver?" n \
- "--with-pdo-mysql=mysqlnd" "--without-pdo-mysql"
- else
- config_query_option PHP5_OPTS "Do you also want to build the MySQL
PDO driver?" n \
- "--with-pdo-mysql" "--without-pdo-mysql"
- fi
- fi &&
-
- case $(get_spell_provider $SPELL ODBC-MGR) in
- unixodbc) config_query_option PHP5_OPTS \
- "Do you also want to build the unixODBC PDO driver?"
n \
- "--with-pdo-odbc=unixODBC,${INSTALL_ROOT}/usr" \
- "--without-pdo-odbc" ;;
- libiodbc) config_query_option PHP5_OPTS \
- "Do you also want to build the iODBC PDO driver?" n \
- "--with-pdo-odbc=iODBC,${INSTALL_ROOT}/usr" \
- "--without-pdo-odbc" ;;
- esac
+db_driver_depends "mysqli" "mysql" &&
+db_driver_depends "pgsql" "postgresql" &&
+db_driver_depends "sqlite" "sqlite2" &&
+db_driver_depends "sqlite3" "sqlite" &&
+db_driver_depends "firebird" "firebird" &&
+# unixODBC and iODBC are mutually exclusive... first one in wins?
+if list_find "$PHP5_DATABASE_DRIVERS" "unixODBC" || list_find
"$PHP5_DATABASE_DRIVERS" "all"; then
+ depends unixodbc "--with-unixODBC=${INSTALL_ROOT}/usr --without-iodbc"
+elif list_find "$PHP5_DATABASE_DRIVERS" "iODBC"; then
+ depends unixodbc "--with-iodbc=${INSTALL_ROOT}/usr --without-unixODBC"
+else
+ OPTS="$OPTS --without-iodbc --without-unixODBC"
fi &&
+#ND

+#DBA drivers
if list_find "${PHP5_OPTS}" "--enable-dba"; then
- optional_depends qdbm \
- "--with-qdbm" "--without-qdbm" \
- "qdbm database routines" &&
-
- optional_depends db \
- "--with-db4" "--without-db4" \
- "qdbm database routines" &&
-
- optional_depends gdbm \
- "--with-gdbm" "--without-gdbm" \
- "database routines that use extensive hashing"
+ for foo in $PHP5_DBA_DRIVERS; do
+ # handle the few special cases
+ if [[ "$foo" == "db4" ]]; then
+ depends db "--with-db4"
+ elif [[ "$foo" != "flatfile" ]] && [[ "$foo" != "inifile" ]];
then
+ depends $foo "--with-$foo"
+ fi
+ done
fi &&

optional_depends openldap \
diff --git a/php-pear/php/INSTALL b/php-pear/php/INSTALL
index 58b5fd3..b0a19c9 100755
--- a/php-pear/php/INSTALL
+++ b/php-pear/php/INSTALL
@@ -1,3 +1,7 @@
default_install &&

-install_config_file php.ini-production /etc/php.ini
+if [[ "${VERSION:0:3}" == "5.3" ]]; then
+ install_config_file $SOURCE_DIRECTORY/php.ini-production /etc/php.ini
+else
+ install_config_file $SOURCE_DIRECTORY/php.ini-recommended /etc/php.ini
+fi

Attachment: signature.asc
Description: OpenPGP digital signature




Archive powered by MHonArc 2.6.24.

Top of Page