[PATCH] Support for SPL (Standard PHP Library)
[openwrt/svn-archive/archive.git] / lang / php5 / Makefile
index af9de6b1d962d6f81c21d20db807b73d64c28fdf..2af653e2b88a9383a79735d1e110d7a7ed458cc2 100644 (file)
@@ -1,75 +1,95 @@
 # 
-# Copyright (C) 2006 OpenWrt.org
+# Copyright (C) 2006,2007 OpenWrt.org
 #
 # This is free software, licensed under the GNU General Public License v2.
 # See /LICENSE for more information.
 #
-# $Id$
 
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=php
-PKG_VERSION:=5.0.5
-PKG_RELEASE:=1
+PKG_VERSION:=5.2.6
+PKG_RELEASE:=2
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
-PKG_SOURCE_URL:=http://fr.php.net/distributions/
-PKG_MD5SUM:=b5d4ca75bbb11ee5b830fa67213d9f7f
-PKG_CAT:=bzcat
-
-PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
+PKG_SOURCE_URL:=http://www.php.net/distributions/
+PKG_MD5SUM:=7380ffecebd95c6edb317ef861229ebd
 
 include $(INCLUDE_DIR)/package.mk
 
 define Package/php5/Default
+  SUBMENU:=PHP
   SECTION:=lang
   CATEGORY:=Languages
   TITLE:=PHP5 Hypertext preprocessor
-  DESCRIPTION:=\
-       PHP is a widely-used general-purpose scripting language that is especially \\\
-       suited for Web development and can be embedded into HTML.
   URL:=http://www.php.net/
 endef
 
+define Package/php5/Default/description
+ PHP is a widely-used general-purpose scripting language that is especially 
+ suited for Web development and can be embedded into HTML.
+endef
+
+define Package/php5/config
+       choice
+               prompt "PHP5 SPL Options"
+               default PACKAGE_php5_without_spl
+
+       config PACKAGE_php5_with_spl
+               bool "With SPL (and pcre) static"
+
+       config PACKAGE_php5_without_spl
+               bool "without SPL (pcre may be enabled)"
+       endchoice
+endef
+
 define Package/php5
   $(call Package/php5/Default)
-  DEPENDS:=+libopenssl +zlib
-  DESCRIPTION+=\\\
-       \\\
-       This package contains only the PHP config file. You must actually choose your \\\
-       PHP flavour (cli, cgi or fastcgi).
-  MENU:=1
+       ifneq ($(CONFIG_PACKAGE_php5_with_spl),)
+               DEPENDS:=+libopenssl +zlib
+               CONFIG_PACKAGE_php5-mod-pcre:=
+       else
+               DEPENDS:=+libopenssl +zlib +libpcre
+       endif
 endef
 
-define Package/php5/conffiles
-/etc/php.ini
+define Package/php5/description
+$(call Package/php5/Default/description)
+ This package contains only the PHP config file. You must actually choose 
+ your PHP flavour (cli, cgi or fastcgi).
 endef
 
 define Package/php5-cli
   $(call Package/php5/Default)
   DEPENDS:=php5
   TITLE+= (CLI)
-  DESCRIPTION+=\\\
-       \\\
-       This package contains the CLI version of the PHP5 interpreter.
+endef
+
+define Package/php5-cli/description
+$(call Package/php5/Default/description)
+ This package contains the CLI version of the PHP5 interpreter.
 endef
 
 define Package/php5-cgi
   $(call Package/php5/Default)
   DEPENDS:=php5
   TITLE+= (CGI)
-  DESCRIPTION+=\\\
-       \\\
-       This package contains the CGI version of the PHP5 interpreter.
+endef
+
+define Package/php5-cgi/description
+$(call Package/php5/Default/description)
+ This package contains the CGI version of the PHP5 interpreter.
 endef
 
 define Package/php5-fastcgi
   $(call Package/php5/Default)
   DEPENDS:=php5
   TITLE+= (FastCGI)
