@@ -20,13 +20,17 @@ module Helpers
2020end
2121
2222task :compile , [ :platform ] => [ ] do |_ , args |
23- local_platform = Gem ::Platform . local . to_s
24- target_platform = ENV [ 'RUBY_TARGET_PLATFORM' ] || args . to_h [ :platform ] || Gem ::Platform . local . to_s
23+ local_platform = Gem ::Platform . local
24+ target_platform = Gem ::Platform . new ( ENV [ 'RUBY_TARGET_PLATFORM' ] || args . to_h [ :platform ] || Gem ::Platform . local )
25+
26+ if target_platform . os == 'darwin'
27+ target_platform . instance_eval { @version = nil }
28+ end
2529
2630 puts "local platform: #{ local_platform } "
2731 puts "target platform: #{ target_platform } "
2832
29- ENV [ 'RUBY_TARGET_PLATFORM' ] = target_platform
33+ ENV [ 'RUBY_TARGET_PLATFORM' ] = target_platform . to_s
3034
3135 if ( libs = Dir [ "vendor/v8/#{ target_platform } /**/*.a" ] ) . any?
3236 puts "found: #{ libs . inspect } "
@@ -39,8 +43,12 @@ task :compile, [:platform] => [] do |_, args|
3943end
4044
4145task :binary , [ :platform ] => [ :compile ] do |_ , args |
42- local_platform = Gem ::Platform . local
43- target_platform = Gem ::Platform . new ( ENV [ 'RUBY_TARGET_PLATFORM' ] ) || Gem ::Platform . new ( args . to_h [ :platform ] ) || Gem ::Platform . local
46+ local_platform = Gem ::Platform . local . dup
47+ target_platform = Gem ::Platform . new ( ENV [ 'RUBY_TARGET_PLATFORM' ] || args . to_h [ :platform ] || Gem ::Platform . local )
48+
49+ if target_platform . os == 'darwin'
50+ target_platform . instance_eval { @version = nil }
51+ end
4452
4553 puts "local platform: #{ local_platform } "
4654 puts "target platform: #{ target_platform } "
@@ -69,33 +77,3 @@ task :binary, [:platform] => [:compile] do |_, args|
6977
7078 FileUtils . mv ( package , 'pkg' )
7179end
72-
73- namespace :binary do
74- task all : :binary do
75- next unless RUBY_PLATFORM =~ /darwin-?(\d +)/
76-
77- current = Integer ( $1)
78-
79- Helpers . binary_gemspec # loads NODE_VERSION
80- major , minor = File . read ( Dir [ "src/node-v#{ Libv8 ::Node ::NODE_VERSION } /common.gypi" ] . last ) . lines . find { |l | l =~ /-mmacosx-version-min=(\d +).(\d +)/ } && [ Integer ( $1) , Integer ( $2) ]
81-
82- first = if RUBY_PLATFORM =~ /\b arm64e?-/
83- 20 # arm64 darwin is only available since darwin20
84- elsif major == 10
85- minor + 4 # macos 10.X => darwinY offset, 10.15 is darwin19
86- else
87- minor + 20 # maxos 11.X => darwinY offset, 11.0 is darwin20
88- end
89- max = 20 # current known max to build for
90-
91- ( first ..max ) . each do |version |
92- next if version == current
93-
94- platform = Gem ::Platform . local . dup
95- platform . instance_eval { @version = version }
96- puts "> building #{ platform } "
97-
98- Rake ::Task [ 'binary' ] . execute ( Rake ::TaskArguments . new ( [ :platform ] , [ platform ] ) )
99- end
100- end
101- end
0 commit comments