@@ -82,44 +82,45 @@ LIB_ROOT = File.dirname(__FILE__)
82
82
TOOLCHAINS = { }
83
83
84
84
namespace :build do
85
- BUILDS . each do |params |
86
- name = "#{ params [ :src ] } -#{ params [ :target ] } -#{ params [ :profile ] } "
87
- source = BUILD_SOURCES [ params [ :src ] ] . merge ( name : params [ :src ] )
88
- profile = BUILD_PROFILES [ params [ :profile ] ]
89
- options = {
90
- src : source ,
91
- target : params [ :target ] ,
92
- default_exts : profile [ :default_exts ]
93
- }
94
- debug = profile [ :debug ]
95
- RubyWasm ::BuildTask . new ( name , **options ) do |t |
96
- if debug
97
- t . crossruby . debugflags = %w[ -g ]
98
- t . crossruby . wasmoptflags = %w[ -O3 -g ]
99
- t . crossruby . ldflags = %w[
100
- -Xlinker
101
- --stack-first
102
- -Xlinker
103
- -z
104
- -Xlinker
105
- stack-size=16777216
106
- ]
107
- else
108
- t . crossruby . debugflags = %w[ -g0 ]
109
- t . crossruby . ldflags = %w[ -Xlinker -zstack-size=16777216 ]
110
- end
85
+ BUILD_TASKS =
86
+ BUILDS . map do |params |
87
+ name = "#{ params [ :src ] } -#{ params [ :target ] } -#{ params [ :profile ] } "
88
+ source = BUILD_SOURCES [ params [ :src ] ] . merge ( name : params [ :src ] )
89
+ profile = BUILD_PROFILES [ params [ :profile ] ]
90
+ options = {
91
+ src : source ,
92
+ target : params [ :target ] ,
93
+ default_exts : profile [ :default_exts ]
94
+ }
95
+ debug = profile [ :debug ]
96
+ RubyWasm ::BuildTask . new ( name , **options ) do |t |
97
+ if debug
98
+ t . crossruby . debugflags = %w[ -g ]
99
+ t . crossruby . wasmoptflags = %w[ -O3 -g ]
100
+ t . crossruby . ldflags = %w[
101
+ -Xlinker
102
+ --stack-first
103
+ -Xlinker
104
+ -z
105
+ -Xlinker
106
+ stack-size=16777216
107
+ ]
108
+ else
109
+ t . crossruby . debugflags = %w[ -g0 ]
110
+ t . crossruby . ldflags = %w[ -Xlinker -zstack-size=16777216 ]
111
+ end
111
112
112
- toolchain = t . toolchain
113
- t . crossruby . user_exts =
114
- profile [ :user_exts ] . map do |ext |
115
- srcdir = File . join ( LIB_ROOT , "ext" , ext )
116
- RubyWasm ::CrossRubyExtProduct . new ( srcdir , toolchain )
113
+ toolchain = t . toolchain
114
+ t . crossruby . user_exts =
115
+ profile [ :user_exts ] . map do |ext |
116
+ srcdir = File . join ( LIB_ROOT , "ext" , ext )
117
+ RubyWasm ::CrossRubyExtProduct . new ( srcdir , toolchain )
118
+ end
119
+ unless TOOLCHAINS . key? toolchain . name
120
+ TOOLCHAINS [ toolchain . name ] = toolchain
117
121
end
118
- unless TOOLCHAINS . key? toolchain . name
119
- TOOLCHAINS [ toolchain . name ] = toolchain
120
122
end
121
123
end
122
- end
123
124
124
125
desc "Clean build directories"
125
126
task :clean do
0 commit comments