forked from ry/v8worker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·46 lines (38 loc) · 1.28 KB
/
build.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/bin/bash
# Based on install.sh from idada/v8.go - thanks.
# To compile a debug version use one of the following commands
# target=x64.debug ./build.sh
# target=x64.release ./build.sh
# target=ia32.debug ./build.sh
# target=ia32.release ./build.sh
set -e -x
# go into directory containing this script
cd `dirname "${BASH_SOURCE[0]}"`
# build v8
GYPFLAGS="-Dv8_use_external_startup_data=0" make -C v8/ i18nsupport=off $target
outdir="`pwd`/v8/out/$target"
libv8_base="`find $outdir -name 'libv8_base.a' | head -1`"
libv8_libbase="`find $outdir -name 'libv8_libbase.a' | head -1`"
libv8_libplatform=`find $outdir -name 'libv8_libplatform.a' | head -1`""
libv8_snapshot=`find $outdir -name 'libv8_snapshot.a' | head -1`""
# for Linux
libs=''
start_group=''
end_group=''
if [ `go env | grep GOHOSTOS` == 'GOHOSTOS="linux"' ]; then
libs='-lrt -ldl'
start_group='-Wl,--start-group'
end_group='-Wl,--end-group'
fi
# for Mac
libstdcpp=''
if [ `go env | grep GOHOSTOS` == 'GOHOSTOS="darwin"' ]; then
libstdcpp='-stdlib=libstdc++'
fi
# create package config file
echo "Name: v8
Description: v8 javascript engine
Version: $target
Cflags: $libstdcpp -I`pwd`/v8/include -I`pwd`/v8/
Libs: $libstdcpp $start_group $libv8_libbase $libv8_base $libv8_libplatform \
$libv8_snapshot $end_group $libs" > v8.pc