sq_mini_racer 0.2.5.0.2 → 0.3.1.0.0

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
2
  SHA256:
3
- metadata.gz: 124526376fa9a93ba73fd7205e15abca399022b37b91f5f6fd994ecadaf63714
4
- data.tar.gz: 5a20fb645e0fbf6f8da6b4bdfbda258f29c05e6d9861928a28c2f2b0311bf7f1
3
+ metadata.gz: f5a4f1dcba4f3dd9929c02a63a4ca5e123626c670aec78dd1bd99e045b4406ef
4
+ data.tar.gz: 162ccdbc01829df6b722e885d6242c17764373b66d5610287a7604d6dcf9dbc1
5
5
  SHA512:
6
- metadata.gz: b2cb15116b9cda7b82245dee09f93f02cb4634911ef29d2606d084436b7d0d284b6940d69cbc8fd8dc83bfb865b586c943f0c4e13513b8c66ed2437116aaa340
7
- data.tar.gz: f09c7e9b3ad2c3a34514bca93b5f209e1f49a2d8b873a0edf4f1ec0ba55c16dad035809a71364b7da1a817a8677342ed63cbd6a8bd0c4e588db6ee10b3b035af
6
+ metadata.gz: b3182e0f36469dbc4a2d5a254c879f7bfb51d1dd2abe903284cb9aefaecc8743fdd16408dec1ae58ab61e90b1e19c61152dbc80ed4d9c92f550684469c80e2b9
7
+ data.tar.gz: ab44723c482430200ffc20a127cc27672020de03a22e1edd84a42212166742dbe006173951bd345a0f76437ab6186cb5078faa7de2b5d6d41d27df8a0c2f3109
data/.gitignore CHANGED
@@ -11,3 +11,12 @@ lib/*.so
11
11
  /lib/sq_mini_racer/
12
12
  /ext/mini_racer_extension/mini_racer.creator.*
13
13
  *.bundle
14
+ /mini_racer.config
15
+ /mini_racer.creator
16
+ /mini_racer.creator.user
17
+ /mini_racer.files
18
+ /mini_racer.includes
19
+ /compile_commands.json
20
+ /.vscode/
21
+ /.clangd/
22
+ /.idea/
data/CHANGELOG CHANGED
@@ -1,3 +1,76 @@
1
+ - Unreleased
2
+
3
+ - FIX: on downgrade mkmf was picking the wrong version of libv8, this fix will correct future issues
4
+
5
+ - 23-07-2020
6
+
7
+ - 0.3.1
8
+
9
+ - FIX: specify that libv8 must be larger than 8.4.255 but smaller than 8.5, this avoids issues going forward
10
+
11
+ - 22-07-2020
12
+
13
+ - 0.3.0
14
+
15
+ - FEATURE: upgraded to libv8 version 8.4.255.0
16
+
17
+ - 29-06-2020
18
+
19
+ - 0.2.15
20
+
21
+ - FEATURE: basic wasm support via pump_message_loop
22
+
23
+ - 15-05-2020
24
+
25
+ - 0.2.14
26
+
27
+ - FIX: ensure_gc_after_idle should take in milliseconds like the rest of the APIs not seconds
28
+ - FEATURE: strict params on MiniRacer::Context.new
29
+
30
+ - 15-05-2020
31
+
32
+ - 0.2.13
33
+
34
+ - FIX: edge case around ensure_gc_after_idle possibly firing when context is not idle
35
+
36
+ - 15-05-2020
37
+
38
+ - 0.2.12
39
+
40
+ - FEATURE: isolate.low_memory_notification which can force a full GC
41
+ - FEATURE: MiniRacer::Context.new(ensure_gc_after_idle: 2) - to force full GC 2 seconds after context is idle, this allows you to conserve memory on isolates
42
+
43
+ - 14-05-2020
44
+
45
+ - 0.2.11
46
+
47
+ - FIX: dumping heap snapshots was not flushing the file leading to corrupt snapshots
48
+ - FIX: a use-after-free shutdown crash
49
+
50
+ - 0.2.10
51
+
52
+ - 22-04-2020
53
+
54
+ - FEATURE: memory softlimit support for nogvl_context_call
55
+
56
+ - 0.2.9
57
+
58
+ - 09-01-2020
59
+
60
+ - FIX: correct segfault when JS returns a Symbol and properly cast to ruby symbol
61
+
62
+ - 0.2.8
63
+
64
+ - 11-11-2019
65
+
66
+ - FIX: ensure thread live cycle is properly accounter for following file descriptor fix
67
+
68
+ - 0.2.7
69
+
70
+ - 11-11-2019
71
+
72
+ - FIX: release the file descriptor for timeout pipe earlier (this avoids holding too many files open in Ruby 2.7)
73
+
1
74
  - 14-05-2019
2
75
 
3
76
  - 0.2.6
data/Dockerfile CHANGED
@@ -20,4 +20,3 @@ RUN bundle exec rake compile
20
20
 
21
21
  COPY . /code/
22
22
  CMD bundle exec irb -rmini_racer
23
-
data/README.md CHANGED
@@ -234,12 +234,17 @@ context = MiniRacer::Context.new(isolate: isolate)
234
234
  # give up to 100ms for V8 garbage collection
235
235
  isolate.idle_notification(100)
236
236
 
237
+ # force V8 to perform a full GC
238
+ isolate.low_memory_notification
239
+
237
240
  ```
238
241
 
239
242
  This can come in handy to force V8 GC runs for example in between requests if you use MiniRacer on a web application.
240
243
 
241
244
  Note that this method maps directly to [`v8::Isolate::IdleNotification`](http://bespin.cz/~ondras/html/classv8_1_1Isolate.html#aea16cbb2e351de9a3ae7be2b7cb48297), and that in particular its return value is the same (true if there is no further garbage to collect, false otherwise) and the same caveats apply, in particular that `there is no guarantee that the [call will return] within the time limit.`
242
245
 
246
+ Additionally you may automate this process on a context by defining it with `MiniRacer::Content.new(ensure_gc_after_idle: 1000)`. Using this will ensure V8 will run a full GC using `context.isolate.low_memory_notification` 1 second after the last eval on the context. Low memory notification is both slower and more aggressive than an idle_notification and will ensure long living isolates use minimal amounts of memory.
247
+
243
248
  ### V8 Runtime flags
244
249
 
245
250
  It is possible to set V8 Runtime flags:
@@ -277,7 +282,7 @@ context.eval js
277
282
  The same code without the harmony runtime flag results in a `MiniRacer::RuntimeError: RangeError: Maximum call stack size exceeded` exception.
278
283
  Please refer to http://node.green/ as a reference on other harmony features.
279
284
 
280
- A list of all V8 runtime flags can be found using `node --v8-options`, or else by perusing [the V8 source code for flags (make sure to use the right version of V8)](https://github.com/v8/v8/blob/master/src/flag-definitions.h).
285
+ A list of all V8 runtime flags can be found using `node --v8-options`, or else by perusing [the V8 source code for flags (make sure to use the right version of V8)](https://github.com/v8/v8/blob/master/src/flags/flag-definitions.h).
281
286
 
282
287
  Note that runtime flags must be set before any other operation (e.g. creating a context, a snapshot or an isolate), otherwise an exception will be thrown.
283
288
 
@@ -314,6 +319,16 @@ context.eval("a = 2")
314
319
  # nothing works on the context from now on, its a shell waiting to be disposed
315
320
  ```
316
321
 
322
+ A MiniRacer context can also be dumped in a heapsnapshot file using `#write_heap_snapshot(file_or_io)`
323
+
324
+ ```ruby
325
+ context = MiniRacer::Context.new(timeout: 5)
326
+ context.eval("let a='testing';")
327
+ context.write_heap_snapshot("test.heapsnapshot")
328
+ ```
329
+
330
+ This file can then be loaded in the memory tab of the chrome dev console.
331
+
317
332
  ### Function call
318
333
 
319
334
  This calls the function passed as first argument:
@@ -451,7 +466,7 @@ Add this to your .travis.yml file:
451
466
 
452
467
  ## Contributing
453
468
 
454
- Bug reports and pull requests are welcome on GitHub at https://github.com/discourse/mini_racer. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
469
+ Bug reports and pull requests are welcome on GitHub at https://github.com/rubyjs/mini_racer. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
455
470
 
456
471
 
457
472
  ## License
data/Rakefile CHANGED
@@ -1,75 +1,57 @@
1
1
  require "bundler/gem_tasks"
2
2
  require "rake/testtask"
3
3
  require "rake/extensiontask"
4
+ require "shellwords"
5
+
6
+ class ValgrindTestTask < Rake::TestTask
7
+ VALGRIND_EXEC = 'valgrind'
8
+ DEFAULT_VALGRIND_OPTS = %w{
9
+ --trace-children=yes
10
+ --partial-loads-ok=yes
11
+ --error-limit=no
12
+ --error-exitcode=33
13
+ --num-callers=100
14
+ --suppressions=valgrind.supp
15
+ --gen-suppressions=all
16
+ }
17
+
18
+ attr_accessor :valgrind_args
19
+
20
+ def initialize(name=:valgrind_test)
21
+ @valgrind_args = DEFAULT_VALGRIND_OPTS
22
+ super
23
+ end
4
24
 
5
- Rake::TestTask.new(:test) do |t|
6
- t.libs << "test"
7
- t.libs << "lib"
8
- t.test_files = FileList['test/**/*_test.rb']
9
- end
10
-
11
- task :default => [:compile, :test]
12
-
13
- gem = Gem::Specification.load( File.dirname(__FILE__) + '/sq_mini_racer.gemspec' )
14
- Rake::ExtensionTask.new( 'mini_racer_extension', gem ) do |ext|
15
- ext.name = 'sq_mini_racer_extension'
16
- end
17
- Rake::ExtensionTask.new('prv_ext_loader', gem)
18
-
19
-
20
- # via http://blog.flavorjon.es/2009/06/easily-valgrind-gdb-your-ruby-c.html
21
- namespace :test do
22
- desc "run test suite with Address Sanitizer"
23
- task :asan do
24
- ENV["CONFIGURE_ARGS"] = [ENV["CONFIGURE_ARGS"], '--enable-asan'].compact.join(' ')
25
- Rake::Task['compile'].invoke
26
-
27
- asan_path = `ldconfig -N -p |grep libasan | grep -v 32 | sed 's/.* => \\(.*\\)$/\\1/'`.chomp.split("\n")[-1]
28
-
29
-
30
- cmdline = "env LD_PRELOAD=\"#{asan_path}\" ruby test/test_leak.rb"
31
- puts cmdline
32
- system cmdline
33
-
34
- cmdline = "env LD_PRELOAD=\"#{asan_path}\" rake test"
35
- puts cmdline
36
- system cmdline
25
+ # see original def in fileutils.rb
26
+ def ruby(*args, &block)
27
+ options = (Hash === args.last) ? args.pop : {}
28
+ if args.length > 1
29
+ sh(*([VALGRIND_EXEC] + valgrind_args + [RUBY] + args + [options]), &block)
30
+ else
31
+ # if the size is 1 it's assumed the arguments are already escaped
32
+ non_escaped_args = [VALGRIND_EXEC] + valgrind_args + [RUBY]
33
+ sh("#{non_escaped_args.map { |s| Shellwords.escape(s) }.join(' ')} #{args.first}", options, &block)
37
34
  end
