1 MRuby::Gem::Specification.new 'mruby-compiler' do |spec|
3 spec.author = 'mruby developers'
4 spec.summary = 'mruby compiler library'
6 lex_def = "#{dir}/core/lex.def"
7 core_objs = Dir.glob("#{dir}/core/*.c").map { |f|
8 next nil if build.cxx_exception_enabled? and f =~ /(codegen).c$/
9 objfile(f.pathmap("#{build_dir}/core/%n"))
12 if build.cxx_exception_enabled?
14 build.compile_as_cxx("#{dir}/core/y.tab.c", "#{build_dir}/core/y.tab.cxx",
15 objfile("#{build_dir}/y.tab"), ["#{dir}/core"]) <<
16 build.compile_as_cxx("#{dir}/core/codegen.c", "#{build_dir}/core/codegen.cxx")
18 core_objs << objfile("#{build_dir}/core/y.tab")
19 file objfile("#{build_dir}/core/y.tab") => "#{dir}/core/y.tab.c" do |t|
20 cc.run t.name, t.prerequisites.first, [], ["#{dir}/core"]
25 file "#{dir}/core/y.tab.c" => ["#{dir}/core/parse.y", lex_def] do |t|
26 yacc.run t.name, t.prerequisites.first
27 content = File.read(t.name).gsub(/^#line +\d+ +"\K.*$/){$&.relative_path}
28 File.write(t.name, content)
32 file lex_def => "#{dir}/core/keywords" do |t|
33 gperf.run t.name, t.prerequisites.first
36 file build.libmruby_core_static => core_objs
37 build.libmruby << core_objs