v8eval 0.2.3 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/CMakeLists.txt +27 -17
- data/README.md +12 -4
- data/build.sh +71 -57
- data/ruby/Gemfile +2 -2
- data/ruby/build.sh +9 -9
- data/ruby/ext/v8eval/extconf.rb +24 -13
- data/ruby/lib/v8eval.rb +0 -16
- data/ruby/spec/v8eval_spec.rb +0 -17
- data/src/v8eval.cxx +49 -128
- data/src/v8eval.h +11 -35
- data/src/v8eval_go.cxx +3 -1
- data/v8eval.gemspec +6 -6
- metadata +13 -29
- data/ruby/ext/v8eval/Makefile +0 -261
- data/ruby/ext/v8eval/v8eval.h +0 -99
- data/ruby/ext/v8eval/v8eval_wrap.cxx +0 -2529
- data/ruby/lib/v8eval/Makefile +0 -261
- data/ruby/lib/v8eval/extconf.rb +0 -55
- data/ruby/lib/v8eval/v8eval.h +0 -99
- data/ruby/lib/v8eval/v8eval_wrap.cxx +0 -2529
- data/src/dbgsrv.cxx +0 -211
- data/src/dbgsrv.h +0 -72
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 38af0f6fe5626a1d4085a15e351c3a2ca9ab95dd339e64544395a65fbc8257a7
|
4
|
+
data.tar.gz: 0c40757c5d114ca97016305f76d1f15f6588c851ff4cbb159051c7ffc39b9286
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9c6288b4e68243dda6b9e8864c652d1dfc52e53e1732aed94f4edfc80f9a129d272bec410ff08698e647bf8344a69cf4d97f11a137179e754809149dd8d6b7ff
|
7
|
+
data.tar.gz: 5da63b2067f21399151e798c27a55e398d7b8818d25fae7c04f97e807e0c19c377046665d8d31dd4f16bbce7760bcdfee1307048e4e99c41ade5b4b2bf521e30
|
data/CMakeLists.txt
CHANGED
@@ -11,33 +11,29 @@ endif(COMMAND cmake_policy)
|
|
11
11
|
include_directories(
|
12
12
|
v8
|
13
13
|
v8/include
|
14
|
-
v8/third_party/icu/source/i18n
|
15
|
-
v8/third_party/icu/source/common
|
16
|
-
uv/include
|
17
14
|
src
|
18
|
-
|
15
|
+
v8/third_party/googletest/src/googletest/include
|
19
16
|
)
|
20
17
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
endif(APPLE)
|
18
|
+
set(v8eval-linkdirs
|
19
|
+
v8/out.gn/x64.release/obj
|
20
|
+
v8/out.gn/x64.release/obj/third_party/googletest
|
21
|
+
)
|
26
22
|
|
27
23
|
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
28
|
-
|
29
|
-
|
30
|
-
v8/out/x64.release/obj
|
24
|
+
set(v8eval-linkdirs
|
25
|
+
${v8eval-linkdirs}
|
26
|
+
v8/out.gn/x64.release/obj/buildtools/third_party/libc++
|
27
|
+
v8/out.gn/x64.release/obj/buildtools/third_party/libc++abi
|
31
28
|
)
|
32
29
|
endif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
33
30
|
|
34
31
|
link_directories(
|
35
|
-
|
32
|
+
${v8eval-linkdirs}
|
36
33
|
)
|
37
34
|
|
38
35
|
add_library(v8eval STATIC
|
39
36
|
src/v8eval.cxx
|
40
|
-
src/dbgsrv.cxx
|
41
37
|
)
|
42
38
|
|
43
39
|
add_library(v8eval_go STATIC
|
@@ -54,7 +50,6 @@ add_library(v8eval_ruby STATIC
|
|
54
50
|
|
55
51
|
set(v8eval-cflags
|
56
52
|
-Wall
|
57
|
-
-Wendif-labels
|
58
53
|
-Werror
|
59
54
|
-Wno-missing-field-initializers
|
60
55
|
-Wno-unused-parameter
|
@@ -64,13 +59,28 @@ set(v8eval-cflags
|
|
64
59
|
-fno-rtti
|
65
60
|
-fno-strict-aliasing
|
66
61
|
-fno-threadsafe-statics
|
67
|
-
-fstrict-aliasing
|
68
62
|
-fvisibility=hidden
|
69
63
|
-fvisibility-inlines-hidden
|
70
64
|
-gdwarf-2
|
71
|
-
-std=c++
|
65
|
+
-std=c++14
|
72
66
|
)
|
73
67
|
|
68
|
+
if(APPLE)
|
69
|
+
set(v8eval-cflags
|
70
|
+
${v8eval-cflags}
|
71
|
+
-stdlib=libc++
|
72
|
+
)
|
73
|
+
endif(APPLE)
|
74
|
+
|
75
|
+
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
76
|
+
set(v8eval-cflags
|
77
|
+
${v8eval-cflags}
|
78
|
+
-nostdinc++
|
79
|
+
-isystem ${CMAKE_CURRENT_SOURCE_DIR}/v8/buildtools/third_party/libc++/trunk/include
|
80
|
+
-isystem ${CMAKE_CURRENT_SOURCE_DIR}/v8/buildtools/third_party/libc++abi/trunk/include
|
81
|
+
)
|
82
|
+
endif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
83
|
+
|
74
84
|
string(REPLACE ";" " " v8eval-cflags "${v8eval-cflags}")
|
75
85
|
|
76
86
|
set_target_properties(v8eval PROPERTIES
|
data/README.md
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
[](http://badge.fury.io/py/v8eval)
|
4
4
|
[](https://badge.fury.io/rb/v8eval)
|
5
|
-
[](http://godoc.org/github.com/sony/v8eval/go/v8eval)
|
6
6
|
|
7
7
|
Multi-language bindings to JavaScript engine V8.
|
8
8
|
|
9
|
-
Currently v8eval provides Go, Python and Ruby bindings to the latest V8
|
9
|
+
Currently v8eval provides Go, Python and Ruby bindings to the latest V8 7.1 and supports Linux and Mac OS X.
|
10
10
|
v8eval uses SWIG and can be extended easily for other languages.
|
11
11
|
|
12
12
|
## Pre-installation
|
@@ -25,9 +25,17 @@ The installation takes several tens of minutes due to V8 build.
|
|
25
25
|
|
26
26
|
#### Go
|
27
27
|
|
28
|
+
v8eval requires Go 1.10 or later.
|
29
|
+
|
30
|
+
```
|
31
|
+
git clone https://github.com/sony/v8eval.git ${GOPATH}/src/github.com/sony/v8eval
|
32
|
+
${GOPATH}/src/github.com/sony/v8eval/go/build.sh install
|
33
|
+
```
|
34
|
+
|
35
|
+
In the case of Linux, you need to build your Go program with `build.sh`:
|
36
|
+
|
28
37
|
```
|
29
|
-
|
30
|
-
$GOPATH/src/github.com/sony/v8eval/go/build.sh install
|
38
|
+
${GOPATH}/src/github.com/sony/v8eval/go/build.sh go build
|
31
39
|
```
|
32
40
|
|
33
41
|
#### Python
|
data/build.sh
CHANGED
@@ -1,109 +1,123 @@
|
|
1
1
|
#!/bin/sh
|
2
2
|
|
3
|
-
V8EVAL_ROOT=`cd $(dirname $0) && pwd`
|
3
|
+
V8EVAL_ROOT=`cd $(dirname ${0}) && pwd`
|
4
4
|
|
5
5
|
PLATFORM=`uname`
|
6
|
-
if [ $PLATFORM = "Linux" ]
|
7
|
-
NUM_CPU_CORES=`cat /proc/cpuinfo | grep cores | grep -o '[0-9]\+'`
|
8
|
-
|
9
|
-
export CC=$V8EVAL_ROOT/v8/third_party/llvm-build/Release+Asserts/bin/clang
|
10
|
-
export CXX=$V8EVAL_ROOT/v8/third_party/llvm-build/Release+Asserts/bin/clang++
|
11
|
-
elif [ $PLATFORM = "Darwin" ]; then
|
12
|
-
NUM_CPU_CORES=`sysctl -n hw.ncpu`
|
13
|
-
|
14
|
-
export CC=`which clang`
|
15
|
-
export CXX=`which clang++`
|
16
|
-
export CPP="`which clang` -E"
|
17
|
-
export LINK="`which clang++`"
|
18
|
-
export CC_host=`which clang`
|
19
|
-
export CXX_host=`which clang++`
|
20
|
-
export CPP_host="`which clang` -E"
|
21
|
-
export LINK_host=`which clang++`
|
22
|
-
export GYP_DEFINES="clang=1 mac_deployment_target=10.10"
|
23
|
-
else
|
6
|
+
if [ ! ${PLATFORM} = "Linux" -a ! ${PLATFORM} = "Darwin" ]; then
|
24
7
|
echo "unsupported platform: ${PLATFORM}"
|
25
8
|
exit 1
|
26
9
|
fi
|
27
10
|
|
28
|
-
|
29
|
-
|
30
|
-
if [ -d $V8EVAL_ROOT/depot_tools ]; then
|
31
|
-
return 0
|
32
|
-
fi
|
11
|
+
export CC=${V8EVAL_ROOT}/v8/third_party/llvm-build/Release+Asserts/bin/clang
|
12
|
+
export CXX=${V8EVAL_ROOT}/v8/third_party/llvm-build/Release+Asserts/bin/clang++
|
33
13
|
|
34
|
-
|
35
|
-
|
36
|
-
|
14
|
+
if [ ${PLATFORM} = "Linux" ]; then
|
15
|
+
export PATH=${V8EVAL_ROOT}/v8/third_party/binutils/Linux_x64/Release/bin:${PATH}
|
16
|
+
fi
|
37
17
|
|
38
|
-
|
39
|
-
|
18
|
+
install_depot_tools() {
|
19
|
+
export PATH=${V8EVAL_ROOT}/depot_tools:${PATH}
|
20
|
+
if [ -d ${V8EVAL_ROOT}/depot_tools ]; then
|
40
21
|
return 0
|
41
22
|
fi
|
42
23
|
|
43
|
-
cd $V8EVAL_ROOT
|
44
|
-
git clone https://
|
45
|
-
git checkout release-1.7.0
|
24
|
+
cd ${V8EVAL_ROOT}
|
25
|
+
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
|
46
26
|
}
|
47
27
|
|
48
28
|
install_v8() {
|
49
|
-
if [ -d $V8EVAL_ROOT/v8 ]; then
|
29
|
+
if [ -d ${V8EVAL_ROOT}/v8 ]; then
|
50
30
|
return 0
|
51
31
|
fi
|
52
32
|
|
53
|
-
cd $V8EVAL_ROOT
|
33
|
+
cd ${V8EVAL_ROOT}
|
54
34
|
fetch v8
|
55
35
|
cd v8
|
56
|
-
git checkout
|
57
|
-
|
36
|
+
git checkout 7.1.177
|
37
|
+
gclient sync
|
38
|
+
if [ ${PLATFORM} = "Linux" ]; then
|
39
|
+
./build/install-build-deps.sh
|
40
|
+
fi
|
41
|
+
tools/dev/v8gen.py x64.release -- v8_use_snapshot=false v8_enable_i18n_support=false
|
42
|
+
ninja -v -C out.gn/x64.release
|
58
43
|
}
|
59
44
|
|
60
|
-
|
61
|
-
if [ -
|
45
|
+
archive_lib() {
|
46
|
+
if [ -f ${1}/lib${2}.a ]; then
|
62
47
|
return 0
|
63
48
|
fi
|
64
49
|
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
50
|
+
if [ `echo ${2} | cut -c 1-3` = "lib" ]; then
|
51
|
+
ar cr ${1}/${2}.a ${1}/${2}/*.o
|
52
|
+
else
|
53
|
+
ar cr ${1}/lib${2}.a ${1}/${2}/*.o
|
54
|
+
fi
|
55
|
+
}
|
56
|
+
|
57
|
+
V8_OUT=${V8EVAL_ROOT}/v8/out.gn/x64.release/obj
|
58
|
+
|
59
|
+
archive_v8() {
|
60
|
+
archive_lib ${V8_OUT} v8_base
|
61
|
+
archive_lib ${V8_OUT} v8_libsampler
|
62
|
+
archive_lib ${V8_OUT} v8_init
|
63
|
+
archive_lib ${V8_OUT} v8_initializers
|
64
|
+
archive_lib ${V8_OUT} v8_nosnapshot
|
65
|
+
archive_lib ${V8_OUT} torque_generated_initializers
|
66
|
+
}
|
67
|
+
|
68
|
+
archive_libcxx() {
|
69
|
+
archive_lib ${V8_OUT}/buildtools/third_party/libc++ libc++
|
70
|
+
}
|
71
|
+
|
72
|
+
archive_libcxxabi() {
|
73
|
+
archive_lib ${V8_OUT}/buildtools/third_party/libc++abi libc++abi
|
74
|
+
}
|
75
|
+
|
76
|
+
archive_googletest() {
|
77
|
+
archive_lib ${V8_OUT}/third_party/googletest gtest
|
78
|
+
archive_lib ${V8_OUT}/third_party/googletest gtest_main
|
72
79
|
}
|
73
80
|
|
74
81
|
build() {
|
75
82
|
install_depot_tools
|
76
83
|
install_v8
|
77
|
-
|
84
|
+
archive_v8
|
85
|
+
if [ ${PLATFORM} = "Linux" ]; then
|
86
|
+
archive_libcxx
|
87
|
+
archive_libcxxabi
|
88
|
+
fi
|
78
89
|
|
79
|
-
cd $V8EVAL_ROOT
|
90
|
+
cd ${V8EVAL_ROOT}
|
80
91
|
mkdir -p build
|
81
92
|
cd build
|
82
93
|
cmake -DCMAKE_BUILD_TYPE=Release -DV8EVAL_TEST=OFF ..
|
83
94
|
make VERBOSE=1
|
95
|
+
|
96
|
+
cd ${V8EVAL_ROOT}
|
97
|
+
rm -rf old_v8_tools_luci-go.git
|
84
98
|
}
|
85
99
|
|
86
100
|
docs() {
|
87
|
-
cd $V8EVAL_ROOT/docs
|
101
|
+
cd ${V8EVAL_ROOT}/docs
|
88
102
|
rm -rf ./html
|
89
103
|
doxygen
|
90
104
|
}
|
91
105
|
|
92
106
|
test() {
|
93
107
|
build
|
94
|
-
|
108
|
+
archive_googletest
|
95
109
|
|
96
|
-
cd $V8EVAL_ROOT/build
|
110
|
+
cd ${V8EVAL_ROOT}/build
|
97
111
|
cmake -DCMAKE_BUILD_TYPE=Release -DV8EVAL_TEST=ON ..
|
98
112
|
make VERBOSE=1
|
99
113
|
./test/v8eval-test
|
100
114
|
}
|
101
115
|
|
102
|
-
# dispatch
|
103
|
-
SUBCOMMAND
|
104
|
-
case
|
105
|
-
""
|
106
|
-
"docs"
|
107
|
-
"test"
|
108
|
-
*
|
116
|
+
# dispatch subcommands
|
117
|
+
SUBCOMMAND=${1}
|
118
|
+
case ${SUBCOMMAND} in
|
119
|
+
"" ) build ;;
|
120
|
+
"docs" ) docs ;;
|
121
|
+
"test" ) test ;;
|
122
|
+
* ) echo "unknown subcommand: ${SUBCOMMAND}"; exit 1 ;;
|
109
123
|
esac
|
data/ruby/Gemfile
CHANGED
data/ruby/build.sh
CHANGED
@@ -1,21 +1,21 @@
|
|
1
1
|
#!/bin/sh
|
2
2
|
|
3
|
-
V8EVAL_ROOT=`cd $(dirname $0)/.. && pwd`
|
3
|
+
V8EVAL_ROOT=`cd $(dirname ${0})/.. && pwd`
|
4
4
|
|
5
5
|
build() {
|
6
|
-
cd $V8EVAL_ROOT/ruby
|
6
|
+
cd ${V8EVAL_ROOT}/ruby
|
7
7
|
rake prepare_build
|
8
8
|
rake build_ext
|
9
9
|
}
|
10
10
|
|
11
11
|
install() {
|
12
|
-
cd $V8EVAL_ROOT
|
12
|
+
cd ${V8EVAL_ROOT}
|
13
13
|
gem build v8eval.gemspec
|
14
14
|
gem install v8eval-*.gem
|
15
15
|
}
|
16
16
|
|
17
17
|
docs() {
|
18
|
-
cd $V8EVAL_ROOT/ruby
|
18
|
+
cd ${V8EVAL_ROOT}/ruby
|
19
19
|
rm -rf ./doc
|
20
20
|
mkdir ./doc
|
21
21
|
yardoc --main ../README.md lib/v8eval.rb
|
@@ -24,16 +24,16 @@ docs() {
|
|
24
24
|
test() {
|
25
25
|
build
|
26
26
|
|
27
|
-
gem install
|
28
|
-
cd $V8EVAL_ROOT/ruby
|
27
|
+
gem install bundler -v 1.14.5
|
28
|
+
cd ${V8EVAL_ROOT}/ruby
|
29
29
|
bundle install
|
30
30
|
|
31
|
-
rspec --init
|
32
|
-
rspec
|
31
|
+
bundle exec rspec --init
|
32
|
+
bundle exec rspec
|
33
33
|
}
|
34
34
|
|
35
35
|
# dispatch subcommand
|
36
|
-
SUBCOMMAND="$1";
|
36
|
+
SUBCOMMAND="${1}";
|
37
37
|
case "${SUBCOMMAND}" in
|
38
38
|
"" ) build ;;
|
39
39
|
"install" ) install ;;
|
data/ruby/ext/v8eval/extconf.rb
CHANGED
@@ -6,7 +6,6 @@ require_relative '../../lib/setup/extension_builder'
|
|
6
6
|
# set path variables
|
7
7
|
v8eval_root = File.expand_path('../../..', Dir.pwd)
|
8
8
|
v8_dir = v8eval_root + '/v8'
|
9
|
-
uv_dir = v8eval_root + '/uv'
|
10
9
|
|
11
10
|
# make instance of BuildTool class
|
12
11
|
tool = BuildTool.new(v8eval_root)
|
@@ -23,33 +22,45 @@ INCLUDEDIR = RbConfig::CONFIG['includedir']
|
|
23
22
|
header_dirs = [
|
24
23
|
v8_dir,
|
25
24
|
v8_dir + '/include',
|
26
|
-
uv_dir + '/include',
|
27
25
|
INCLUDEDIR
|
28
26
|
]
|
29
27
|
|
30
28
|
lib_dirs = [
|
31
29
|
v8eval_root + '/build',
|
32
|
-
|
30
|
+
v8_dir + '/out.gn/x64.release/obj',
|
33
31
|
LIBDIR
|
34
32
|
]
|
35
33
|
|
36
|
-
if RUBY_PLATFORM =~ /
|
34
|
+
if RUBY_PLATFORM =~ /linux/
|
37
35
|
lib_dirs += [
|
38
|
-
v8_dir + '/out/x64.release'
|
39
|
-
|
40
|
-
elsif RUBY_PLATFORM =~ /linux/
|
41
|
-
lib_dirs += [
|
42
|
-
v8_dir + '/out/x64.release/obj.target/tools/gyp',
|
43
|
-
v8_dir + '/out/x64.release/obj.target/third_party/icu'
|
36
|
+
v8_dir + '/out.gn/x64.release/obj/buildtools/third_party/libc++',
|
37
|
+
v8_dir + '/out.gn/x64.release/obj/buildtools/third_party/libc++abi'
|
44
38
|
]
|
39
|
+
end
|
45
40
|
|
41
|
+
dir_config('', header_dirs, lib_dirs)
|
42
|
+
|
43
|
+
if RUBY_PLATFORM =~ /linux/
|
46
44
|
RbConfig::MAKEFILE_CONFIG['CC'] = v8_dir + '/third_party/llvm-build/Release+Asserts/bin/clang'
|
47
45
|
RbConfig::MAKEFILE_CONFIG['CXX'] = v8_dir + '/third_party/llvm-build/Release+Asserts/bin/clang++'
|
48
46
|
end
|
49
47
|
|
50
|
-
|
48
|
+
$LDFLAGS << ' -lv8eval' +
|
49
|
+
' -lv8eval_ruby' +
|
50
|
+
' -lv8_libplatform' +
|
51
|
+
' -lv8_base' +
|
52
|
+
' -lv8_libbase' +
|
53
|
+
' -lv8_libsampler' +
|
54
|
+
' -lv8_init' +
|
55
|
+
' -lv8_initializers' +
|
56
|
+
' -lv8_nosnapshot' +
|
57
|
+
' -ltorque_generated_initializers'
|
58
|
+
$CPPFLAGS << ' -O3 -std=c++14 -stdlib=libc++'
|
51
59
|
|
52
|
-
|
53
|
-
$
|
60
|
+
if RUBY_PLATFORM =~ /linux/
|
61
|
+
$LDFLAGS << ' -lrt -lc++ -lc++abi'
|
62
|
+
$CPPFLAGS << ' -isystem' + v8_dir + '/buildtools/third_party/libc++/trunk/include' +
|
63
|
+
' -isystem' + v8_dir + '/buildtools/third_party/libc++abi/trunk/include'
|
64
|
+
end
|
54
65
|
|
55
66
|
create_makefile('v8eval/v8eval')
|
data/ruby/lib/v8eval.rb
CHANGED
@@ -58,22 +58,6 @@ module V8Eval
|
|
58
58
|
end
|
59
59
|
end
|
60
60
|
end
|
61
|
-
|
62
|
-
# Starts a debug server associated with the V8 instance.
|
63
|
-
# @param [Integer] port TCP/IP port the server will listen, at localhost.
|
64
|
-
# @return nil.
|
65
|
-
# @raise [TypeError] If port is not an int.
|
66
|
-
# @raise [V8Error] If failing to start the debug server.
|
67
|
-
def enable_debugger(port)
|
68
|
-
fail TypeError, 'port not integer' unless port.is_a?(Integer)
|
69
|
-
fail V8Error, 'failed to start debug server' unless @v8.enable_debugger(port)
|
70
|
-
end
|
71
|
-
|
72
|
-
# Stops the debug server, if running.
|
73
|
-
# @return nil.
|
74
|
-
def disable_debugger
|
75
|
-
@v8.disable_debugger
|
76
|
-
end
|
77
61
|
end
|
78
62
|
end
|
79
63
|
|