phpv8 / v8js

V8 Javascript Engine for PHP — This PHP extension embeds the Google V8 Javascript Engine
http://pecl.php.net/package/v8js
MIT License
1.84k stars 200 forks source link

Use /opt/v8, instead of /usr #218

Closed kenpeter closed 8 years ago

kenpeter commented 8 years ago

If you don't want to overwrite the system copy of v8, replace /usr in the above commands with some other path like /opt/v8 and then add --with-v8js=/opt/v8 to the php-v8js ./configure command below.

What exactly do I need to change in "configure"?

Here is the configure file: http://expirebox.com/download/85d34ccf80cc75afc5fb41b3ae0ceec2.html

stesie commented 8 years ago

You don't need to modify the configure script itself, simply pass the --with-v8js parameter to it.

To compile V8 (version 5.1.200 + install to /opt/v8/5.1.200/) use something like this

git checkout "5.1.200"
gclient sync || true

export GYP_DEFINES="use_system_icu=1"
export GYPFLAGS="-Dv8_use_external_startup_data=0"
make native library=shared  -j5

sudo mkdir -p "/opt/v8/5.1.200"/{include,lib,share/v8}
sudo cp out/native/lib.target/lib*.so "/opt/v8/5.1.200"/lib/
sudo cp -R include/* "/opt/v8/5.1.200"/include/

echo -e "create /opt/v8/5.1.200/lib/libv8_libplatform.a\naddlib out/native/obj.target/tools/gyp/libv8_libplatform.a\nsave\nend" | sudo ar -M

The configure & build V8Js like this:

phpize
./configure --with-v8js=/opt/v8/5.1.200
make
make test