Skip to content

Instantly share code, notes, and snippets.

@CyJimmy264
Forked from igez/v8js.sh
Created January 18, 2018 11:48
Show Gist options
  • Save CyJimmy264/ec5dbb4e375d1a56c1f2753891fda71e to your computer and use it in GitHub Desktop.
Save CyJimmy264/ec5dbb4e375d1a56c1f2753891fda71e to your computer and use it in GitHub Desktop.
Install V8js php extension on ubuntu
#!/bin/bash
sudo apt-get update -o Acquire::ForceIPv4=true
sudo apt-get install -y build-essential chrpath git -o Acquire::ForceIPv4=true
cd /tmp
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
export PATH=`pwd`/depot_tools:"$PATH"
fetch v8
cd v8
make native library=shared -j8
chrpath -r '$ORIGIN' out/native/lib.target/libv8.so
sudo mkdir -p /tmp/v8-install/lib /tmp/v8-install/include
sudo cp out/native/lib.target/lib*.so /tmp/v8-install/lib/
sudo cp -R include/* /tmp/v8-install/include
echo -e "create /tmp/v8-install/lib/libv8_libplatform.a\naddlib out/native/obj.target/tools/gyp/libv8_libplatform.a\nsave\nend" | sudo ar -M
cd /tmp
git clone https://github.com/preillyme/v8js.git
cd v8js
phpize
./configure --with-v8js=/tmp/v8-install
make
make test
sudo make install
echo "extension=v8js.so" > /etc/php/7.0/mods-available/v8js.ini
ln -s /etc/php/7.0/mods-available/v8js.ini /etc/php/7.0/cli/conf.d/20-v8js.ini
@425027sv
Copy link

the line : make native library=shared -j8

gives the error : 'No rule to make target 'native'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment