@@ -5,7 +5,7 @@ Bundler::GemHelper.install_tasks
55module Helpers
66 module_function
77
8- def binary_gemspec ( platform = Gem ::Platform . local , str = RUBY_PLATFORM )
8+ def binary_gemspec ( platform : Gem ::Platform . local , str : RUBY_PLATFORM )
99 platform . instance_eval { @version = 'musl' } if str =~ /-musl/ && platform . version . nil?
1010
1111 gemspec = eval ( File . read ( 'libv8-node.gemspec' ) )
@@ -22,8 +22,8 @@ task :compile do
2222 #sh 'ruby ext/libv8-node/extconf.rb'
2323end
2424
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 )
2727 gemspec . extensions . clear
2828
2929 # We don't need most things for the binary
@@ -48,3 +48,26 @@ task :binary => :compile do
4848
4949 FileUtils . mv ( package , 'pkg' )
5050end
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