phpv8

 기본 정보

 저장소1https://github.com/phpv8/v8js

 리눅스 환경에서의 빌드 안내2https://github.com/phpv8/v8js/blob/php7/README.Linux.md

 Nodedify 개발환경3https://github.com/10up/nodeifywp-environment 

 

 

 V8 컴파일  – @Ubuntu 18.04 | PHP v7.2 | V8  7.5.288.23 


# 컴파일 기본 도구 설치
➜  ~ sudo apt-get install build-essential curl git python libglib2.0-dev php7.2-dev re2c

# 툴세트 설치. 임시폴더에 만들거나 어디든 상관없다
➜  ~ cd
➜  ~ git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git

# v8 컴파일 하는 동안만 필요
➜  ~ export PATH=`pwd`/depot_tools:"$PATH" 

# v8 내려받기
➜  ~ fetch v8

# PHP-7.2 상태에서 컴파일 성공 버전: 7.5.288.23 
➜  v8 git:(843e2ef456) git checkout 7.5.288.23

Previous HEAD position was 843e2ef456 Update wasm coversion opcodes
HEAD is now at d1ee844177 Version 7.5.288.23


➜  v8 git:(d1ee844177) gclient sync
________ running '/usr/bin/python v8/build/landmines.py --landmine-scripts v8/tools/get_landmines.py' in '/root'
Clobbering due to:
--- old_landmines       Fri Aug  2 14:55:09 2019
+++ new_landmines       Fri Aug  2 16:12:31 2019
@@ -18 +17,0 @@
-Clobber to possibly resolve build failure on Misc V8 Linux gcc.


# GN 셋업
➜  ~ cd v8
➜  v8 git:(d1ee844177) ./tools/dev/v8gen.py -vv x64.release -- is_component_build=true use_custom_libcxx=false
################################################################################
/usr/bin/python -u tools/mb/mb.py gen -f infra/mb/mb_config.pyl -m developer_default -b x64.release out.gn/x64.release

  Writing """\
  is_debug = false
  target_cpu = "x64"
  """ to /root/v8/out.gn/x64.release/args.gn.

  /root/v8/buildtools/linux64/gn gen out.gn/x64.release --check
  Done. Made 129 targets from 80 files in 226ms
################################################################################
Appending """
is_component_build=true
use_custom_libcxx=false
""" to /root/v8/out.gn/x64.release/args.gn.

# v8 빌드
➜  v8 git:(843e2ef456) ninja -C out.gn/x64.release/
ninja: Entering directory `out.gn/x64.release/'
[1/1] Regenerating ninja files
[1899/1899] STAMP obj/gn_all.stamp

# 설치: /opt/v8/
➜  v8 git:(843e2ef456) sudo mkdir -p /opt/v8/{lib,include}
➜  v8 git:(843e2ef456) sudo cp out.gn/x64.release/lib*.so out.gn/x64.release/*_blob.bin \
  out.gn/x64.release/icudtl.dat /opt/v8/lib/
➜  v8 git:(843e2ef456) sudo cp -R include/* /opt/v8/include/

 

 php-v8 컴파일

 


cd
cd v8js
➜  v8js git:(php7) 
➜  v8js git:(php7) phpize
➜  v8js git:(php7) ./configure --with-v8js=/opt/v8 LDFLAGS="-lstdc++"

# 테스트
➜  v8js git:(php7) make test
=====================================================================
TEST RESULT SUMMARY
---------------------------------------------------------------------
Exts skipped    :    0
Exts tested     :   17
---------------------------------------------------------------------

Number of tests :  178               175
Tests skipped   :    3 (  1.7%) --------
Tests warned    :    0 (  0.0%) (  0.0%)
Tests failed    :    0 (  0.0%) (  0.0%)
Expected fail   :    0 (  0.0%) (  0.0%)
Tests passed    :  175 ( 98.3%) (100.0%)
---------------------------------------------------------------------
Time taken      :    9 seconds
=====================================================================

This report can be automatically sent to the PHP QA team at
http://qa.php.net/reports and http://news.php.net/php.qa.reports
This gives us a better understanding of PHP's behavior.
If you don't want to send the report immediately you can choose
option "s" to save it.  You can then email it to qa-reports@lists.php.net later.
Do you want to send this report now? [Yns]: Y

Please enter your email address.
(Your address will be mangled so that it will not go out on any
mailinglist in plain text): andrwj@gmail.com

Posting to http://qa.php.net/buildtest-process.php

Thank you for helping to make PHP better.


➜  v8js git:(php7) make install
Installing shared extensions:     /usr/lib/php/20170718/

 

 v8.ini 설정 파일 추가 

 FPM/CLI 양쪽에 설정하는 걸 잊지 말 것

➜  mods-available git:(master) ✗ cat /etc/php/7.2/mods-available/v8.ini
extension=v8js.so

 

 확인

➜  conf.d git:(master) ✗ php -i | grep v8
/etc/php/7.2/cli/conf.d/20-v8.ini,
v8js
v8js.flags => no value => no value
v8js.icudtl_dat_path => no value => no value
v8js.use_array_access => 0 => 0
v8js.use_date => 0 => 0

References   [ + ]

1. https://github.com/phpv8/v8js
2. https://github.com/phpv8/v8js/blob/php7/README.Linux.md
3. https://github.com/10up/nodeifywp-environment

2019월 8월 2일 (금)

 

 멍청한 아베새끼…  

 CodeMirror 기반 문법강조 툴에 VIM을 적용하고 있지만 ESC 키가 제대로 먹지 않으면 뭔 소용이냐…

 V8JS 드뎌 성공.. 열받은 내 노트북이 수고했네ㅋ 

  • Twenty Sixteen React Theme1https://github.com/10up/twentysixteenreact.git
  • Complete Guide to utilize V8JS2http://andrwj.com/env/phpv8/

 

 WordPress + ReactJS 조합 성공했다.. ㅠ.ㅠ)  정말 오랬동안 구상만 했는데, 이렇게 되다니!! 

References   [ + ]

1. https://github.com/10up/twentysixteenreact.git
2. http://andrwj.com/env/phpv8/