-  DESCRIPTION+=\\\
-       \\\
-       This package contains the FastCGI version of the PHP5 interpreter.
+endef
+
+define Package/php5-fastcgi/description
+$(call Package/php5/Default/description)
+ This package contains the FastCGI version of the PHP5 interpreter.
 endef
 
 define Package/php5-mod-curl
@@ -98,7 +118,7 @@ endef
 
 define Package/php5-mod-ldap
   $(call Package/php5/Default)
-  DEPENDS:=php5 +libopenldap
+  DEPENDS:=php5 +libopenldap +libsasl2
   TITLE:=LDAP module
 endef
 
@@ -144,12 +164,36 @@ define Package/php5-mod-sqlite
   TITLE:=SQLite module
 endef
 
+define Package/php5-mod-pdo
+  $(call Package/php5/Default)
+  DEPENDS:=php5
+  TITLE:=PHP Data Objects module
+endef
+
+define Package/php5-mod-pdo-sqlite
+  $(call Package/php5/Default)
+  DEPENDS:=php5-mod-pdo +libsqlite3
+  TITLE:=PHP Data Objects module - SQLite support
+endef
+
 define Package/php5-mod-xml
   $(call Package/php5/Default)
   DEPENDS:=php5 +libexpat
   TITLE:=XML module
 endef
 
+define Package/php5-mod-apc
+  $(call Package/php5/Default)
+  DEPENDS:=php5
+  TITLE:=APC Extension
+endef
+
+define Package/php5-mod-exif
+  $(call Package/php5/Default)
+  DEPENDS:=php5
+  TITLE:=EXIF Extension
+endef
+
 PKG_CONFIGURE_LIBS:= -lcrypto -lssl
 PKG_CONFIGURE_OPTS:= \
        --enable-shared \
@@ -157,7 +201,6 @@ PKG_CONFIGURE_OPTS:= \
        --disable-rpath \
        --disable-debug \
        --without-pear \
-       --disable-spl \
        \
        --with-config-file-path=/etc \
        --disable-ipv6 \
@@ -172,6 +215,8 @@ PKG_CONFIGURE_OPTS:= \
        --without-iconv \
        --disable-libxml \
          --without-libxml-dir \
+       --disable-xmlreader \
+       --disable-xmlwriter \
        --disable-mbstring \
        --disable-mbregex \
        --with-openssl=shared,"$(STAGING_DIR)/usr" \
@@ -184,9 +229,10 @@ PKG_CONFIGURE_OPTS:= \
        --disable-tokenizer \
        --with-zlib="$(STAGING_DIR)/usr" \
          --with-zlib-dir="$(STAGING_DIR)/usr" \
+       --disable-filter
 
 ifneq ($(SDK),)
-  PKG_BUILDDEP:=libopenssl zlib libcurl libgd libgmp libopenldap libmysqlclient libpq libsqlite2 libexpat
+  PKG_BUILD_DEPENDS:=libopenssl zlib libcurl libgd libgmp libopenldap libmysqlclient libpq libsqlite2 libexpat
 # force PKG_CONFIGURE_{LIBS,OPTS} below when built in the SDK
   CONFIG_PACKAGE_php5-cli:=m
   CONFIG_PACKAGE_php5-cgi:=m
@@ -196,7 +242,11 @@ ifneq ($(SDK),)
   CONFIG_PACKAGE_php5-mod-gmp:=m
   CONFIG_PACKAGE_php5-mod-ldap:=m
   CONFIG_PACKAGE_php5-mod-mysql:=m
-  CONFIG_PACKAGE_php5-mod-pcre:=m
+  ifneq ($(CONFIG_PACKAGE_php5_with_spl),)
+       CONFIG_PACKAGE_php5-mod-pcre:=n
+  else
+       CONFIG_PACKAGE_php5-mod-pcre:=m
+  endif
   CONFIG_PACKAGE_php5-mod-pgsql:=m
   CONFIG_PACKAGE_php5-mod-sqlite:=m
   CONFIG_PACKAGE_php5-mod-xml:=m
