Skip to content

Commit f49d3b7

Browse files
committed
Update README.Linux.md for snapshot usage
1 parent de0b8e2 commit f49d3b7

File tree

1 file changed

+25
-12
lines changed

1 file changed

+25
-12
lines changed

README.Linux.md

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,23 @@ years ago, since Node.js requires such an old version.
1010
This means that you usually need to compile v8 on your own before
1111
you can start to compile & install v8js itself.
1212

13-
Compile latest v8
13+
Snapshots
14+
---------
15+
16+
V8 has (optional) support for so-called snapshots which speed up startup
17+
performance drastically. Hence they are generally recommended for use.
18+
19+
There are two flavours of snapshots: internal & external.
20+
21+
Internal snapshots are built right into the V8 library (libv8.so file),
22+
so there's no need to handle them specially.
23+
24+
Besides there are external snapshots (which are enabled unless configured
25+
otherwise). If V8 is compiled with these, then V8Js needs to provide two
26+
"binary blobs" to V8, named `natives_blob.bin` and `snapshot_blob.bin`.
27+
In that case copy those two files to `/usr/share/v8/...`.
28+
29+
Compile latest V8
1430
-----------------
1531

1632
```
@@ -25,11 +41,15 @@ fetch v8
2541
cd v8
2642
2743
# (optional) If you'd like to build a certain version:
28-
git checkout 3.32.6
44+
git checkout 4.9.385.28
2945
gclient sync
3046
31-
# Build (disable snapshots for V8 > 4.4.9.1)
32-
make native library=shared snapshot=off -j8
47+
# use libicu of operating system
48+
export GYP_DEFINES="use_system_icu=1"
49+
50+
# Build (with internal snapshots)
51+
export GYPFLAGS="-Dv8_use_external_startup_data=0"
52+
make native library=shared snapshot=on -j8
3353
3454
# Install to /usr
3555
sudo mkdir -p /usr/lib /usr/include
@@ -40,16 +60,9 @@ echo -e "create /usr/lib/libv8_libplatform.a\naddlib out/native/obj.target/tools
4060

4161
Then add `extension=v8js.so` to your php.ini file. If you have a separate configuration for CLI, add it there also.
4262

43-
* If the V8 library is newer than 4.4.9.1 you need to pass `snapshot=off` to
44-
`make`, otherwise the V8 library will not be usable
45-
(see V8 [Issue 4192](https://code.google.com/p/v8/issues/detail?id=4192))
4663
* If you don't want to overwrite the system copy of v8, replace `/usr` in
4764
the above commands with some other path like `/opt/v8` and then add
4865
`--with-v8js=/opt/v8` to the php-v8js `./configure` command below.
49-
* If you do that with a v8 library of 4.2 branch or newer, then you need
50-
to fix the RUNPATH header in the v8js.so library so the libicui18n.so
51-
is found. By default it is set to `$ORIGIN/lib.target/`, however the files
52-
lie side by side. Use `chrpath -r '$ORIGIN' libv8.so` to fix.
5366

5467
`libv8_libplatform.a` should not be copied directly since it's a thin
5568
archive, i.e. it contains only pointers to the build objects, which
@@ -62,7 +75,7 @@ Compile php-v8js itself
6275

6376
```
6477
cd /tmp
65-
git clone https://github.com/preillyme/v8js.git
78+
git clone https://github.com/phpv8/v8js.git
6679
cd v8js
6780
phpize
6881
./configure

0 commit comments

Comments
 (0)