v8eval 0.2.3 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 5bc796827b31875adb19bac6160324a239cc8183
4
- data.tar.gz: f9ca3808367a62bc6fd3faeebcdceec9ae162d49
2
+ SHA256:
3
+ metadata.gz: 38af0f6fe5626a1d4085a15e351c3a2ca9ab95dd339e64544395a65fbc8257a7
4
+ data.tar.gz: 0c40757c5d114ca97016305f76d1f15f6588c851ff4cbb159051c7ffc39b9286
5
5
  SHA512:
6
- metadata.gz: adbeb2fcbec1a4efc82896284670625bb10b3feb8637324014e2807b45452c1adb55cb0d7e7367c7778941224160a863c7b3d60ca8609389479fdfe0cc3a04b3
7
- data.tar.gz: 31330901707a0c19eb9c4761825883ace6feebad783ef7274bc7b096b9b524c8754297a467e39efdac01c0c4675baf14cc2755c5f2edced82f509f272e0d9ed6
6
+ metadata.gz: 9c6288b4e68243dda6b9e8864c652d1dfc52e53e1732aed94f4edfc80f9a129d272bec410ff08698e647bf8344a69cf4d97f11a137179e754809149dd8d6b7ff
7
+ data.tar.gz: 5da63b2067f21399151e798c27a55e398d7b8818d25fae7c04f97e807e0c19c377046665d8d31dd4f16bbce7760bcdfee1307048e4e99c41ade5b4b2bf521e30
@@ -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
- test/googletest/googletest/include
15
+ v8/third_party/googletest/src/googletest/include
19
16
  )
20
17
 
21
- if(APPLE)
22
- link_directories(
23
- v8/out/x64.release
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
- link_directories(
29
- v8/out/x64.release/obj.target/tools/gyp
30
- v8/out/x64.release/obj.target/third_party/icu
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
- uv/.libs/
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++11
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
  [![PyPI version](https://badge.fury.io/py/v8eval.svg)](http://badge.fury.io/py/v8eval)
4
4
  [![Gem Version](https://badge.fury.io/rb/v8eval.svg)](https://badge.fury.io/rb/v8eval)
5
- [![GoDoc](https://godoc.org/github.com/sony/v8eval/go/v8eval?status.png)](http://godoc.org/github.com/sony/v8eval/go/v8eval)
5
+ [![GoDoc](https://godoc.org/github.com/sony/v8eval/go/v8eval?status.svg)](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 5.1 and supports Linux and Mac OS X.
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
- git clone https://github.com/sony/v8eval.git $GOPATH/src/github.com/sony/v8eval
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" ] ; then
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
- install_depot_tools() {
29
- export PATH=$V8EVAL_ROOT/depot_tools:$PATH
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
- cd $V8EVAL_ROOT
35
- git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
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
- install_googletest() {
39
- if [ -d $V8EVAL_ROOT/test/googletest ]; then
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/test
44
- git clone https://github.com/google/googletest.git
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 5.1.117
57
- CFLAGS="-fPIC" CXXFLAGS="-fPIC" make x64.release -j$NUM_CPU_CORES V=1
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
- install_libuv() {
61
- if [ -d $V8EVAL_ROOT/uv ]; then
45
+ archive_lib() {
46
+ if [ -f ${1}/lib${2}.a ]; then
62
47
  return 0
63
48
  fi
64
49
 
65
- cd $V8EVAL_ROOT
66
- git clone https://github.com/libuv/libuv.git uv
67
- cd uv
68
- git checkout v1.7.5
69
- sh autogen.sh
70
- ./configure --with-pic --disable-shared
71
- make V=1
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
- install_libuv
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
- install_googletest
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 subcommand
103
- SUBCOMMAND="$1";
104
- case "${SUBCOMMAND}" in
105
- "" ) build ;;
106
- "docs" ) docs ;;
107
- "test" ) test ;;
108
- * ) echo "unknown subcommand: ${SUBCOMMAND}"; exit 1 ;;
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
@@ -2,5 +2,5 @@
2
2
  source 'https://rubygems.org'
3
3
 
4
4
  gem 'rspec', '~> 3.0'
5
- gem 'rake', '~> 10.4.2'
6
- gem 'yard', '~> 0.8.7.6'
5
+ gem 'rake', '>= 12.3.3'
6
+ gem 'yard', '>= 0.9.11'
@@ -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 bundle
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 ;;
@@ -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
- uv_dir + '/.libs',
30
+ v8_dir + '/out.gn/x64.release/obj',
33
31
  LIBDIR
34
32
  ]
35
33
 
36
- if RUBY_PLATFORM =~ /darwin/
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
- dir_config('', header_dirs, lib_dirs)
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
- $LDFLAGS << ' -lv8eval -lv8eval_ruby -lv8_libplatform -lv8_base -lv8_libbase -lv8_nosnapshot -licui18n -licuuc -licudata -luv'
53
- $CPPFLAGS << ' -g -O3 -std=c++11'
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')
@@ -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