38
- # partial-loads-ok and undef-value-errors necessary to ignore
39
- # spurious (and eminently ignorable) warnings from the ruby
40
- # interpreter
41
- VALGRIND_BASIC_OPTS = "--num-callers=50 --error-limit=no \
42
- --partial-loads-ok=yes --undef-value-errors=no"
35
+ end
36
+ end
43
37
 
44
- desc "run test suite under valgrind with basic ruby options"
45
- task :valgrind => :compile do
46
- cmdline = "valgrind #{VALGRIND_BASIC_OPTS} ruby test/test_leak.rb"
47
- puts cmdline
48
- system cmdline
38
+ test_task_cfg = Proc.new do |t|
39
+ t.libs << 'test'
40
+ t.libs << 'lib'
41
+ t.test_files = FileList['test/**/*_test.rb']
49
42
  end
50
43
 
51
- desc "run test suite under valgrind with leak-check=full"
52
- task :valgrind_leak_check => :compile do
53
- cmdline = "valgrind #{VALGRIND_BASIC_OPTS} --leak-check=full ruby test/test_leak.rb"
54
- puts cmdline
55
- require 'open3'
56
- _, stderr = Open3.capture3(cmdline)
44
+ Rake::TestTask.new(:test, &test_task_cfg)
45
+ ValgrindTestTask.new(:'test:valgrind', &test_task_cfg)
57
46
 
58
- section = ""
59
- stderr.split("\n").each do |line|
47
+ task :default => [:compile, :test]
60
48
 
61
- if line =~ /==.*==\s*$/
62
- if (section =~ /mini_racer|SUMMARY/)
63
- puts
64
- puts section
65
- puts
66
- end
67
- section = ""
68
- else
69
- section << line << "\n"
70
- end
71
- end
72
- end
49
+ gem = Gem::Specification.load( File.dirname(__FILE__) + '/mini_racer.gemspec' )
50
+ Rake::ExtensionTask.new( 'mini_racer_loader', gem ) do |ext|
51
+ ext.name = 'sq_mini_racer_loader'
52
+ end
53
+ Rake::ExtensionTask.new( 'mini_racer_extension', gem ) do |ext|
54
+ ext.name = 'sq_mini_racer_extension'
73
55
  end
74
56
 
75
57
  desc 'run clang-tidy linter on mini_racer_extension.cc'
data/azure-pipelines.yml CHANGED
@@ -64,6 +64,6 @@ jobs:
64
64
 
65
65
  - template: azure-template.yml
66
66
  parameters:
67
- name: macos_10_15
68
- displayName: MacOS 10.15
69
- imageName: 'macos-10.15'
67
+ name: macos_10_14
68
+ displayName: MacOS 10.14
69
+ imageName: 'macos-10.14'
data/azure-template.yml CHANGED
@@ -66,7 +66,7 @@ jobs:
66
66
  displayName: Print logs
67
67
  condition: failed()
68
68
 
69
- - script: $(bundle) exec rake test
69
+ - script: TESTOPTS=--junit $(bundle) exec rake test
70
70
  displayName: Run tests
71
71
  env:
72
72
  ${{ if eq(parameters.with_mini_racer, true) }}:
@@ -74,6 +74,15 @@ jobs:
74
74
  ${{ if eq(parameters.with_therubyracer, true) }}:
75
75
  LOAD_THERUBYRACER: 1
76
76
 
77
+ - task: PublishTestResults@2
78
+ displayName: Publish test results
79
+ condition: succeededOrFailed()
80
+ inputs:
81
+ testResultsFormat: 'JUnit'
82
+ testResultsFiles: '**/report.xml'
83
+ searchFolder: '$(System.DefaultWorkingDirectory)'
84
+ mergeTestResults: true
85
+
77
86
  - ${{ if and(eq(parameters.imageName, 'ubuntu-18.04'), eq(parameters.with_mini_racer, false), eq(parameters.with_therubyracer, false)) }}:
78
87
  - script: $(bundle) exec rake test:valgrind
79
88
  displayName: Run tests w/ valgrind
@@ -26,58 +26,52 @@ def cppflags_add_cpu_extension!
26
26
  end
27
27
 
28
28
  def libv8_gem_name
29
- #return "libv8-solaris" if IS_SOLARIS
30
- #return "libv8-alpine" if IS_LINUX_MUSL
31
-
32
29
  'libv8-node'
33
30
  end
34
31
 