@@ -214,7 +264,7 @@ ifneq ($(CONFIG_PACKAGE_php5-mod-gd),)
        --with-png-dir="$(STAGING_DIR)/usr" \
        --without-xpm-dir \
        --without-ttf \
-       --without-t1lib \
+       --without-t1lib \
        --enable-gd-native-ttf \
        --disable-gd-jis-conv
 else
@@ -236,11 +286,17 @@ ifneq ($(CONFIG_PACKAGE_php5-mod-mysql),)
 else
   PKG_CONFIGURE_OPTS+= --without-mysql
 endif
+ifneq ($(CONFIG_PACKAGE_php5_with_spl),)
+  PKG_CONFIGURE_OPTS+= --with-pcre-dir="$(STAGING_DIR)/usr"
+  PKG_CONFIGURE_OPTS+= --enable-spl
+else
+  PKG_CONFIGURE_OPTS+= --disable-spl
 ifneq ($(CONFIG_PACKAGE_php5-mod-pcre),)
   PKG_CONFIGURE_OPTS+= --with-pcre-regex=shared,"$(STAGING_DIR)/usr"
 else
   PKG_CONFIGURE_OPTS+= --without-pcre-regex
 endif
+endif
 ifneq ($(CONFIG_PACKAGE_php5-mod-pgsql),)
   PKG_CONFIGURE_OPTS+= --with-pgsql=shared,"$(STAGING_DIR)/usr"
 else
@@ -251,12 +307,31 @@ ifneq ($(CONFIG_PACKAGE_php5-mod-sqlite),)
 else
   PKG_CONFIGURE_OPTS+= --without-sqlite
 endif
+ifneq ($(CONFIG_PACKAGE_php5-mod-pdo),)
+  PKG_CONFIGURE_OPTS+= --enable-pdo=shared
+  ifneq ($(CONFIG_PACKAGE_php5-mod-pdo-sqlite),)
+    PKG_CONFIGURE_OPTS+= --with-pdo-sqlite=shared,"$(STAGING_DIR)/usr"
+  endif
+else
+  PKG_CONFIGURE_OPTS+= --disable-pdo
+endif
 ifneq ($(CONFIG_PACKAGE_php5-mod-xml),)
   PKG_CONFIGURE_OPTS+= --enable-xml=shared,"$(STAGING_DIR)/usr" \
        --with-libexpat-dir="$(STAGING_DIR)/usr"
 else
   PKG_CONFIGURE_OPTS+= --disable-xml
 endif
+ifneq ($(CONFIG_PACKAGE_php5-mod-apc),)
+  PKG_CONFIGURE_OPTS+= --enable-apc --disable-apc-mmap --disable-apc-pthreadmutex
+  PKG_CONFIGURE_LIBS+= -lrt
+else
+  PKG_CONFIGURE_OPTS+= --disable-apc
+endif
+ifneq ($(CONFIG_PACKAGE_php5-mod-exif),)
+  PKG_CONFIGURE_OPTS+= --enable-exif
+else
+  PKG_CONFIGURE_OPTS+= --disable-exif
+endif
 
 define Build/Configure
 endef
@@ -295,13 +370,15 @@ ifneq ($(CONFIG_PACKAGE_php5-cgi),)
                php_cv_cc_rpath="no" \
        )
        $(MAKE) -C $(PKG_BUILD_DIR)
-       mv $(PKG_BUILD_DIR)/sapi/cgi/php $(PKG_BUILD_DIR)/php-cgi
+       mv $(PKG_BUILD_DIR)/sapi/cgi/php-cgi $(PKG_BUILD_DIR)/php-cgi
   endef
 endif
 
 ifneq ($(CONFIG_PACKAGE_php5-fastcgi),)
   define Build/Compile/php5-fastcgi
        -$(MAKE) -C $(PKG_BUILD_DIR) clean
