From 40129022b3a045528356c3b4b99dc3a7a67a8c2b Mon Sep 17 00:00:00 2001 From: Martijn Otto Date: Tue, 14 Jun 2016 15:09:17 +0200 Subject: [PATCH] Updated PHP-JS to be compatible with latest v8 --- .clang_complete | 2 ++ Makefile | 17 ++++++++++++++++- external.h | 4 ++-- handle.h | 11 ----------- 4 files changed, 20 insertions(+), 14 deletions(-) create mode 100644 .clang_complete diff --git a/.clang_complete b/.clang_complete new file mode 100644 index 0000000..82645da --- /dev/null +++ b/.clang_complete @@ -0,0 +1,2 @@ +-std=c++11 +-Wno-pragma-once-outside-header diff --git a/Makefile b/Makefile index 068d1d7..47730c9 100644 --- a/Makefile +++ b/Makefile @@ -28,8 +28,23 @@ NAME = php-js # PHP installations use a conf.d directory that holds a set of config files, # one for each extension. Use this variable to specify this directory. # +# In Ubuntu 14.04 Apache 2.4 is used, which uses the mods-available directory +# instead of a conf.d directory. In 16.04 the directory changed yet again. +# This has to be checked. +# + +UBUNTU_MAJOR := $(shell /usr/bin/lsb_release -r -s | cut -f1 -d.) +OVER_SIXTEEN := $(shell echo "${UBUNTU_MAJOR} >= 16" | bc) +OVER_FOURTEEN := $(shell echo "${UBUNTU_MAJOR} >= 14" | bc) + +ifeq (${OVER_SIXTEEN}, 1) + INI_DIR = /etc/php/7.0/mods-available/ +else ifeq (${OVER_FOURTEEN}, 1) + INI_DIR = /etc/php5/mods-available/ +else + INI_DIR = /etc/php5/conf.d/ +endif -INI_DIR = /etc/php5/mods-available/ # diff --git a/external.h b/external.h index d5a0674..35e6cca 100644 --- a/external.h +++ b/external.h @@ -47,7 +47,7 @@ class External * * @param data callback data */ - static void destructor(const v8::WeakCallbackData &data) + static void destructor(const v8::WeakCallbackInfo &data) { // stop tracking the external reference Context::current()->untrack(data.GetParameter()); @@ -92,7 +92,7 @@ class External { // create the persistent handle and make it weak _persistent.Reset(Isolate::get(), handle); - _persistent.SetWeak(this, &destructor); + _persistent.SetWeak(this, &destructor, v8::WeakCallbackType::kParameter); } /** diff --git a/handle.h b/handle.h index 5d04692..60ba644 100644 --- a/handle.h +++ b/handle.h @@ -40,17 +40,6 @@ class Handle * @var v8::Handle */ v8::Local _handle; - - /** - * The destructor callback to clean up the object - * - * @param data callback data - */ - static void destructor(const v8::WeakCallbackData &data) - { - // delete the object - delete data.GetParameter(); - } public: /** * Constructor