blob: 66d6ef80b26725384ebd8209a1cdd8b37888941e (
plain)
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
|
module MRuby
class Build
def exefile(name)
if name.is_a?(Array)
name.flatten.map { |n| exefile(n) }
elsif name !~ /\./
"#{name}#{exts.executable}"
else
name
end
end
end
end
MRuby.each_target do
next if kind_of? MRuby::CrossBuild
mruby_config = 'mruby-config' + (ENV['OS'] == 'Windows_NT' ? '.bat' : '')
mruby_config_path = "#{build_dir}/bin/#{mruby_config}"
@bins << mruby_config
file mruby_config_path => libfile("#{build_dir}/lib/libmruby") do |t|
FileUtils.copy "#{File.dirname(__FILE__)}/#{mruby_config}", t.name
config = Hash[open("#{build_dir}/lib/libmruby.flags.mak").read.split("\n").map {|x| a = x.split(/\s*=\s*/, 2); [a[0], a[1].gsub('\\"', '"') ]}]
IO.write(t.name, File.open(t.name) {|f|
f.read.gsub (/echo (MRUBY_CFLAGS|MRUBY_LIBS|MRUBY_LDFLAGS_BEFORE_LIBS|MRUBY_LDFLAGS|MRUBY_LIBMRUBY_PATH)/) {|x| config[$1].empty? ? '' : "echo #{config[$1]}"}
})
FileUtils.chmod(0755, t.name)
end
end
|