These RPM were built to have an easy way to install the google's javascript engine v8 5.x and v8js php extension for EL7 users.
- GNU make
- g++ 4.8 or newer
- libicu-devel
yum install gcc-c++ make libicu-devel
cd /tmp
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
export PATH=`pwd`/depot_tools:"$PATH"
cd depot_tools
fetch v8
cd v8
(optional) If you'd like to build a certain version (version >= 7.4 not working with default libstdc++.so.6 on EL7 (GLIBCXX_3.4.20
missing)):
git checkout 7.3.492.25
gclient sync
gclient sync
tools/dev/v8gen.py -vv x64.release -- is_component_build=true
ninja -C out.gn/x64.release/
mkdir -p ~/opt-v8/{bin,lib,include}
cp out.gn/x64.release/d8 ~/opt-v8/bin/
cp out.gn/x64.release/lib*.so out.gn/x64.release/*_blob.bin out.gn/x64.release/icudtl.dat ~/opt-v8/lib/
cp -R include/* ~/opt-v8/include/
rpmbuild -ba v8.spec
- V8 7.3.x
- PHP 7.x from SCL or EPEL
sudo yum install centos-release-scl
sudo yum install rh-php72
scl enable rh-php72 bash
sudo yum install rh-php72-php-devel
sudo yum -y install epel-release
sudo yum-config-manager --enable remi-php73
sudo yum update
sudo yum install php php-devel
cd /tmp
git clone https://github.com/phpv8/v8js
cd v8js
git checkout 85097c1
phpize
# check path for php-config
which php-config
./configure --with-php-config=[PATH_TO_PHP_CONFIG] --with-v8js=/opt/v8 LDFLAGS="-lstdc++"
make
make test
change /home/v8/v8js to your v8js checkout directory.
rpmbuild -bb v8js.spec --define="pre_built_dir /home/v8/v8js"
# check path for php modules
php-config --extension-dir
sudo su
cp /tmp/v8js/modules/v8js.so [PATH_TO_PHP_EXTENSION_DIR]
echo -e "; Enable v8js extension module\nextension=v8js.so" > [PATH_TO_PHP_INI_DIR]/99-v8js.ini