35
- def libv8_requirement
36
- '~> 12.18.4.0.beta1'
32
+ def libv8_version
33
+ '14.14.0.0.beta2'
37
34
  end
38
35
 
39
- def libv8_basename(version)
40
- "#{libv8_gem_name}-#{version}-#{ruby_platform}"
36
+ def libv8_basename
37
+ "#{libv8_gem_name}-#{libv8_version}-#{ruby_platform}"
41
38
  end
42
39
 
43
- def libv8_gemspec(version)
44
- "#{libv8_basename(version)}.gemspec"
40
+ def libv8_gemspec_no_libc
41
+ platform_no_libc = ruby_platform.to_s.split('-')[0..1].join('-')
42
+ "#{libv8_gem_name}-#{libv8_version}-#{platform_no_libc}.gemspec"
45
43
  end
46
44
 
47
- def libv8_local_path(path=Gem.path)
48
- name_glob = "#{libv8_gem_name}-*-#{ruby_platform}"
49
-
50
- puts "looking for #{name_glob} in #{path.inspect}"
51
-
52
- paths = path.map { |p| Dir.glob(File.join(p, 'specifications', name_glob + '.gemspec')) }.flatten
53
-
54
- if paths.empty?
55
- puts "#{name_glob} not found in #{path.inspect}"
56
- return
57
- end
58
-
59
- specs = paths.map { |p| [p, eval(File.read(p))] }
60
- .select { |_, spec| Gem::Requirement.new(libv8_requirement).satisfied_by?(spec.version) }
61
- found_path, found_spec = specs.sort_by { |_, spec| spec.version }.last
45
+ def libv8_gemspec
46
+ "#{libv8_basename}.gemspec"
47
+ end
62
48
 
63
- unless found_path && found_spec
64
- puts "not found in specs: no '#{libv8_requirement}' in #{paths.inspect}"
49
+ def libv8_local_path(path=Gem.path)
50
+ gemspecs = [libv8_gemspec, libv8_gemspec_no_libc].uniq
51
+ puts "looking for #{gemspecs.join(', ')} in installed gems"
52
+ candidates = path.product(gemspecs)
53
+ .map { |(p, gemspec)| File.join(p, 'specifications', gemspec) }
54
+ p candidates
55
+ found = candidates.select { |f| File.exist?(f) }.first
56
+
57
+ unless found
58
+ puts "#{gemspecs.join(', ')} not found in installed gems"
65
59
  return
66
60
  end
67
61
 
68
- puts "found in specs: #{found_path}"
62
+ puts "found in installed specs: #{found}"
69
63
 
70
- gemdir = File.basename(found_path, '.gemspec')
71
- dir = File.expand_path(File.join(found_path, '..', '..', 'gems', gemdir))
64
+ gemdir = File.basename(found, '.gemspec')
65
+ dir = File.expand_path(File.join(found, '..', '..', 'gems', gemdir))
72
66
 
73
67
  unless Dir.exist?(dir)
74
- puts "not found in gems: #{dir}"
68
+ puts "not found in installed gems: #{dir}"
75
69
  return
76
70
  end
77
71
 
78
- puts "found in gems: #{dir}"
72
+ puts "found in installed gems: #{dir}"
79
73
 
80
- [dir, found_spec]
74
+ dir
81
75
  end
82
76
 
83
77
  def vendor_path
@@ -85,12 +79,25 @@ def vendor_path
85
79
  end
86
80
 
87
81
  def libv8_vendor_path
88
- libv8_local_path([vendor_path])
82
+ puts "looking for #{libv8_basename} in #{vendor_path}"
83
+ path = Dir.glob("#{vendor_path}/#{libv8_basename}").first
84
+
85
+ unless path
86
+ puts "#{libv8_basename} not found in #{vendor_path}"
87
+ return
88
+ end
89
+
90
+ puts "looking for #{libv8_basename}/lib/libv8-node.rb in #{vendor_path}"
91
+ unless Dir.glob(File.join(vendor_path, libv8_basename, 'lib', 'libv8-node.rb')).first
92
+ puts "#{libv8_basename}/lib/libv8.rb not found in #{vendor_path}"
93
+ return
94
+ end
95
+
96
+ path
89
97
  end
