Last active
May 6, 2023 08:07
-
-
Save aozisik/c551c8ee924d141da9e767cdb950372a to your computer and use it in GitHub Desktop.
Installing V8JS extension for PHP 8.0 on Ubuntu 20.x
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apt-get update | |
# Install dependencies | |
apt-get install -y --no-install-recommends \ | |
libtinfo5 libtinfo-dev \ | |
build-essential \ | |
curl \ | |
git \ | |
libglib2.0-dev \ | |
libxml2 \ | |
python \ | |
patchelf | |
# Start building v8 | |
cd /tmp | |
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git --progress --verbose | |
export PATH="$PATH:/tmp/depot_tools" | |
fetch v8 | |
cd v8 | |
git checkout 9.9.115.7 | |
gclient sync | |
tools/dev/v8gen.py -vv x64.release -- is_component_build=true use_custom_libcxx=false | |
cd /tmp/v8 | |
ninja -C out.gn/x64.release/ | |
mkdir -p /opt/v8/lib && mkdir -p /opt/v8/include | |
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/ | |
apt-get install patchelf | |
for A in /opt/v8/lib/*.so; do patchelf --set-rpath '$ORIGIN' $A;done | |
# Fetch and build v8js | |
cd /tmp | |
git clone https://github.com/phpv8/v8js.git | |
cd v8js | |
git checkout php8 && git pull | |
phpize | |
./configure --with-v8js=/opt/v8 LDFLAGS="-lstdc++" CPPFLAGS="-DV8_COMPRESS_POINTERS" | |
make | |
make test | |
make install | |
# Finally, add this to mods-available, and enable it | |
echo "extension=v8js.so" > /etc/php/8.0/mods-available/v8js.ini | |
phpenmod -v 8.0 v8js |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment