mirror of
https://github.com/phpv8/v8js.git
synced 2024-12-22 22:51:51 +00:00
Initialize v8 platform as needed
See http://comments.gmane.org/gmane.comp.lang.javascript.v8.general/8029 for more information.
This commit is contained in:
parent
48765bcc97
commit
14600d3be3
@ -37,7 +37,8 @@ make dependencies
|
||||
make native library=shared -j8
|
||||
sudo mkdir -p /usr/lib /usr/include
|
||||
sudo cp out/native/lib.target/lib*.so /usr/lib/
|
||||
sudo cp include/v8* /usr/include
|
||||
sudo cp out/native/obj.target/tools/gyp/libv8_libplatform.a /usr/lib
|
||||
sudo cp -R include/v8* /usr/include
|
||||
|
||||
```
|
||||
|
||||
|
24
config.m4
24
config.m4
@ -89,6 +89,30 @@ AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <v8-debug.h>]],
|
||||
LDFLAGS=$old_LDFLAGS
|
||||
CPPFLAGS=$old_CPPFLAGS
|
||||
|
||||
if test "$V8_API_VERSION" -ge 3029036 ; then
|
||||
dnl building for v8 3.29.36 or later, which requires us to
|
||||
dnl initialize and provide a platform; hence we need to
|
||||
dnl link in libplatform to make our life easier.
|
||||
PHP_ADD_INCLUDE($V8_DIR)
|
||||
|
||||
SEARCH_FOR="lib/libv8_libplatform.a"
|
||||
AC_MSG_CHECKING([for libv8_libplatform.a])
|
||||
|
||||
for i in $PHP_V8JS $SEARCH_PATH ; do
|
||||
echo $i/$SEARCH_FOR
|
||||
if test -r $i/$SEARCH_FOR; then
|
||||
LIBPLATFORM_DIR=$i
|
||||
AC_MSG_RESULT(found in $i)
|
||||
fi
|
||||
done
|
||||
|
||||
if test -z "$LIBPLATFORM_DIR"; then
|
||||
AC_MSG_RESULT([not found])
|
||||
AC_MSG_ERROR([Please provide libv8_libplatform.a next to the libv8.so, see README.md for details])
|
||||
fi
|
||||
|
||||
LDFLAGS="$LDFLAGS $LIBPLATFORM_DIR/$SEARCH_FOR"
|
||||
fi
|
||||
|
||||
AC_CACHE_CHECK(for C standard version, ac_cv_v8_cstd, [
|
||||
ac_cv_v8_cstd="c++11"
|
||||
|
6
v8js.cc
6
v8js.cc
@ -20,6 +20,7 @@
|
||||
#endif
|
||||
|
||||
#include <v8-debug.h>
|
||||
#include <libplatform/libplatform.h>
|
||||
|
||||
#include "php_v8js_macros.h"
|
||||
|
||||
@ -857,6 +858,11 @@ static void php_v8js_init(TSRMLS_D) /* {{{ */
|
||||
return;
|
||||
}
|
||||
|
||||
#if PHP_V8_API_VERSION >= 3029036
|
||||
v8::Platform* platform = v8::platform::CreateDefaultPlatform();
|
||||
v8::V8::InitializePlatform(platform);
|
||||
#endif
|
||||
|
||||
/* Set V8 command line flags (must be done before V8::Initialize()!) */
|
||||
if (V8JSG(v8_flags)) {
|
||||
v8::V8::SetFlagsFromString(V8JSG(v8_flags), strlen(V8JSG(v8_flags)));
|
||||
|
Loading…
Reference in New Issue
Block a user