From f8ae38678956a90a43d878868638b09994c80e45 Mon Sep 17 00:00:00 2001 From: Fredrik Fornwall Date: Sun, 11 Mar 2018 00:50:15 +0100 Subject: [PATCH] php: Fix opcache by using MAP_ANON support The ext/opcache/config.m4 disabled MAP_ANON when cross compiling. Fixes #2234. --- packages/php/build.sh | 2 +- packages/php/ext-opcache-config.m4.patch | 19 +++++++++++++++---- .../php/ext-opcache-zend_accelerator_module.c.patch | 12 ++++++++++++ 3 files changed, 28 insertions(+), 5 deletions(-) create mode 100644 packages/php/ext-opcache-zend_accelerator_module.c.patch diff --git a/packages/php/build.sh b/packages/php/build.sh index 37b1a0b5..bbce86ed 100644 --- a/packages/php/build.sh +++ b/packages/php/build.sh @@ -1,7 +1,7 @@ TERMUX_PKG_HOMEPAGE=https://php.net TERMUX_PKG_DESCRIPTION="Server-side, HTML-embedded scripting language" TERMUX_PKG_VERSION=7.2.3 -TERMUX_PKG_REVISION=1 +TERMUX_PKG_REVISION=2 TERMUX_PKG_SHA256=b3a94f1b562f413c0b96f54bc309706d83b29ac65d9b172bc7ed9fb40a5e651f TERMUX_PKG_SRCURL=http://www.php.net/distributions/php-${TERMUX_PKG_VERSION}.tar.xz # Build native php for phar to build (see pear-Makefile.frag.patch): diff --git a/packages/php/ext-opcache-config.m4.patch b/packages/php/ext-opcache-config.m4.patch index 34c118c4..c84f79d4 100644 --- a/packages/php/ext-opcache-config.m4.patch +++ b/packages/php/ext-opcache-config.m4.patch @@ -1,7 +1,18 @@ diff -u -r ../php-7.2.3/ext/opcache/config.m4 ./ext/opcache/config.m4 --- ../php-7.2.3/ext/opcache/config.m4 2018-02-27 16:33:06.000000000 +0000 -+++ ./ext/opcache/config.m4 2018-03-10 22:37:13.039992109 +0000 -@@ -358,7 +358,15 @@ ++++ ./ext/opcache/config.m4 2018-03-10 23:38:51.259947633 +0000 +@@ -147,7 +147,9 @@ + } + ],dnl + AC_DEFINE(HAVE_SHM_MMAP_ANON, 1, [Define if you have mmap(MAP_ANON) SHM support]) +- msg=yes,msg=no,msg=no) ++ msg=yes,msg=no, ++ AC_DEFINE(HAVE_SHM_MMAP_ANON, 1, [Define if you have mmap(MAP_ANON) SHM support]) ++ msg=yes) + AC_MSG_RESULT([$msg]) + + AC_MSG_CHECKING(for mmap() using /dev/zero shared memory support) +@@ -358,7 +360,15 @@ flock_type=linux AC_DEFINE([HAVE_FLOCK_LINUX], [], [Struct flock is Linux-type]) AC_MSG_RESULT("yes") @@ -18,7 +29,7 @@ diff -u -r ../php-7.2.3/ext/opcache/config.m4 ./ext/opcache/config.m4 AC_MSG_CHECKING("whether flock struct is BSD ordered") AC_TRY_RUN([ -@@ -374,7 +382,13 @@ +@@ -374,7 +384,13 @@ flock_type=bsd AC_DEFINE([HAVE_FLOCK_BSD], [], [Struct flock is BSD-type]) AC_MSG_RESULT("yes") @@ -33,7 +44,7 @@ diff -u -r ../php-7.2.3/ext/opcache/config.m4 ./ext/opcache/config.m4 if test "$flock_type" = "unknown"; then AC_MSG_ERROR([Don't know how to define struct flock on this system[,] set --enable-opcache=no]) -@@ -417,6 +431,9 @@ +@@ -417,6 +433,9 @@ Optimizer/zend_dump.c, shared,,-DZEND_ENABLE_STATIC_TSRMLS_CACHE=1,,yes) diff --git a/packages/php/ext-opcache-zend_accelerator_module.c.patch b/packages/php/ext-opcache-zend_accelerator_module.c.patch new file mode 100644 index 00000000..027d4809 --- /dev/null +++ b/packages/php/ext-opcache-zend_accelerator_module.c.patch @@ -0,0 +1,12 @@ +diff -u -r ../php-7.2.3/ext/opcache/zend_accelerator_module.c ./ext/opcache/zend_accelerator_module.c +--- ../php-7.2.3/ext/opcache/zend_accelerator_module.c 2018-02-27 16:33:06.000000000 +0000 ++++ ./ext/opcache/zend_accelerator_module.c 2018-03-10 23:43:52.824368199 +0000 +@@ -308,7 +308,7 @@ + STD_PHP_INI_ENTRY("opcache.restrict_api" , "" , PHP_INI_SYSTEM, OnUpdateString, accel_directives.restrict_api, zend_accel_globals, accel_globals) + + #ifndef ZEND_WIN32 +- STD_PHP_INI_ENTRY("opcache.lockfile_path" , "/tmp" , PHP_INI_SYSTEM, OnUpdateString, accel_directives.lockfile_path, zend_accel_globals, accel_globals) ++ STD_PHP_INI_ENTRY("opcache.lockfile_path" , "@TERMUX_PREFIX@/tmp" , PHP_INI_SYSTEM, OnUpdateString, accel_directives.lockfile_path, zend_accel_globals, accel_globals) + #else + STD_PHP_INI_ENTRY("opcache.mmap_base", NULL, PHP_INI_SYSTEM, OnUpdateString, accel_directives.mmap_base, zend_accel_globals, accel_globals) + #endif -- 2.11.0