+       rm $(PKG_BUILD_DIR)/configure
+       cd $(PKG_BUILD_DIR) && ./buildconf --force
        $(call Build/Configure/Default, \
                $(PKG_CONFIGURE_OPTS) \
                --disable-cli \
@@ -314,7 +391,7 @@ ifneq ($(CONFIG_PACKAGE_php5-fastcgi),)
                php_cv_cc_rpath="no" \
        )
        $(MAKE) -C $(PKG_BUILD_DIR)
-       mv $(PKG_BUILD_DIR)/sapi/cgi/php $(PKG_BUILD_DIR)/php-fastcgi
+       mv $(PKG_BUILD_DIR)/sapi/cgi/php-cgi $(PKG_BUILD_DIR)/php-fcgi
   endef
 endif
 
@@ -324,6 +401,10 @@ define Build/Compile
        $(call Build/Compile/php5-fastcgi)
 endef
 
+define Package/php5/conffiles
+/etc/php.ini
+endef
+
 define Package/php5/install
        $(INSTALL_DIR) $(1)/etc
        $(INSTALL_DATA) ./files/php.ini $(1)/etc/
@@ -331,17 +412,17 @@ endef
 
 define Package/php5-cli/install
        $(INSTALL_DIR) $(1)/usr/bin
-       $(CP) $(PKG_BUILD_DIR)/php-cli $(1)/usr/bin/php
+       $(CP) $(PKG_BUILD_DIR)/php-cli $(1)/usr/bin/php-cli
 endef
 
 define Package/php5-cgi/install
        $(INSTALL_DIR) $(1)/usr/bin
-       $(CP) $(PKG_BUILD_DIR)/php-cgi $(1)/usr/bin/php
+       $(CP) $(PKG_BUILD_DIR)/php-cgi $(1)/usr/bin/php-cgi
 endef
 
 define Package/php5-fastcgi/install
-       $(INSTALL_DIR) $(1)/usr/sbin
-       $(CP) $(PKG_BUILD_DIR)/php-fastcgi $(1)/usr/sbin/php
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(CP) $(PKG_BUILD_DIR)/php-fcgi $(1)/usr/bin/php-fcgi
        $(INSTALL_DIR) $(1)/etc/init.d
        $(INSTALL_BIN) ./files/php.init $(1)/etc/init.d/php
 endef
@@ -350,7 +431,8 @@ define BuildPlugin
   define Package/$(1)/install
        [ -z "$(2)" ] || $(INSTALL_DIR) $$(1)/usr/lib/php
        for m in $(2); do \
-               $(INSTALL_BIN) $(PKG_BUILD_DIR)/modules/$$$$$$$${m}.so $$(1)/usr/lib/php/ ; \
+               [ -z "$(CONFIG_PACKAGE_$(1))" ] \
+                        || $(INSTALL_BIN) $(PKG_BUILD_DIR)/modules/$$$$$$$${m}.so $$(1)/usr/lib/php/ ; \
        done
   endef
 
@@ -373,4 +455,8 @@ $(eval $(call BuildPlugin,php5-mod-pgsql,pgsql))
 $(eval $(call BuildPlugin,php5-mod-session,session))
 $(eval $(call BuildPlugin,php5-mod-sockets,sockets))
 $(eval $(call BuildPlugin,php5-mod-sqlite,sqlite))
+$(eval $(call BuildPlugin,php5-mod-pdo,pdo))
+$(eval $(call BuildPlugin,php5-mod-pdo-sqlite,pdo_sqlite))
 $(eval $(call BuildPlugin,php5-mod-xml,xml))
+$(eval $(call BuildPlugin,php5-mod-apc))
+$(eval $(call BuildPlugin,php5-mod-exif))