php5: add php5-mod-opcache (fixes #1010)
This patch adds build infrastructure for PHP's OPcache extension. Compared with the other extension, this is a Zend module and it need a little workaround during cross-compiling. Signed-off-by: Michael Heimpold <mhei@heimpold.de>
This commit is contained in:
parent
f04165e4e0
commit
f0a0448857
3 changed files with 182 additions and 2 deletions
|
@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=php
|
PKG_NAME:=php
|
||||||
PKG_VERSION:=5.6.8
|
PKG_VERSION:=5.6.8
|
||||||
PKG_RELEASE:=1
|
PKG_RELEASE:=2
|
||||||
|
|
||||||
PKG_MAINTAINER:=W. Michael Petullo <mike@flyn.org>
|
PKG_MAINTAINER:=W. Michael Petullo <mike@flyn.org>
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ PHP5_MODULES = \
|
||||||
json \
|
json \
|
||||||
ldap \
|
ldap \
|
||||||
mbstring mcrypt mysql mysqli \
|
mbstring mcrypt mysql mysqli \
|
||||||
openssl \
|
opcache openssl \
|
||||||
pcntl pdo pdo-mysql pdo-pgsql pdo-sqlite pgsql \
|
pcntl pdo pdo-mysql pdo-pgsql pdo-sqlite pgsql \
|
||||||
session shmop simplexml soap sockets sqlite3 sysvmsg sysvsem sysvshm \
|
session shmop simplexml soap sockets sqlite3 sysvmsg sysvsem sysvshm \
|
||||||
tokenizer \
|
tokenizer \
|
||||||
|
@ -276,6 +276,12 @@ else
|
||||||
CONFIGURE_ARGS+= --without-mysqli
|
CONFIGURE_ARGS+= --without-mysqli
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-opcache),)
|
||||||
|
CONFIGURE_ARGS+= --enable-opcache=shared
|
||||||
|
else
|
||||||
|
CONFIGURE_ARGS+= --disable-opcache
|
||||||
|
endif
|
||||||
|
|
||||||
ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-openssl),)
|
ifneq ($(SDK)$(CONFIG_PACKAGE_php5-mod-openssl),)
|
||||||
CONFIGURE_ARGS+= \
|
CONFIGURE_ARGS+= \
|
||||||
--with-openssl=shared,"$(STAGING_DIR)/usr" \
|
--with-openssl=shared,"$(STAGING_DIR)/usr" \
|
||||||
|
@ -508,7 +514,11 @@ define BuildModule
|
||||||
$(INSTALL_DIR) $$(1)/usr/lib/php
|
$(INSTALL_DIR) $$(1)/usr/lib/php
|
||||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/modules/$(subst -,_,$(1)).so $$(1)/usr/lib/php/
|
$(INSTALL_BIN) $(PKG_BUILD_DIR)/modules/$(subst -,_,$(1)).so $$(1)/usr/lib/php/
|
||||||
$(INSTALL_DIR) $$(1)/etc/php5
|
$(INSTALL_DIR) $$(1)/etc/php5
|
||||||
|
ifeq ($(4),zend)
|
||||||
|
echo "zend_extension=/usr/lib/php/$(subst -,_,$(1)).so" > $$(1)/etc/php5/$(subst -,_,$(1)).ini
|
||||||
|
else
|
||||||
echo "extension=$(subst -,_,$(1)).so" > $$(1)/etc/php5/$(subst -,_,$(1)).ini
|
echo "extension=$(subst -,_,$(1)).so" > $$(1)/etc/php5/$(subst -,_,$(1)).ini
|
||||||
|
endif
|
||||||
endef
|
endef
|
||||||
|
|
||||||
$$(eval $$(call BuildPackage,php5-mod-$(1)))
|
$$(eval $$(call BuildPackage,php5-mod-$(1)))
|
||||||
|
@ -540,6 +550,7 @@ $(eval $(call BuildModule,mbstring,MBString))
|
||||||
$(eval $(call BuildModule,mcrypt,Mcrypt,+PACKAGE_php5-mod-mcrypt:libmcrypt +PACKAGE_php5-mod-mcrypt:libltdl))
|
$(eval $(call BuildModule,mcrypt,Mcrypt,+PACKAGE_php5-mod-mcrypt:libmcrypt +PACKAGE_php5-mod-mcrypt:libltdl))
|
||||||
$(eval $(call BuildModule,mysql,MySQL,+PACKAGE_php5-mod-mysql:libmysqlclient))
|
$(eval $(call BuildModule,mysql,MySQL,+PACKAGE_php5-mod-mysql:libmysqlclient))
|
||||||
$(eval $(call BuildModule,mysqli,MySQL Improved Extension,+PACKAGE_php5-mod-mysqli:libmysqlclient))
|
$(eval $(call BuildModule,mysqli,MySQL Improved Extension,+PACKAGE_php5-mod-mysqli:libmysqlclient))
|
||||||
|
$(eval $(call BuildModule,opcache,OPcache,,zend))
|
||||||
$(eval $(call BuildModule,openssl,OpenSSL,+PACKAGE_php5-mod-openssl:libopenssl))
|
$(eval $(call BuildModule,openssl,OpenSSL,+PACKAGE_php5-mod-openssl:libopenssl))
|
||||||
$(eval $(call BuildModule,pcntl,PCNTL))
|
$(eval $(call BuildModule,pcntl,PCNTL))
|
||||||
$(eval $(call BuildModule,pdo,PHP Data Objects))
|
$(eval $(call BuildModule,pdo,PHP Data Objects))
|
||||||
|
|
|
@ -309,3 +309,13 @@ ldap.max_links = -1
|
||||||
[mcrypt]
|
[mcrypt]
|
||||||
;mcrypt.algorithms_dir=
|
;mcrypt.algorithms_dir=
|
||||||
;mcrypt.modes_dir=
|
;mcrypt.modes_dir=
|
||||||
|
|
||||||
|
[opcache]
|
||||||
|
;opcache.memory_consumption=8 ; 8M is the allowed minimum
|
||||||
|
;opcache.interned_strings_buffer=1
|
||||||
|
opcache.max_accelerated_files=200 ; 200 is the allowed minimum
|
||||||
|
;opcache.revalidate_freq=60
|
||||||
|
;opcache.fast_shutdown=1
|
||||||
|
opcache.enable_cli=1
|
||||||
|
opcache.enable=1
|
||||||
|
;opcache.log_verbosity_level=4
|
||||||
|
|
|
@ -0,0 +1,159 @@
|
||||||
|
From dc8bb6a53bfdfe42d9ae81d4e78c6155ad4bfd6e Mon Sep 17 00:00:00 2001
|
||||||
|
From: Michael Heimpold <mhei@heimpold.de>
|
||||||
|
Date: Sun, 17 May 2015 16:50:50 +0200
|
||||||
|
Subject: [PATCH] ext/opcache: fix detection of shm/mmap
|
||||||
|
|
||||||
|
The detection of sysvipc and mmap doesn't work well when cross-compiling,
|
||||||
|
so I decided to only check for the availability of the functions involved.
|
||||||
|
This is not a clean solution, but works for now(tm) :-)
|
||||||
|
|
||||||
|
It should be discussed with upstream to find a better solution.
|
||||||
|
|
||||||
|
This solves the issue reported at
|
||||||
|
https://github.com/openwrt/packages/issues/1010
|
||||||
|
and makes opcache usable on OpenWrt.
|
||||||
|
|
||||||
|
Signed-off-by: Michael Heimpold <mhei@heimpold.de>
|
||||||
|
---
|
||||||
|
ext/opcache/config.m4 | 122 ++-----------------------------------------------
|
||||||
|
1 file changed, 4 insertions(+), 118 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/ext/opcache/config.m4 b/ext/opcache/config.m4
|
||||||
|
index b7e4835..7b6c0aa 100644
|
||||||
|
--- a/ext/opcache/config.m4
|
||||||
|
+++ b/ext/opcache/config.m4
|
||||||
|
@@ -11,127 +11,13 @@ if test "$PHP_OPCACHE" != "no"; then
|
||||||
|
AC_DEFINE(HAVE_MPROTECT, 1, [Define if you have mprotect() function])
|
||||||
|
])
|
||||||
|
|
||||||
|
- AC_MSG_CHECKING(for sysvipc shared memory support)
|
||||||
|
- AC_TRY_RUN([
|
||||||
|
-#include <sys/types.h>
|
||||||
|
-#include <sys/wait.h>
|
||||||
|
-#include <sys/ipc.h>
|
||||||
|
-#include <sys/shm.h>
|
||||||
|
-#include <unistd.h>
|
||||||
|
-#include <string.h>
|
||||||
|
-
|
||||||
|
-int main() {
|
||||||
|
- pid_t pid;
|
||||||
|
- int status;
|
||||||
|
- int ipc_id;
|
||||||
|
- char *shm;
|
||||||
|
- struct shmid_ds shmbuf;
|
||||||
|
-
|
||||||
|
- ipc_id = shmget(IPC_PRIVATE, 4096, (IPC_CREAT | SHM_R | SHM_W));
|
||||||
|
- if (ipc_id == -1) {
|
||||||
|
- return 1;
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- shm = shmat(ipc_id, NULL, 0);
|
||||||
|
- if (shm == (void *)-1) {
|
||||||
|
- shmctl(ipc_id, IPC_RMID, NULL);
|
||||||
|
- return 2;
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- if (shmctl(ipc_id, IPC_STAT, &shmbuf) != 0) {
|
||||||
|
- shmdt(shm);
|
||||||
|
- shmctl(ipc_id, IPC_RMID, NULL);
|
||||||
|
- return 3;
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- shmbuf.shm_perm.uid = getuid();
|
||||||
|
- shmbuf.shm_perm.gid = getgid();
|
||||||
|
- shmbuf.shm_perm.mode = 0600;
|
||||||
|
-
|
||||||
|
- if (shmctl(ipc_id, IPC_SET, &shmbuf) != 0) {
|
||||||
|
- shmdt(shm);
|
||||||
|
- shmctl(ipc_id, IPC_RMID, NULL);
|
||||||
|
- return 4;
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- shmctl(ipc_id, IPC_RMID, NULL);
|
||||||
|
-
|
||||||
|
- strcpy(shm, "hello");
|
||||||
|
-
|
||||||
|
- pid = fork();
|
||||||
|
- if (pid < 0) {
|
||||||
|
- return 5;
|
||||||
|
- } else if (pid == 0) {
|
||||||
|
- strcpy(shm, "bye");
|
||||||
|
- return 6;
|
||||||
|
- }
|
||||||
|
- if (wait(&status) != pid) {
|
||||||
|
- return 7;
|
||||||
|
- }
|
||||||
|
- if (!WIFEXITED(status) || WEXITSTATUS(status) != 6) {
|
||||||
|
- return 8;
|
||||||
|
- }
|
||||||
|
- if (strcmp(shm, "bye") != 0) {
|
||||||
|
- return 9;
|
||||||
|
- }
|
||||||
|
- return 0;
|
||||||
|
-}
|
||||||
|
-],dnl
|
||||||
|
+ AC_CHECK_FUNC(shmget,[
|
||||||
|
AC_DEFINE(HAVE_SHM_IPC, 1, [Define if you have SysV IPC SHM support])
|
||||||
|
- msg=yes,msg=no,msg=no)
|
||||||
|
- AC_MSG_RESULT([$msg])
|
||||||
|
-
|
||||||
|
- AC_MSG_CHECKING(for mmap() using MAP_ANON shared memory support)
|
||||||
|
- AC_TRY_RUN([
|
||||||
|
-#include <sys/types.h>
|
||||||
|
-#include <sys/wait.h>
|
||||||
|
-#include <sys/mman.h>
|
||||||
|
-#include <unistd.h>
|
||||||
|
-#include <string.h>
|
||||||
|
-
|
||||||
|
-#ifndef MAP_ANON
|
||||||
|
-# ifdef MAP_ANONYMOUS
|
||||||
|
-# define MAP_ANON MAP_ANONYMOUS
|
||||||
|
-# endif
|
||||||
|
-#endif
|
||||||
|
-#ifndef MAP_FAILED
|
||||||
|
-# define MAP_FAILED ((void*)-1)
|
||||||
|
-#endif
|
||||||
|
-
|
||||||
|
-int main() {
|
||||||
|
- pid_t pid;
|
||||||
|
- int status;
|
||||||
|
- char *shm;
|
||||||
|
-
|
||||||
|
- shm = mmap(NULL, 4096, PROT_READ | PROT_WRITE, MAP_SHARED | MAP_ANON, -1, 0);
|
||||||
|
- if (shm == MAP_FAILED) {
|
||||||
|
- return 1;
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- strcpy(shm, "hello");
|
||||||
|
+ ])
|
||||||
|
|
||||||
|
- pid = fork();
|
||||||
|
- if (pid < 0) {
|
||||||
|
- return 5;
|
||||||
|
- } else if (pid == 0) {
|
||||||
|
- strcpy(shm, "bye");
|
||||||
|
- return 6;
|
||||||
|
- }
|
||||||
|
- if (wait(&status) != pid) {
|
||||||
|
- return 7;
|
||||||
|
- }
|
||||||
|
- if (!WIFEXITED(status) || WEXITSTATUS(status) != 6) {
|
||||||
|
- return 8;
|
||||||
|
- }
|
||||||
|
- if (strcmp(shm, "bye") != 0) {
|
||||||
|
- return 9;
|
||||||
|
- }
|
||||||
|
- return 0;
|
||||||
|
-}
|
||||||
|
-],dnl
|
||||||
|
+ AC_CHECK_FUNC(mmap,[
|
||||||
|
AC_DEFINE(HAVE_SHM_MMAP_ANON, 1, [Define if you have mmap(MAP_ANON) SHM support])
|
||||||
|
- msg=yes,msg=no,msg=no)
|
||||||
|
- AC_MSG_RESULT([$msg])
|
||||||
|
+ ])
|
||||||
|
|
||||||
|
AC_MSG_CHECKING(for mmap() using /dev/zero shared memory support)
|
||||||
|
AC_TRY_RUN([
|
||||||
|
--
|
||||||
|
1.7.10.4
|
||||||
|
|
Loading…
Reference in a new issue