Skip to content
This repository was archived by the owner on Dec 4, 2023. It is now read-only.

Commit 4f976b4

Browse files
committed
Merge branch '6.7'
2 parents 17b93fd + a89f787 commit 4f976b4

33 files changed

+81
-1258
lines changed

.travis.yml

Lines changed: 10 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,19 @@
11
language: ruby
22
rvm:
3-
- 2.4.2
4-
- 2.3.5
5-
- 2.2
6-
- rbx
3+
- 2.5
4+
- 2.4
5+
- rubinius-3
76
matrix:
87
include:
9-
- rvm: 2.4.0
8+
- rvm: 2.5.1
109
os: osx
11-
osx_image: xcode8.2
12-
- rvm: 2.4.0
10+
osx_image: xcode9.4.1
11+
- rvm: 2.5.1
1312
os: osx
14-
osx_image: xcode7.3
15-
- os: osx
16-
osx_image: xcode6.4
17-
- os: osx
18-
osx_image: xcode9.1
19-
- rvm: system
20-
os: osx
21-
osx_image: xcode8.2
22-
- rvm: system
23-
os: osx
24-
osx_image: xcode7.3
25-
- rvm: system
26-
os: osx
27-
osx_image: xcode6.4
28-
- rvm: system
29-
os: osx
30-
osx_image: xcode9.1
31-
- rvm: ruby-2.3.1-clang
32-
env: CXX=clang++
33-
- rvm: 1.9.3
13+
osx_image: xcode9.2
3414
allow_failures:
35-
- rvm: 1.9.3
36-
- rvm: rbx
37-
- os: osx
38-
osx_image: xcode6.4
15+
- rvm: rubinius-3
3916
fast_finish: true
40-
dist: trusty
4117
addons:
4218
apt:
4319
packages:
@@ -51,7 +27,7 @@ before_install:
5127
- if [ "$TRAVIS_OS_NAME" == "osx" -a "$TRAVIS_RUBY_VERSION" != "system" ]; then gem update bundler; fi
5228
script:
5329
- git submodule update --init
54-
- MAKEFLAGS+=-j8 bundle exec rake spec binary --trace
30+
- bundle exec rake spec binary --trace
5531
deploy:
5632
provider: releases
5733
file: $(git ls-files -o pkg | head -1)
@@ -60,7 +36,7 @@ deploy:
6036
skip_cleanup: true
6137
on:
6238
tags: true
63-
condition: $TRAVIS_OS_NAME = osx
39+
# condition: $TRAVIS_OS_NAME = osx
6440
cache:
6541
bundler: true
6642
notifications:

CHANGELOG.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
### v6.7.288.46.0, v6.7.288.46.1 - 2017-07-06
2+
3+
* Update upstream v8 version to 6.7.288.46 (https://github.com/cowboyd/libv8/pull/258)
4+
Due to the change in V8's build system this causes several major changes until
5+
we're able to find a way to reimplement the necessary functionality. The changes
6+
are listed below.
7+
* Remove the option to specify --with-cxx. For now V8 is built with the
8+
toolchain provided by the build system (https://github.com/cowboyd/libv8/issues/260)
9+
* Remove the option to specify --with-system-v8. It was making it too easy for
10+
the user to shot themself in the foot.
11+
* Drop ARM support. The V8 build system is not working natively on ARM and for
12+
some reason crosscompilation produces X86 binaries
13+
(https://github.com/cowboyd/libv8/issues/261)
14+
* Drop FreeBSD support. Chromium's depot_tools do not support FreeBSD at this
15+
point. (https://github.com/cowboyd/libv8/issues/253)
16+
117
### v6.3.292.48.0, v6.3.292.48.1 - 2017-12-20
218

319
* Update upstream v8 version to 6.3.292.48

README.md

Lines changed: 9 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ source and binary form.
1111
### Why?
1212

1313
The goal of libv8 is two fold: provide a binary gem containing the a
14-
pre-compiled libv8.a for as many platforms as possible while at the
14+
pre-compiled libv8_monolith.a for as many platforms as possible while at the
1515
same time supporting for an automated compilation for all others.
1616

1717
Not only does this drastically reduce gem install times, but it also
@@ -23,13 +23,12 @@ opens the door for supporting Windows.
2323
That depends on your platform. Right now, we support the following
2424
platforms.
2525

26+
* x86_64-darwin-17
2627
* x86_64-darwin-16
2728
* x86_64-darwin-15
2829
* x86_64-darwin-14
2930
* x86_64-linux
3031
* x86-linux
31-
* x86_64-freebsd-10
32-
* x86_64-freebsd-11
3332

3433
If you don't see your platform on this list, first, make sure that it
3534
installs from source, and second talk to us about setting up a binary
@@ -74,28 +73,17 @@ source-based distribution
7473

7574
> This step release system is a workaround to carlhuda/bundler#1537
7675
77-
##### Use with different standard C libraries
78-
79-
The Linux binary versions of this gem are linked against the most used standard
80-
library - glibc. Currently rubygems has no mechanism to differentiate
81-
platform-specific gems by standard library so we have no way of distributing
82-
different binaries for different standard libraries.
83-
84-
What this means is that if you're running a distro that does not use glibc
85-
(like Alpine Linux), you'll have to use a source version of the gem.
86-
87-
Also, at the time of writing this, the Ruby version in Alpine's package
88-
repositories has been patched to not look to download binary versions of gems at
89-
all.
90-
9176
### Requirements
9277

9378
Building the V8 library from source imposes the following requirements:
9479

95-
* A compiler that supports C++11 (such as GCC 4.8 and above or clang,
96-
preferably 3.5 and above)
97-
* GNU Make
98-
* Python 2
80+
* An x86/x86_64 CPU. See [#261](https://github.com/cowboyd/libv8/issues/261) for ARM state.
81+
* Linux with glibc or macOS. See
82+
[#259](https://github.com/cowboyd/libv8/issues/259),
83+
[#253](https://github.com/cowboyd/libv8/issues/253) and
84+
[#217](https://github.com/cowboyd/libv8/issues/217) for state of other
85+
platforms.
86+
* Python 2
9987

10088
### Using a git version
10189

@@ -122,47 +110,6 @@ To get the source, these commands will get you started:
122110
bundle install
123111
bundle exec rake compile
124112

125-
### Bring your own V8
126-
127-
*This is a great way to ensure that the builds of all gems that depend on libv8
128-
fail. Please see the Gotchas section below and use the follwing instructions
129-
only if you know what you're doing. If you're resorting to this because the
130-
build of the gem is failing on your system or because there's no
131-
platform-specific gem for your platform, please open up an issue.*
132-
133-
Because libv8 is the interface for the V8 engine used by several gems, you may
134-
need to use libv8, even if you have V8 installed already. If you wish to use
135-
your own V8 installation, rather than have it built for you, use the
136-
`--with-system-v8` option.
137-
138-
Using RubyGems:
139-
140-
gem install libv8 -- --with-system-v8
141-
142-
Using Bundler (in your Gemfile):
143-
144-
bundle config build.libv8 --with-system-v8
145-
146-
#### Gotchas
147-
148-
Please note that if you intend to run your own V8, you must install
149-
both V8 *and its headers* (found in libv8-dev for Debian-based distros).
150-
151-
Also, keep in mind that V8's API does not tend to be stable and in case you're
152-
using your local version of V8 you *need* to **make sure that the the gems that
153-
depend on libv8 are compatible with the API of the version of V8 present on your
154-
system**. Otherwise those gems' builds *will* fail. Ideally you want the same
155-
version of V8 as the one packaged in the installed version of the gem. See the
156-
Versioning section for more information.
157-
158-
### Bring your own compiler
159-
160-
You can specify a compiler of your choice by either setting the `CXX`
161-
environment variable before compilation, or by adding the
162-
`--with-cxx=<compiler>` option to the bundle configuration:
163-
164-
bundle config build.libv8 --with-cxx=clang++
165-
166113
### About
167114

168115
This project spun off of
@@ -177,7 +124,6 @@ installed that gem.
177124
### Sponsored by
178125

179126
<a href="http://frontside.io">![The Frontside](/thefrontside.png)</a>
180-
<a href="https://www.scaleway.com">![Scaleway](/scaleway.png)</a>
181127

182128
### License
183129

Rakefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,12 @@ task :binary => :compile do
4343
# We don't need most things for the binary
4444
gemspec.files = []
4545
gemspec.files += ['lib/libv8.rb', 'lib/libv8/version.rb']
46-
gemspec.files += ['ext/libv8/arch.rb', 'ext/libv8/location.rb', 'ext/libv8/paths.rb']
46+
gemspec.files += ['ext/libv8/location.rb', 'ext/libv8/paths.rb']
4747
gemspec.files += ['ext/libv8/.location.yml']
4848

4949
# V8
5050
gemspec.files += Dir['vendor/v8/include/**/*.h']
51-
gemspec.files += Dir['vendor/v8/out/**/*.a']
51+
gemspec.files += Dir['vendor/v8/out.gn/**/*.a']
5252

5353
FileUtils.chmod 0644, gemspec.files
5454
FileUtils.mkdir_p 'pkg'

ext/libv8/builder.rb

Lines changed: 22 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -5,79 +5,40 @@
55
require 'rbconfig'
66
require 'shellwords'
77
require 'libv8/version'
8-
require File.expand_path '../compiler', __FILE__
98
require File.expand_path '../arch', __FILE__
10-
require File.expand_path '../make', __FILE__
11-
require File.expand_path '../patcher', __FILE__
129

1310
module Libv8
1411
class Builder
1512
include Libv8::Arch
16-
include Libv8::Make
17-
include Libv8::Patcher
1813

19-
def initialize
20-
@compiler = choose_compiler
14+
def gn_args
15+
%W(is_debug=#{debug_build? ? 'true' : 'false'}
16+
symbol_level=#{debug_build? ? '-1' : '0'}
17+
is_component_build=false
18+
v8_monolithic=true
19+
v8_use_external_startup_data=false
20+
target_cpu="#{libv8_arch}"
21+
v8_target_cpu="#{libv8_arch}"
22+
treat_warnings_as_errors=false
23+
v8_enable_i18n_support=false).join(' ')
2124
end
2225

23-
def make_target
24-
profile = enable_config('debug') ? 'debug' : 'release'
25-
"#{libv8_arch}.#{profile}"
26+
def generate_gn_args
27+
system "gn gen out.gn/libv8 --args='#{gn_args}'"
2628
end
2729

28-
def gyp_defines(*defines)
29-
# Do not use an external snapshot as we don't really care for binary size
30-
defines << 'v8_use_external_startup_data=0'
31-
32-
# Do not use the embedded toolchain
33-
defines << 'use_sysroot=0'
34-
defines << 'linux_use_bundled_binutils=0'
35-
defines << 'linux_use_bundled_gold=0'
36-
defines << 'make_clang_dir=""'
37-
defines << 'clang_dir=""'
38-
39-
# Pass clang flag to GYP in order to work around GCC compilation failures
40-
defines << "clang=#{@compiler.is_a?(Compiler::Clang) ? '1' : '0'}"
41-
42-
# Add contents of the GYP_DEFINES environment variable if present
43-
defines << ENV['GYP_DEFINES'] unless ENV['GYP_DEFINES'].nil?
44-
45-
"GYP_DEFINES=\"#{defines.join ' '}\""
46-
end
47-
48-
def make_flags(*flags)
49-
# Disable i18n
50-
flags << 'i18nsupport=off'
51-
52-
# Solaris / Smart OS requires additional -G flag to use with -fPIC
53-
flags << "CFLAGS=-G" if @compiler.target =~ /solaris/
54-
55-
# Disable werror as this version of v8 is getting difficult to maintain
56-
# with it on
57-
flags << 'werror=no'
58-
59-
# Append GYP variable definitions
60-
flags << gyp_defines
61-
62-
# Append manually specified MAKEFLAGS
63-
flags << ENV['MAKEFLAGS'] if ENV['MAKEFLAGS']
64-
ENV['MAKEFLAGS'] = nil
65-
66-
"#{make_target} #{flags.join ' '}"
30+
def debug_build?
31+
enable_config('debug')
6732
end
6833

6934
def build_libv8!
7035
setup_python!
7136
setup_build_deps!
7237
Dir.chdir(File.expand_path('../../../vendor/v8', __FILE__)) do
73-
fail 'No compilers available' if @compiler.nil?
74-
patch!
75-
print_build_info
7638
puts 'Beginning compilation. This will take some time.'
39+
generate_gn_args
7740

78-
command = "env CXX=#{Shellwords.escape @compiler.to_s} #{make} #{make_flags}"
79-
puts "Building v8 with #{command}"
80-
system command
41+
system 'ninja -v -C out.gn/libv8 v8_monolith'
8142
end
8243
return $?.exitstatus
8344
end
@@ -112,56 +73,30 @@ def source_version
11273
#
11374
def setup_build_deps!
11475
ENV['PATH'] = "#{File.expand_path('../../../vendor/depot_tools', __FILE__)}:#{ENV['PATH']}"
76+
11577
Dir.chdir(File.expand_path('../../../vendor', __FILE__)) do
116-
unless Dir.exists? 'v8'
117-
system "env #{gyp_defines} fetch v8" or fail "unable to fetch v8 source"
118-
else
119-
system "env #{gyp_defines} gclient fetch" or fail "could not fetch v8 build dependencies commits"
78+
unless Dir.exists?('v8') || File.exists?('.gclient')
79+
system "fetch v8" or fail "unable to fetch v8 source"
12080
end
81+
12182
Dir.chdir('v8') do
83+
system 'git fetch origin'
12284
unless system "git checkout #{source_version}"
12385
fail "unable to checkout source for v8 #{source_version}"
12486
end
125-
system "env #{gyp_defines} gclient sync" or fail "could not sync v8 build dependencies"
126-
system "git checkout Makefile" # Work around a weird bug on FreeBSD
87+
system "gclient sync" or fail "could not sync v8 build dependencies"
12788
end
12889
end
12990
end
13091

13192
private
13293

133-
def choose_compiler
134-
compiler = if with_config('cxx') || ENV['CXX']
135-
with_config('cxx') || ENV['CXX']
136-
else
137-
begin
138-
MakeMakefile::CONFIG['CXX'] # stdlib > 2.0.0
139-
rescue NameError
140-
RbConfig::CONFIG['CXX'] # stdlib < 2.0.0
141-
end
142-
end
143-
144-
Libv8::Compiler.type_of(compiler).new compiler
145-
end
146-
14794
def python_version
14895
if system 'which python 2>&1 > /dev/null'
14996
`python -c 'import platform; print(platform.python_version())'`.chomp
15097
else
15198
"not available"
15299
end
153100
end
154-
155-
def print_build_info
156-
puts "Compiling v8 for #{libv8_arch}"
157-
158-
puts "Using python #{python_version}"
159-
160-
puts "Using compiler: #{@compiler} (#{@compiler.name} version #{@compiler.version})"
161-
unless @compiler.compatible?
162-
warn "Unable to find a compiler officially supported by v8."
163-
warn "It is recommended to use clang v3.5 or GCC v4.8 or higher"
164-
end
165-
end
166101
end
167102
end

0 commit comments

Comments
 (0)