-
Notifications
You must be signed in to change notification settings - Fork 0
/
mrbgem.rake
50 lines (37 loc) · 1.35 KB
/
mrbgem.rake
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
MRuby::Gem::Specification.new('mruby-bin-monolith') do |spec|
spec.bins = %w{monolith_run}
spec.license = 'MIT'
spec.authors = 'Chris Reuter'
spec.add_dependency('mruby-optparse')
spec.add_dependency 'mruby-process', mgem: 'mruby-process2'
spec.add_test_dependency('mruby-dir')
spec.cc.flags += %W{-I #{File.join(__dir__, 'src')}}
#
# Use monolith to build the 'monolith' executable:
#
bindir = "#{build.root}/build/#{build.name}/bin"
ml_exe = exefile("#{bindir}/monolith")
runner_bin = exefile("#{bindir}/monolith_run")
mruby_bin = exefile("#{bindir}/mruby")
mrbc_bin = exefile("#{bindir}/mrbc")
ml_src = "#{__dir__}/tools_ruby/monolith/monolith.rb"
desc 'build the "monolith" executable'
file ml_exe => [runner_bin, ml_src, mruby_bin, mrbc_bin] do
sh mruby_bin, ml_src, '-c', mrbc_bin, '--runner', runner_bin,
'--strip', '--output', ml_exe, ml_src
end
task :all => ml_exe
if build.test_enabled?
runner = "#{bindir}/mrbtest"
runner += ".exe" if for_windows?
ENV['_TESTRUNNER'] = runner
# ENV['_BINDIR'] = bindir
end
# Task to clean up the extra byproducts
task :clean do
HERE = File.dirname(__FILE__)
FileUtils.rm(*Dir.glob("#{HERE}/test_support/*.exe"),
*Dir.glob("#{HERE}/test_support/*.mrb"),
"#{HERE}/tools_ruby/monolith/monolith.mrb")
end
end