@@ -14,32 +14,36 @@ namespace :ports do
1414 }
1515
1616 directory "ports"
17- CLEAN . include "ports/*mingw32 *"
17+ CLEAN . include "ports/*mingw *"
1818 CLEAN . include "ports/*.installed"
1919
20- task :openssl , [ :host ] do |task , args |
21- args . with_defaults ( host : RbConfig ::CONFIG [ 'host' ] )
20+ task :openssl , [ :host , :gem_platform ] do |_task , args |
21+ args . with_defaults ( host : RbConfig ::CONFIG [ 'host' ] , gem_platform : RbConfig :: CONFIG [ "arch" ] )
2222
2323 libraries_to_compile [ :openssl ] . files = [ OPENSSL_SOURCE_URI ]
2424 libraries_to_compile [ :openssl ] . host = args . host
25+ libraries_to_compile [ :openssl ] . gem_platform = args . gem_platform
26+
2527 libraries_to_compile [ :openssl ] . cook
2628 libraries_to_compile [ :openssl ] . activate
2729 end
2830
29- task :libiconv , [ :host ] do |task , args |
30- args . with_defaults ( host : RbConfig ::CONFIG [ 'host' ] )
31+ task :libiconv , [ :host , :gem_platform ] do |_task , args |
32+ args . with_defaults ( host : RbConfig ::CONFIG [ 'host' ] , gem_platform : RbConfig :: CONFIG [ "arch" ] )
3133
3234 libraries_to_compile [ :libiconv ] . files = [ ICONV_SOURCE_URI ]
3335 libraries_to_compile [ :libiconv ] . host = args . host
36+ libraries_to_compile [ :libiconv ] . gem_platform = args . gem_platform
3437 libraries_to_compile [ :libiconv ] . cook
3538 libraries_to_compile [ :libiconv ] . activate
3639 end
3740
38- task :freetds , [ :host ] do |task , args |
39- args . with_defaults ( host : RbConfig ::CONFIG [ 'host' ] )
41+ task :freetds , [ :host , :gem_platform ] do |_task , args |
42+ args . with_defaults ( host : RbConfig ::CONFIG [ 'host' ] , gem_platform : RbConfig :: CONFIG [ "arch" ] )
4043
4144 libraries_to_compile [ :freetds ] . files = [ FREETDS_SOURCE_URI ]
4245 libraries_to_compile [ :freetds ] . host = args . host
46+ libraries_to_compile [ :freetds ] . gem_platform = args . gem_platform
4347
4448 if libraries_to_compile [ :openssl ]
4549 # freetds doesn't have an option that will provide an rpath
@@ -59,13 +63,13 @@ namespace :ports do
5963 libraries_to_compile [ :freetds ] . activate
6064 end
6165
62- task :compile , [ :host ] do |task , args |
63- args . with_defaults ( host : RbConfig ::CONFIG [ 'host' ] )
66+ task :compile , [ :host , :gem_platform ] do |_task , args |
67+ args . with_defaults ( host : RbConfig ::CONFIG [ 'host' ] , gem_platform : RbConfig :: CONFIG [ "arch" ] )
6468
65- puts "Compiling ports for #{ args . host } ..."
69+ puts "Compiling ports for #{ args . host } (Ruby platform #{ args . gem_platform } ) ..."
6670
6771 libraries_to_compile . keys . each do |lib |
68- Rake ::Task [ "ports:#{ lib } " ] . invoke ( args . host )
72+ Rake ::Task [ "ports:#{ lib } " ] . invoke ( args . host , args . gem_platform )
6973 end
7074 end
7175
@@ -74,22 +78,26 @@ namespace :ports do
7478 require 'rake_compiler_dock'
7579
7680 # build the ports for all our cross compile hosts
77- GEM_PLATFORM_HOSTS . each do |gem_platform , host |
81+ GEM_PLATFORM_HOSTS . each do |gem_platform , meta |
7882 # make sure to install our bundle
7983 build = [ 'bundle' ]
80- build << "rake ports:compile[#{ host } ] MAKE='make -j`nproc`'"
84+ build << "RUBY_CC_VERSION= #{ meta [ :ruby_versions ] } rake ports:compile[#{ meta [ : host] } , #{ gem_platform } ] MAKE='make -j`nproc`'"
8185 RakeCompilerDock . sh build . join ( ' && ' ) , platform : gem_platform
8286 end
8387 end
8488
8589 desc "Notes the actual versions for the compiled ports into a file"
86- task "version_file" do
90+ task "version_file" , [ :gem_platform ] do |_task , args |
91+ args . with_defaults ( gem_platform : RbConfig ::CONFIG [ "arch" ] )
92+
8793 ports_version = { }
8894
8995 libraries_to_compile . each do |library , library_recipe |
9096 ports_version [ library ] = library_recipe . version
9197 end
9298
99+ ports_version [ :platform ] = args . gem_platform
100+
93101 File . open ( ".ports_versions" , "w" ) do |f |
94102 f . write ports_version
95103 end
0 commit comments