summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--package/Config.in1
-rw-r--r--package/php/Config.in47
-rw-r--r--package/php/php.mk127
3 files changed, 175 insertions, 0 deletions
diff --git a/package/Config.in b/package/Config.in
index cd37c6bac..b180962e4 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -367,6 +367,7 @@ source "package/microperl/Config.in"
source "package/python/Config.in"
source "package/ruby/Config.in"
source "package/tcl/Config.in"
+source "package/php/Config.in"
endif
endmenu
diff --git a/package/php/Config.in b/package/php/Config.in
new file mode 100644
index 000000000..e8e861db4
--- /dev/null
+++ b/package/php/Config.in
@@ -0,0 +1,47 @@
+config BR2_PACKAGE_PHP
+ bool "php"
+ default n
+ help
+ PHP is a widely-used general-purpose scripting
+ language that is especially suited for Web development
+ and can be embedded into HTML.
+
+ http://www.php.net
+
+config BR2_PACKAGE_PHP_CLI
+ bool "cli interface"
+ depends on BR2_PACKAGE_PHP
+ default y
+ help
+ command line interface for php.
+ you must have at least cli or cgi selected.
+
+config BR2_PACKAGE_PHP_CGI
+ bool "cgi interface"
+ depends on BR2_PACKAGE_PHP
+ default y
+ help
+ cgi interface for php
+ you must have at least cli or cgi selected.
+
+config BR2_PACKAGE_PHP_OPENSSL
+ bool "openssl support"
+ depends on BR2_PACKAGE_PHP && BR2_PACKAGE_OPENSSL
+ default y
+ help
+ openssl support
+
+config BR2_PACKAGE_PHP_XML2
+ bool "xml2 support"
+ depends on BR2_PACKAGE_PHP && BR2_PACKAGE_LIBXML2
+ default y
+ help
+ xml support
+
+config BR2_PACKAGE_PHP_ZLIB
+ bool "zlib support"
+ depends on BR2_PACKAGE_PHP && BR2_PACKAGE_ZLIB
+ default y
+ help
+ zlib support
+
diff --git a/package/php/php.mk b/package/php/php.mk
new file mode 100644
index 000000000..cf4422f6f
--- /dev/null
+++ b/package/php/php.mk
@@ -0,0 +1,127 @@
+#############################################################
+#
+# php
+#
+#############################################################
+PHP_VER:=5.2.3
+PHP_SOURCE:=php-$(PHP_VER).tar.bz2
+PHP_SITE:=http://us.php.net/get/${PHP_SOURCE}/from/us2.php.net/mirror
+PHP_DIR:=$(BUILD_DIR)/php-$(PHP_VER)
+PHP_CAT=bzcat
+PHP_DEPS=
+PHP_TARGET_DEPS=
+
+ifneq ($(BR2_PACKAGE_PHP_CLI),y)
+ PHP_CLI="--disable-cli"
+else
+ PHP_CLI="--enable-cli"
+ PHP_TARGET_DEPS+=$(TARGET_DIR)/usr/bin/php
+endif
+
+ifneq ($(BR2_PACKAGE_PHP_CGI),y)
+ PHP_CGI="--disable-cgi"
+else
+ PHP_CGI="--enable-cgi"
+ PHP_TARGET_DEPS+=$(TARGET_DIR)/usr/bin/php-cgi
+endif
+
+ifeq ($(BR2_PACKAGE_PHP_OPENSSL),y)
+ PHP_OPENSSL="--with-openssl=$(STAGING_DIR)/usr"
+ PHP_DEPS+=openssl
+endif
+
+ifeq ($(BR2_PACKAGE_PHP_XML2),y)
+ PHP_XML=--enable-libxml \
+ --with-libxml-dir=${STAGING_DIR}/usr \
+ --enable-xml \
+ --enable-xmlreader \
+ --enable-xmlwriter
+ PHP_DEPS+=libxml2
+endif
+
+ifeq ($(BR2_PACKAGE_PHP_ZLIB),y)
+ PHP_ZLIB="--with-zlib=$(STAGING_DIR)/usr"
+ PHP_DEPS+=zlib
+endif
+
+
+$(DL_DIR)/$(PHP_SOURCE):
+ $(WGET) -P $(DL_DIR) $(PHP_SITE)
+
+php-source: $(DL_DIR)/$(PHP_SOURCE)
+
+$(PHP_DIR)/.unpacked: $(DL_DIR)/$(PHP_SOURCE)
+ $(PHP_CAT) $(DL_DIR)/$(PHP_SOURCE) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) -
+ touch $(PHP_DIR)/.unpacked
+
+$(PHP_DIR)/.configured: $(PHP_DIR)/.unpacked
+ (cd $(PHP_DIR); rm -rf config.cache; \
+ $(TARGET_CONFIGURE_OPTS) \
+ $(TARGET_CONFIGURE_ARGS) \
+ CC=$(TARGET_CC) \
+ ./configure \
+ --target=$(GNU_TARGET_NAME) \
+ --host=$(GNU_TARGET_NAME) \
+ --build=$(GNU_HOST_NAME) \
+ --prefix=/usr \
+ --exec-prefix=/ \
+ --bindir=/usr/bin \
+ --sbindir=/usr/sbin \
+ --libexecdir=/usr/lib \
+ --sysconfdir=/etc \
+ --datadir=/usr/share/misc \
+ --localstatedir=/var \
+ --mandir=/usr/man \
+ --infodir=/usr/info \
+ --disable-all \
+ --enable-spl \
+ --enable-session \
+ --enable-sockets \
+ --with-pcre-regex \
+ --without-pear \
+ --disable-ipv6 \
+ $(DISABLE_NLS) \
+ $(PHP_OPENSSL) \
+ $(PHP_XML) \
+ $(PHP_CLI) \
+ $(PHP_CGI) \
+ $(PHP_ZLIB) \
+ );
+ touch $(PHP_DIR)/.configured
+
+$(PHP_DIR)/.built: $(PHP_DIR)/.configured
+ $(MAKE) CC=$(TARGET_CC) -C $(PHP_DIR)
+ touch $(PHP_DIR)/.built
+
+$(PHP_DIR)/.staged: $(PHP_DIR)/.built
+ $(MAKE) DESTDIR=$(STAGING_DIR) INSTALL_ROOT=$(STAGING_DIR) CC=$(TARGET_CC) -C $(PHP_DIR) install
+ touch $(PHP_DIR)/.staged
+
+$(TARGET_DIR)/usr/bin/php: $(PHP_DIR)/.staged
+ cp -dpf $(STAGING_DIR)/usr/bin/php $(TARGET_DIR)/usr/bin/php
+ chmod 755 $(TARGET_DIR)/usr/bin/php
+
+$(TARGET_DIR)/usr/bin/php-cgi: $(PHP_DIR)/.staged
+ cp -dpf $(STAGING_DIR)/usr/bin/php-cgi $(TARGET_DIR)/usr/bin/php-cgi
+ chmod 755 $(TARGET_DIR)/usr/bin/php-cgi
+
+$(TARGET_DIR)/etc/php.ini: $(PHP_DIR)/.staged
+ cp $(PHP_DIR)/php.ini-dist $(TARGET_DIR)/etc/php.ini
+
+php: uclibc $(PHP_DEPS) $(PHP_TARGET_DEPS) $(TARGET_DIR)/etc/php.ini
+
+php-clean:
+ rm -f $(PHP_DIR)/.configured $(PHP_DIR)/.built $(PHP_DIR)/.staged
+ -$(MAKE) -C $(PHP_DIR) clean
+
+php-dirclean:
+ rm -rf $(PHP_DIR)
+
+#############################################################
+#
+# Toplevel Makefile options
+#
+#############################################################
+ifeq ($(strip $(BR2_PACKAGE_PHP)),y)
+TARGETS+=php
+endif