@@ -5,7 +5,7 @@ Bundler::GemHelper.install_tasks
5
5
module Helpers
6
6
module_function
7
7
8
- def binary_gemspec ( platform = Gem ::Platform . local , str = RUBY_PLATFORM )
8
+ def binary_gemspec ( platform : Gem ::Platform . local , str : RUBY_PLATFORM )
9
9
platform . instance_eval { @version = 'musl' } if str =~ /-musl/ && platform . version . nil?
10
10
11
11
gemspec = eval ( File . read ( 'libv8-node.gemspec' ) )
@@ -22,8 +22,8 @@ task :compile do
22
22
#sh 'ruby ext/libv8-node/extconf.rb'
23
23
end
24
24
25
- task :binary => :compile do
26
- gemspec = Helpers . binary_gemspec
25
+ task :binary , [ :platform ] => [ :compile ] do | _ , args |
26
+ gemspec = Helpers . binary_gemspec ( ** args . to_h )
27
27
gemspec . extensions . clear
28
28
29
29
# We don't need most things for the binary
@@ -48,3 +48,26 @@ task :binary => :compile do
48
48
49
49
FileUtils . mv ( package , 'pkg' )
50
50
end
51
+
52
+ namespace :binary do
53
+ task :all => :binary do
54
+ return unless RUBY_PLATFORM =~ /darwin-?(\d +)/
55
+
56
+ Helpers . binary_gemspec # loads NODE_VERSION
57
+
58
+ current = Integer ( $1)
59
+ major , minor = File . read ( Dir [ "src/node-#{ Libv8 ::Node ::NODE_VERSION } /common.gypi" ] . last ) . lines . find { |l | l =~ /-mmacosx-version-min=(\d +).(\d +)/ } && [ Integer ( $1) , Integer ( $2) ]
60
+ first = minor + 4
61
+ max = 20
62
+
63
+ ( first ..max ) . each do |version |
64
+ next if version == current
65
+
66
+ platform = Gem ::Platform . local . dup
67
+ platform . instance_eval { @version = version }
68
+ puts "> building #{ platform } "
69
+
70
+ Rake ::Task [ "binary" ] . execute ( Rake ::TaskArguments . new ( [ :platform ] , [ platform ] ) )
71
+ end
72
+ end
73
+ end
0 commit comments