summaryrefslogtreecommitdiffstats
path: root/package/php/php.mk
diff options
context:
space:
mode:
Diffstat (limited to 'package/php/php.mk')
-rw-r--r--package/php/php.mk36
1 files changed, 34 insertions, 2 deletions
diff --git a/package/php/php.mk b/package/php/php.mk
index 47811fff76..c9bcfe30ed 100644
--- a/package/php/php.mk
+++ b/package/php/php.mk
@@ -4,7 +4,8 @@
#
################################################################################
-PHP_VERSION = 5.6.8
+PHP_VERSION_MAJOR = 5.6
+PHP_VERSION = $(PHP_VERSION_MAJOR).9
PHP_SITE = http://www.php.net/distributions
PHP_SOURCE = php-$(PHP_VERSION).tar.xz
PHP_INSTALL_STAGING = YES
@@ -24,6 +25,10 @@ PHP_CONF_ENV = \
ac_cv_func_strcasestr=yes \
EXTRA_LIBS="$(PHP_EXTRA_LIBS)"
+ifeq ($(BR2_STATIC_LIBS),y)
+PHP_CONF_ENV += LIBS="$(PHP_STATIC_LIBS)"
+endif
+
ifeq ($(BR2_TARGET_LOCALTIME),)
PHP_LOCALTIME = UTC
else
@@ -109,6 +114,9 @@ endif
ifeq ($(BR2_PACKAGE_PHP_EXT_OPENSSL),y)
PHP_CONF_OPTS += --with-openssl=$(STAGING_DIR)/usr
PHP_DEPENDENCIES += openssl
+# openssl needs zlib, but the configure script forgets to link against
+# it causing detection failures with static linking
+PHP_STATIC_LIBS += $(shell $(PKG_CONFIG_HOST_BINARY) --libs --static openssl)
endif
ifeq ($(BR2_PACKAGE_PHP_EXT_LIBXML2),y)
@@ -179,6 +187,7 @@ endif
ifeq ($(BR2_PACKAGE_PHP_EXT_SQLITE),y)
PHP_CONF_OPTS += --with-sqlite3=$(STAGING_DIR)/usr
PHP_DEPENDENCIES += sqlite
+PHP_STATIC_LIBS += $(shell $(PKG_CONFIG_HOST_BINARY) --libs --static sqlite3)
endif
### PDO
@@ -200,13 +209,31 @@ endif
ifeq ($(BR2_PACKAGE_PHP_EXT_PDO_UNIXODBC),y)
PHP_CONF_OPTS += --with-pdo-odbc=unixODBC,$(STAGING_DIR)/usr
PHP_DEPENDENCIES += unixodbc
+ifeq ($(BR2_STATIC_LIBS)$(BR2_TOOLCHAIN_HAS_THREADS),yy)
+PHP_STATIC_LIBS += -lpthread
endif
endif
+endif
+
+define PHP_DISABLE_PCRE_JIT
+ $(SED) '/^#define SUPPORT_JIT/d' $(@D)/ext/pcre/pcrelib/config.h
+endef
### Use external PCRE if it's available
ifeq ($(BR2_PACKAGE_PCRE),y)
PHP_CONF_OPTS += --with-pcre-regex=$(STAGING_DIR)/usr
PHP_DEPENDENCIES += pcre
+else
+# The bundled pcre library is not configurable through ./configure options,
+# and by default is configured to be thread-safe, so it wants pthreads. So
+# we must explicitly tell it when we don't have threads.
+ifeq ($(BR2_TOOLCHAIN_HAS_THREADS),)
+PHP_CFLAGS += -DSLJIT_SINGLE_THREADED=1
+endif
+# check ext/pcre/pcrelib/sljit/sljitConfigInternal.h for supported archs
+ifeq ($(BR2_i386)$(BR2_x86_64)$(BR2_arm)$(BR2_armeb)$(BR2_aarch64)$(BR2_mips)$(BR2_mipsel)$(BR2_mips64)$(BR2_mips64el)$(BR2_powerpc)$(BR2_sparc),)
+PHP_POST_CONFIGURE_HOOKS += PHP_DISABLE_PCRE_JIT
+endif
endif
ifeq ($(BR2_PACKAGE_PHP_EXT_CURL),y)
@@ -275,6 +302,8 @@ define PHP_INSTALL_FPM_CONF
$(INSTALL) -D -m 0644 package/php/php-fpm.conf \
$(TARGET_DIR)/etc/php-fpm.conf
rm -f $(TARGET_DIR)/etc/php-fpm.conf.default
+ # remove unused sample status page /usr/php/php/fpm/status.html
+ rm -rf $(TARGET_DIR)/usr/php
endef
PHP_POST_INSTALL_TARGET_HOOKS += PHP_INSTALL_FPM_CONF
@@ -290,12 +319,15 @@ endef
PHP_POST_INSTALL_TARGET_HOOKS += PHP_EXTENSIONS_FIXUP
define PHP_INSTALL_FIXUP
- rm -rf $(TARGET_DIR)/usr/lib/php
+ rm -rf $(TARGET_DIR)/usr/lib/php/build
rm -f $(TARGET_DIR)/usr/bin/phpize
$(INSTALL) -D -m 0755 $(PHP_DIR)/php.ini-production \
$(TARGET_DIR)/etc/php.ini
$(SED) 's%;date.timezone =.*%date.timezone = $(PHP_LOCALTIME)%' \
$(TARGET_DIR)/etc/php.ini
+ $(if $(BR2_PACKAGE_PHP_EXT_OPCACHE),
+ $(SED) '/;extension=php_xsl.dll/azend_extension=opcache.so' \
+ $(TARGET_DIR)/etc/php.ini)
endef
PHP_POST_INSTALL_TARGET_HOOKS += PHP_INSTALL_FIXUP
OpenPOWER on IntegriCloud