libv8 3.16.14.3 → 3.16.14.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 04c80c22b9645f11ff0916bf95d18a23cc6837c1
4
- data.tar.gz: 11ba356b2faa6c9ebff5c14f6b836b4189fdfb35
3
+ metadata.gz: 9b5ca0adef389868bd9b38aa3838d79fd4ce0b86
4
+ data.tar.gz: 9d9b1024787acb57297050fc139a31692b6fce4f
5
5
  SHA512:
6
- metadata.gz: 50f823acc2eba5c9126dff2de946b97d746875b263affa7da8e688ff1cba512bbf8b0c1f3a93e420be4b3a68baff58c6570e478d069707ce01df59a09114a1a0
7
- data.tar.gz: a7463d396e8c59f0a4330b54c253d7a1b58a8bdd010ba7a53b20c6df598dd229d3be7c3f03ac6ef16565a8117e6630118817376d5354bdf0a8f0cd1ef04feb57
6
+ metadata.gz: 0a7f48927eaef75a822eca0bd2a8e841f87d4d22784bc989e99577496430f96ded65c6f1eb12e7e4a20335c7b3fb4f14c606e71e8ec77064323abd8b90b06667
7
+ data.tar.gz: e4cecdcc0c59c16ac14b275a969c6495be3b459fde3b93fabb886a8036e32390b5db1d91fa62be170050ea0e2e384ce0b9f9a428046510899aa347a359f0adaf
@@ -1,12 +1,12 @@
1
1
  rvm:
2
2
  - 2.0.0
3
- - 1.9.2
3
+ - 2.1.0
4
4
  - 1.9.3
5
- - rbx-19mode
5
+ - rbx-2
6
6
  notifications:
7
7
  recipients:
8
8
  - cowboyd@thefrontside.net
9
9
  - bordjukov@gmail.com
10
10
  before_install:
11
11
  - sudo apt-get update
12
- - sudo apt-get install git-svn
12
+ - sudo apt-get install git-svn
data/README.md CHANGED
@@ -21,10 +21,13 @@ platforms.
21
21
  * x86_64-darwin10.7.0
22
22
  * x86_64-darwin-10
23
23
  * x86_64-darwin-11
24
- * x86_64-darwin-10
24
+ * x86_64-darwin-12
25
+ * x86_64-darwin-13
25
26
  * x86_64-linux
26
27
  * x86-linux
27
28
  * x86_64-freebsd-9
29
+ * x86_64-freebsd-10
30
+ * x86_64-solaris-2.11
28
31
 
29
32
  If you don't see your platform on this list, first, make sure that it
30
33
  installs from source, and second talk to us about setting up a binary
@@ -38,19 +41,6 @@ own point release after the main v8 version. So libv8 `3.11.8.5` and
38
41
  think about it would be that `3.11.8.14` is the 14th release of the
39
42
  libv8 rubygem based on v8 version `3.11.8`
40
43
 
41
- ### Using a git version
42
-
43
- If you want to use the latest unstable version of the gem you can do
44
- so by specifying the git repo as a gem source. Just add the following
45
- to your `Gemfile`:
46
-
47
- ```Ruby
48
- gem "libv8", git: "git://github.com/cowboyd/libv8.git", submodules: true
49
- ```
50
-
51
- You can find more info on using a git repo as a gem source in
52
- [Bundler's documentation](http://bundler.io/v1.3/git.html).
53
-
54
44
  #### Source and Binary Releases
55
45
 
56
46
  Starting with libv8 `3.11.8.0`, all even point releases contain
@@ -70,6 +60,19 @@ distribution
70
60
 
71
61
  > This step release system is a workaround to carlhuda/bundler#1537
72
62
 
63
+ ### Using a git version
64
+
65
+ If you want to use the latest unstable version of the gem you can do
66
+ so by specifying the git repo as a gem source. Just make sure you have
67
+ `git-svn` and add the following to your `Gemfile`:
68
+
69
+ ```Ruby
70
+ gem "libv8", git: "git://github.com/cowboyd/libv8.git", submodules: true
71
+ ```
72
+
73
+ You can find more info on using a git repo as a gem source in
74
+ [Bundler's documentation](http://bundler.io/v1.3/git.html).
75
+
73
76
  ### What if I can't install from source?
74
77
 
75
78
  If you can fix the "Makefile" so that it correctly compiles for your
@@ -88,7 +91,7 @@ To get the source, these commands will get you started:
88
91
  Because libv8 is the interface for the V8 engine used by
89
92
  [therubyracer](http://github.com/cowboyd/therubyracer), you may need
90
93
  to use libv8, even if you have V8 installed already. If you wish to
91
- use your own V8 installation, rather than have it built for you, use
94
+ use your own V8 installation, rather than have it built for you, use
92
95
  the `--with-system-v8` option.
93
96
 
94
97
  Using RubyGems:
@@ -102,6 +105,14 @@ Using Bundler (in your Gemfile):
102
105
  Please note that if you intend to run your own V8, you must install
103
106
  both V8 *and its headers* (found in libv8-dev for Debian distros).
104
107
 
108
+ ### Bring your own compiler
109
+
110
+ You can specify a compiler of your choice by either setting the `CXX`
111
+ environment variable before compilation, or by adding the
112
+ `--with-cxx=<compiler>` option to the bundle configuration:
113
+
114
+ bundle config build.libv8 --with-cxx=clang++
115
+
105
116
  ### About
106
117
 
107
118
  This project spun off of
@@ -3,13 +3,18 @@ require File.expand_path '../compiler', __FILE__
3
3
  require File.expand_path '../arch', __FILE__
4
4
  require File.expand_path '../make', __FILE__
5
5
  require File.expand_path '../checkout', __FILE__
6
+ require File.expand_path '../patcher', __FILE__
6
7
 
7
8
  module Libv8
8
9
  class Builder
9
10
  include Libv8::Arch
10
- include Libv8::Compiler
11
11
  include Libv8::Make
12
12
  include Libv8::Checkout
13
+ include Libv8::Patcher
14
+
15
+ def initialize
16
+ @compiler = choose_compiler
17
+ end
13
18
 
14
19
  def make_flags(*flags)
15
20
  profile = enable_config('debug') ? 'debug' : 'release'
@@ -17,33 +22,38 @@ module Libv8
17
22
  # FreeBSD uses gcc 4.2 by default which leads to
18
23
  # compilation failures due to warnings about aliasing.
19
24
  # http://svnweb.freebsd.org/ports/head/lang/v8/Makefile?view=markup
20
- flags << "strictaliasing=off" if RUBY_PLATFORM.include?("freebsd") and !check_gcc_compiler(compiler)
25
+ flags << "strictaliasing=off" if @compiler.is_a?(Compiler::GCC) and @compiler.version < '4.4'
21
26
 
22
27
  # Avoid compilation failures on the Raspberry Pi.
23
- flags << "vfp2=off vfp3=off" if RUBY_PLATFORM.include? "arm"
28
+ flags << "vfp2=off vfp3=off" if @compiler.target.include? "arm"
24
29
 
25
30
  # FIXME: Determine when to activate this instead of leaving it on by
26
31
  # default.
27
- flags << "hardfp=on" if RUBY_PLATFORM.include? "arm"
32
+ flags << "hardfp=on" if @compiler.target.include? "arm"
28
33
 
29
34
  # Fix Malformed archive issue caused by GYP creating thin archives by
30
35
  # default.
31
36
  flags << "ARFLAGS.target=crs"
32
37
 
33
38
  # Solaris / Smart OS requires additional -G flag to use with -fPIC
34
- flags << "CFLAGS=-G" if RUBY_PLATFORM =~ /solaris/
39
+ flags << "CFLAGS=-G" if @compiler.target =~ /solaris/
40
+
41
+ # Disable werror as this version of v8 is getting difficult to maintain
42
+ # with it on
43
+ flags << 'werror=no'
35
44
 
36
45
  "#{libv8_arch}.#{profile} #{flags.join ' '}"
37
46
  end
38
47
 
39
48
  def build_libv8!
40
49
  Dir.chdir(V8_Source) do
50
+ fail 'No compilers available' if @compiler.nil?
41
51
  checkout!
42
52
  setup_python!
43
53
  setup_build_deps!
44
- apply_patches!
54
+ patch! *patch_directories_for(@compiler)
45
55
  print_build_info
46
- puts `env CXX=#{compiler} LINK=#{compiler} #{make} #{make_flags}`
56
+ puts `env CXX=#{@compiler} LINK=#{@compiler} #{make} #{make_flags}`
47
57
  end
48
58
  return $?.exitstatus
49
59
  end
@@ -69,19 +79,21 @@ module Libv8
69
79
  `ln -fs #{GYP_Source} build/gyp`
70
80
  end
71
81
 
72
- def apply_patches!
73
- File.open(".applied_patches", File::RDWR|File::CREAT) do |f|
74
- available_patches = Dir.glob(File.expand_path '../../../patches/*.patch', __FILE__).sort
75
- applied_patches = f.readlines.map(&:chomp)
82
+ private
76
83
 
77
- (available_patches - applied_patches).each do |patch|
78
- `patch -p1 -N < #{patch}`
79
- f.puts patch
80
- end
81
- end
82
- end
84
+ def choose_compiler
85
+ compiler_names = if with_config('cxx') then [with_config('cxx')]
86
+ elsif ENV['CXX'] then [ENV['CXX']]
87
+ else Compiler::KNOWN_COMPILERS
88
+ end
83
89
 
84
- private
90
+ available_compilers = Compiler.available_compilers(*compiler_names)
91
+ compatible_compilers = available_compilers.select(&:compatible?)
92
+
93
+ unless compatible_compilers.empty? then compatible_compilers
94
+ else available_compilers
95
+ end.first
96
+ end
85
97
 
86
98
  def python_version
87
99
  if system 'which python 2>&1 > /dev/null'
@@ -96,8 +108,8 @@ module Libv8
96
108
 
97
109
  puts "Using python #{python_version}"
98
110
 
99
- puts "Using compiler: #{compiler}"
100
- unless check_gcc_compiler compiler
111
+ puts "Using compiler: #{@compiler} (#{@compiler.name} version #{@compiler.version})"
112
+ unless @compiler.compatible?
101
113
  warn "Unable to find a compiler officially supported by v8."
102
114
  warn "It is recommended to use GCC v4.4 or higher"
103
115
  end
@@ -1,50 +1,42 @@
1
+ require 'mkmf'
2
+ require 'open3'
3
+ require File.expand_path '../compiler/generic_compiler', __FILE__
4
+ require File.expand_path '../compiler/gcc', __FILE__
5
+ require File.expand_path '../compiler/clang', __FILE__
6
+
1
7
  module Libv8
2
8
  module Compiler
3
- module_function
4
-
5
- def compiler
6
- unless defined?(@compiler)
7
- cc = check_gcc_compiler with_config("cxx")
8
- cc ||= check_gcc_compiler ENV["CXX"]
9
- cc ||= check_gcc_compiler "g++"
9
+ KNOWN_COMPILERS = [
10
+ 'c++',
11
+ 'g++48', 'g++46', 'g++44', 'g++',
12
+ 'clang++',
13
+ ]
10
14
 
11
- # Check alternative GCC names
12
- # These are common on BSD's after
13
- # GCC has been installed by a port
14
- cc ||= check_gcc_compiler "g++44"
15
- cc ||= check_gcc_compiler "g++46"
16
- cc ||= check_gcc_compiler "g++48"
17
-
18
- if cc.nil?
19
- warn "Unable to find a compiler officially supported by v8."
20
- warn "It is recommended to use GCC v4.4 or higher"
21
- @compiler = cc = 'g++'
22
- end
23
-
24
- @compiler = cc
25
- end
15
+ module_function
26
16
 
27
- @compiler
17
+ def system_compilers
18
+ available_compilers *Compiler::KNOWN_COMPILERS
28
19
  end
29
20
 
30
- def check_gcc_compiler(name)
31
- # in SmartOS, `which` returns success with no arguments. 'with_config' above may return nil
32
- return nil if "#{name}".empty?
33
-
34
- compiler = `which #{name} 2> /dev/null`
35
- return nil unless $?.success?
36
-
37
- compiler.chomp!
38
- return nil unless `#{compiler} --version` =~ /([0-9]\.[0-9]\.[0-9])/
21
+ def available_compilers(*compiler_names)
22
+ compiler_paths = compiler_names.map { |name| find name }.reject &:nil?
23
+ end
39
24
 
40
- return nil if $1 < "4.4"
41
- compiler
25
+ def find(name)
26
+ return nil if name.empty?
27
+ path, _, status = Open3.capture3 "which #{name}"
28
+ path.chomp!
29
+ determine_type(path).new(path) if status.success?
42
30
  end
43
31
 
44
- def check_clang_compiler(name)
45
- compiler = `which #{name} 2> /dev/null`
46
- return nil unless $?.success?
47
- compiler.chomp
32
+ def determine_type(compiler_path)
33
+ compiler_version = Open3.capture3("#{compiler_path} -v")[0..1].join
34
+
35
+ case compiler_version
36
+ when /\bclang\b/i then Clang
37
+ when /^gcc/i then GCC
38
+ else GenericCompiler
39
+ end
48
40
  end
49
41
  end
50
42
  end
@@ -0,0 +1,15 @@
1
+ module Libv8
2
+ module Compiler
3
+ class Clang < GenericCompiler
4
+ VERSION_REGEXP = /clang version (\d+\.\d+(\.\d+)*) \(/i
5
+
6
+ def name
7
+ 'clang'
8
+ end
9
+
10
+ def compatible?
11
+ version >= '3.1'
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,15 @@
1
+ module Libv8
2
+ module Compiler
3
+ class GCC < GenericCompiler
4
+ VERSION_REGEXP = /gcc version (\d+\.\d+(\.\d+)*)/i
5
+
6
+ def name
7
+ 'GCC'
8
+ end
9
+
10
+ def compatible?
11
+ version > '4.3' and version < '5'
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,38 @@
1
+ module Libv8
2
+ module Compiler
3
+ class GenericCompiler
4
+ VERSION_REGEXP = /(\d+\.\d+(\.\d+)*)/
5
+ TARGET_REGEXP = /Target: ([a-z0-9\-_.]*)/
6
+
7
+ def initialize(path)
8
+ @path = path
9
+ end
10
+
11
+ def name
12
+ File.basename @path
13
+ end
14
+
15
+ def to_s
16
+ @path
17
+ end
18
+
19
+ def version
20
+ call('-v')[0..1].join =~ VERSION_REGEXP
21
+ $1
22
+ end
23
+
24
+ def target
25
+ call('-v')[0..1].join =~ TARGET_REGEXP
26
+ $1
27
+ end
28
+
29
+ def compatible?
30
+ false
31
+ end
32
+
33
+ def call(*arguments)
34
+ Open3.capture3 arguments.unshift(@path).join(' ')
35
+ end
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,55 @@
1
+ module Libv8
2
+ module Patcher
3
+ PATCH_DIRECTORY = File.expand_path '../../../patches', __FILE__
4
+
5
+ module_function
6
+
7
+ def patch_directories_for(compiler)
8
+ patch_directories = []
9
+
10
+ case
11
+ when compiler.target =~ /arm/
12
+ patch_directories << 'arm'
13
+ end
14
+
15
+ case compiler
16
+ when Compiler::GCC
17
+ patch_directories << 'gcc48' if compiler.version >= '4.8'
18
+ when Compiler::Clang
19
+ patch_directories << 'clang'
20
+ patch_directories << 'clang33' if compiler.version >= '3.3'
21
+ patch_directories << 'clang51' if compiler.version >= '5.1'
22
+ end
23
+
24
+ patch_directories
25
+ end
26
+
27
+ def patch_directories(*additional_directories)
28
+ absolute_paths = [PATCH_DIRECTORY]
29
+
30
+ additional_directories.each do |directory|
31
+ absolute_paths << File.join(PATCH_DIRECTORY, directory)
32
+ end
33
+
34
+ absolute_paths.uniq
35
+ end
36
+
37
+ def patches(*additional_directories)
38
+ patch_directories(*additional_directories).map do |directory|
39
+ Dir.glob(File.join directory, '*.patch')
40
+ end.flatten.sort
41
+ end
42
+
43
+ def patch!(*additional_directories)
44
+ File.open(".applied_patches", File::RDWR|File::CREAT) do |f|
45
+ available_patches = patches *additional_directories
46
+ applied_patches = f.readlines.map(&:chomp)
47
+
48
+ (available_patches - applied_patches).each do |patch|
49
+ `patch -p1 -N < #{patch}`
50
+ f.puts patch
51
+ end
52
+ end
53
+ end
54
+ end
55
+ end
@@ -1,3 +1,3 @@
1
1
  module Libv8
2
- VERSION = "3.16.14.3"
2
+ VERSION = "3.16.14.4"
3
3
  end
@@ -32,5 +32,6 @@ Gem::Specification.new do |s|
32
32
  s.add_development_dependency "rake-compiler"
33
33
  s.add_development_dependency "rspec"
34
34
  s.add_development_dependency "rspec-spies"
35
+ s.add_development_dependency "rubysl", "~> 2.0" if RUBY_ENGINE == "rbx"
35
36
  s.add_development_dependency "vulcan"
36
37
  end
@@ -0,0 +1,13 @@
1
+ diff --git a/build/common.gypi b/build/common.gypi
2
+ index 3a59639..594abe4 100644
3
+ --- a/build/common.gypi
4
+ +++ b/build/common.gypi
5
+ @@ -173,7 +173,6 @@
6
+ [ 'v8_use_arm_eabi_hardfloat=="true"', {
7
+ 'defines': [
8
+ 'USE_EABI_HARDFLOAT=1',
9
+ - 'CAN_USE_VFP2_INSTRUCTIONS',
10
+ ],
11
+ 'target_conditions': [
12
+ ['_toolset=="target"', {
13
+