90
98
 
91
99
  def parse_platform(str)
92
100
  Gem::Platform.new(str).tap do |p|
93
- p.instance_eval { @version = 'musl' } if str =~ /-musl/ && p.version.nil?
94
101
  p.instance_eval { @cpu = 'x86_64' } if str =~ /universal.*darwin/
95
102
  end
96
103
  end
@@ -114,23 +121,21 @@ def libv8_remote_search
114
121
  json = JSON.parse(body)
115
122
 
116
123
  versions = json.select do |v|
117
- Gem::Requirement.new(libv8_requirement).satisfied_by?(Gem::Version.new(v['number']))
124
+ Gem::Version.new(v['number']) == Gem::Version.new(libv8_version)
118
125
  end
119
126
  abort(<<-ERROR) if versions.empty?
120
- ERROR: could not find #{libv8_gem_name} (requirement #{libv8_requirement}) in rubygems.org
127
+ ERROR: could not find #{libv8_gem_name} (version #{libv8_version}) in rubygems.org
121
128
  ERROR
122
129
 
123
130
  platform_versions = versions.select do |v|
124
131
  parse_platform(v['platform']) == ruby_platform unless v['platform'] =~ /universal.*darwin/
125
132
  end
126
133
  abort(<<-ERROR) if platform_versions.empty?
127
- ERROR: found gems matching #{libv8_gem_name}:'#{libv8_requirement}', but no binary for #{ruby_platform}
128
- try "gem install #{libv8_gem_name}:'#{libv8_requirement}'" to attempt to build #{libv8_gem_name} from source
134
+ ERROR: found #{libv8_gem_name}-#{libv8_version}, but no binary for #{ruby_platform}
135
+ try "gem install #{libv8_gem_name} -v '#{libv8_version}'" to attempt to build libv8 from source
129
136
  ERROR
130
137
 
131
- puts "found #{libv8_gem_name} for #{ruby_platform} on rubygems: #{platform_versions.map { |v| v['number'] }.join(', ')}"
132
-
133
- platform_versions.sort_by { |v| Gem::Version.new(v['number']) }.last
138
+ platform_versions.first
134
139
  end
135
140
 
136
141
  def libv8_download_uri(name, version, platform)
@@ -142,19 +147,19 @@ def libv8_downloaded_gem(name, version, platform)
142
147
  end
143
148
 
144
149
  def libv8_download(name, version, platform)
145
- FileUtils.mkdir_p(File.join(vendor_path, 'cache'))
150
+ FileUtils.mkdir_p(vendor_path)
146
151
  body = http_get(libv8_download_uri(name, version, platform))
147
- File.open(File.join(vendor_path, 'cache', libv8_downloaded_gem(name, version, platform)), 'wb') { |f| f.write(body) }
152
+ File.open(File.join(vendor_path, libv8_downloaded_gem(name, version, platform)), 'wb') { |f| f.write(body) }
148
153
  end
149
154
 
150
155
  def libv8_install!
151
- cmd = "gem install #{libv8_gem_name} --version '#{libv8_requirement}' --install-dir '#{vendor_path}'"
156
+ cmd = "gem install #{libv8_gem_name} --version '#{libv8_version}' --install-dir '#{vendor_path}'"
152
157
  puts "installing #{libv8_gem_name} using `#{cmd}`"
153
158
  rc = system(cmd)
154
159
 
155
160
  abort(<<-ERROR) unless rc
156
- ERROR: could not install #{libv8_gem_name}:#{libv8_requirement}
157
- try "gem install #{libv8_gem_name} -v '#{libv8_requirement}'" to attempt to build libv8 from source
161
+ ERROR: could not install #{libv8_gem_name} #{libv8_version}
162
+ try "gem install #{libv8_gem_name} -v '#{libv8_version}'" to attempt to build libv8 from source
158
163
  ERROR
159
164
 
160
165
  libv8_local_path([vendor_path])
@@ -168,20 +173,18 @@ def libv8_vendor!
168
173
  puts "downloading #{libv8_downloaded_gem(libv8_gem_name, version['number'], version['platform'])} to #{vendor_path}"
169
174
  libv8_download(libv8_gem_name, version['number'], version['platform'])
170
175
 
171
- package = Gem::Package.new(File.join(vendor_path, 'cache', libv8_downloaded_gem(libv8_gem_name, version['number'], version['platform'])))
172
- package.extract_files(File.join(vendor_path, 'gems', File.basename(libv8_downloaded_gem(libv8_gem_name, version['number'], version['platform']), '.gem')))
173
- FileUtils.mkdir_p(File.join(vendor_path, 'specifications'))
174
- File.open(File.join(vendor_path, 'specifications', File.basename(libv8_downloaded_gem(libv8_gem_name, version['number'], version['platform']), '.gem') + '.gemspec'), 'wb') { |f| f.write(package.spec.to_ruby) }
176
+ package = Gem::Package.new(File.join(vendor_path, libv8_downloaded_gem(libv8_gem_name, version['number'], version['platform'])))
177
+ package.extract_files(File.join(vendor_path, File.basename(libv8_downloaded_gem(libv8_gem_name, version['number'], version['platform']), '.gem')))
175
178
 
176
179
  libv8_vendor_path
177
180
  end
178
181
 
179
182
  def ensure_libv8_load_path
180
- puts "platform ruby:#{RUBY_PLATFORM} rubygems:#{Gem::Platform.new(RUBY_PLATFORM)} detected:#{ruby_platform}"
183
+ puts "detected platform #{RUBY_PLATFORM} => #{ruby_platform}"
181
184
 
182
- libv8_path, spec = libv8_local_path
183
- if !ENV['ONLY_INSTALLED_LIBV8_GEM'] && !libv8_path
184
- libv8_path, spec = libv8_vendor_path || libv8_vendor!
185
+ libv8_path = libv8_local_path
186
+ unless ENV['ONLY_INSTALLED_LIBV8_GEM']
187
+ libv8_path ||= libv8_vendor_path || libv8_vendor!
185
188
  end
186
189
 
187
190
  abort(<<-ERROR) unless libv8_path
@@ -207,6 +210,8 @@ $CPPFLAGS += " -rdynamic" unless $CPPFLAGS.split.include? "-rdynamic"
207
210
  $CPPFLAGS += " -fPIC" unless $CPPFLAGS.split.include? "-rdynamic" or IS_DARWIN
208
211
  $CPPFLAGS += " -std=c++0x"
209
212
  $CPPFLAGS += " -fpermissive"
213
+ $CPPFLAGS += " -DV8_COMPRESS_POINTERS"
214
+ $CPPFLAGS += " -fvisibility=hidden "
210
215
  cppflags_add_frame_pointer!
211
216
  cppflags_add_cpu_extension!
212
217
 
@@ -214,12 +219,14 @@ $CPPFLAGS += " -Wno-reserved-user-defined-literal" if IS_DARWIN
214
219
 
215
220
  $LDFLAGS.insert(0, " -stdlib=libc++ ") if IS_DARWIN
216
221
  $LDFLAGS += " -Wl,--no-undefined " unless IS_DARWIN
217
- $LDFLAGS += " -Wl,-undefined,error " if IS_DARWIN
218
222
 
219
223
  if ENV['CXX']
220
224
  puts "SETTING CXX"
221
225
  CONFIG['CXX'] = ENV['CXX']
222
226
  end
227
+ # 1.9 has no $CXXFLAGS
228
+ $CPPFLAGS += " #{ENV['CPPFLAGS']}" if ENV['CPPFLAGS']
229
+ $LDFLAGS += " #{ENV['LDFLAGS']}" if ENV['LDFLAGS']
223
230
 
224
231
  CXX11_TEST = <<EOS
225
232
  #if __cplusplus <= 199711L