mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
Added conf.bins for defining bulding binaries
This commit is contained in:
@@ -27,25 +27,21 @@ load 'test/mrbtest.rake'
|
||||
# generic build targets, rules
|
||||
task :default => :all
|
||||
|
||||
binfiles = [exefile('bin/mruby'), exefile('bin/mirb'), exefile('bin/mrbc')]
|
||||
binfiles = MRuby.targets['host'].bins.map do |bin|
|
||||
install_path = exefile("bin/#{bin}")
|
||||
|
||||
file install_path => exefile("build/host/bin/#{bin}") do |t|
|
||||
FileUtils.cp t.prerequisites.first, t.name
|
||||
end
|
||||
|
||||
install_path
|
||||
end
|
||||
|
||||
desc "build all targets, install (locally) in-repo"
|
||||
task :all => binfiles + MRuby.targets.map { |t| [exefile("#{t.build_dir}/bin/mruby"), exefile("#{t.build_dir}/bin/mirb"), exefile("#{t.build_dir}/bin/mrbc")] }.flatten
|
||||
|
||||
file exefile('bin/mruby') => exefile('build/host/bin/mruby') do |t|
|
||||
FileUtils.cp t.prerequisites.first, t.name
|
||||
end
|
||||
|
||||
file exefile('bin/mirb') => exefile('build/host/bin/mirb') do |t|
|
||||
FileUtils.cp t.prerequisites.first, t.name
|
||||
end
|
||||
|
||||
file exefile('bin/mrbc') => exefile('build/host/bin/mrbc') do |t|
|
||||
FileUtils.cp t.prerequisites.first, t.name
|
||||
end
|
||||
task :all => binfiles + MRuby.targets.values.map { |t| [exefile("#{t.build_dir}/bin/mruby"), exefile("#{t.build_dir}/bin/mirb"), exefile("#{t.build_dir}/bin/mrbc")] }.flatten
|
||||
|
||||
desc "run all mruby tests"
|
||||
task :test => MRuby.targets.map { |t| exefile("#{t.build_dir}/test/mrbtest") } do
|
||||
task :test => MRuby.targets.values.map { |t| exefile("#{t.build_dir}/test/mrbtest") } do
|
||||
sh "#{filename exefile('build/host/test/mrbtest')}"
|
||||
if MRuby.targets.count > 1
|
||||
puts "\nYou should run #{MRuby.targets.map{ |t| t.name == 'host' ? nil : "#{t.build_dir}/test/mrbtest" }.compact.join(', ')} on target device."
|
||||
@@ -54,7 +50,7 @@ end
|
||||
|
||||
desc "clean all built and in-repo installed artifacts"
|
||||
task :clean do
|
||||
MRuby.targets.each do |t|
|
||||
MRuby.each_target do |t|
|
||||
FileUtils.rm_rf t.build_dir
|
||||
end
|
||||
FileUtils.rm_f binfiles
|
||||
|
||||
@@ -2,6 +2,7 @@ MRuby::Build.new do |conf|
|
||||
conf.cc = ENV['CC'] || 'gcc'
|
||||
conf.ld = ENV['LD'] || 'gcc'
|
||||
conf.ar = ENV['AR'] || 'ar'
|
||||
# conf.bins = %w(mrbc mruby mirb)
|
||||
# conf.cxx = conf.cc
|
||||
# conf.objcc = conf.cc
|
||||
# conf.asm = conf.cc
|
||||
@@ -27,6 +28,7 @@ MRuby::CrossBuild.new('i386') do |conf|
|
||||
conf.cc = ENV['CC'] || 'gcc'
|
||||
conf.ld = ENV['LD'] || 'gcc'
|
||||
conf.ar = ENV['AR'] || 'ar'
|
||||
# conf.bins = %w(mrbc mruby mirb)
|
||||
# conf.cxx = 'gcc'
|
||||
# conf.objcc = 'gcc'
|
||||
# conf.asm = 'gcc'
|
||||
|
||||
@@ -53,6 +53,7 @@ The following options can be configurated:
|
||||
* conf.objccflags (Object compiler flags)
|
||||
* conf.asmflags (Assembler flags)
|
||||
* conf.gem (A GEM which should be integrated - can be set several times)
|
||||
* conf.bins (Build binaries)
|
||||
|
||||
To compile just call ```./minirake``` inside of the mruby source root. To
|
||||
generate the test tool environment call ```./minirake test```. To clean
|
||||
|
||||
@@ -3,11 +3,11 @@ module MRuby
|
||||
attr_accessor :build
|
||||
|
||||
def targets
|
||||
@targets ||= []
|
||||
@targets ||= {}
|
||||
end
|
||||
|
||||
def each_target(&block)
|
||||
@targets.each do |target|
|
||||
@targets.each do |key, target|
|
||||
target.instance_eval(&block)
|
||||
end
|
||||
end
|
||||
@@ -22,6 +22,7 @@ module MRuby
|
||||
attr_writer :cxx, :cxxflags
|
||||
attr_writer :objcc, :objcflags
|
||||
attr_writer :asm, :asmflags
|
||||
attr_accessor :bins
|
||||
attr_accessor :gperf, :yacc
|
||||
attr_accessor :cat, :git
|
||||
attr_reader :root, :gems
|
||||
@@ -38,9 +39,11 @@ module MRuby
|
||||
@yacc, @gperf = 'bison', 'gperf'
|
||||
@cat, @git = 'cat', 'git'
|
||||
|
||||
@bins = %w(mruby mrbc mirb)
|
||||
|
||||
@gems, @libmruby = [], []
|
||||
|
||||
MRuby.targets << self
|
||||
MRuby.targets[name.to_s] = self
|
||||
MRuby.build = self
|
||||
instance_eval(&block)
|
||||
end
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
dir = File.dirname(__FILE__).sub(%r|^\./|, '')
|
||||
|
||||
MRuby.each_target do
|
||||
exec = exefile("#{build_dir}/bin/mirb")
|
||||
objs = Dir.glob("#{dir}/*.{c}").map { |f| f.pathmap("#{build_dir}/%X.o") }
|
||||
if bins.select { |s| s.to_s == 'mirb' }
|
||||
exec = exefile("#{build_dir}/bin/mirb")
|
||||
objs = Dir.glob("#{dir}/*.{c}").map { |f| f.pathmap("#{build_dir}/%X.o") }
|
||||
|
||||
file exec => objs + ["#{build_dir}/lib/libmruby.a"] do |t|
|
||||
link t.name, t.prerequisites, gems.map { |g| g.mruby_ldflags }, gems.map { |g| g.mruby_libs }
|
||||
file exec => objs + ["#{build_dir}/lib/libmruby.a"] do |t|
|
||||
link t.name, t.prerequisites, gems.map { |g| g.mruby_ldflags }, gems.map { |g| g.mruby_libs }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
dir = File.dirname(__FILE__).sub(%r|^\./|, '')
|
||||
|
||||
MRuby.each_target do
|
||||
exec = exefile("#{build_dir}/bin/mrbc")
|
||||
objs = Dir.glob("#{dir}/*.{c}").map { |f| f.pathmap("#{build_dir}/%X.o") }
|
||||
if bins.select { |s| s.to_s == 'mrbc' }
|
||||
exec = exefile("#{build_dir}/bin/mrbc")
|
||||
objs = Dir.glob("#{dir}/*.{c}").map { |f| f.pathmap("#{build_dir}/%X.o") }
|
||||
|
||||
file exec => objs + ["#{build_dir}/lib/libmruby_core.a"] do |t|
|
||||
link t.name, t.prerequisites, [], gems.map { |g| g.mruby_libs }
|
||||
file exec => objs + ["#{build_dir}/lib/libmruby_core.a"] do |t|
|
||||
link t.name, t.prerequisites, [], gems.map { |g| g.mruby_libs }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
dir = File.dirname(__FILE__).sub(%r|^\./|, '')
|
||||
|
||||
MRuby.each_target do
|
||||
exec = exefile("#{build_dir}/bin/mruby")
|
||||
objs = Dir.glob("#{dir}/*.{c}").map { |f| f.pathmap("#{build_dir}/%X.o") }
|
||||
if bins.select { |s| s.to_s == 'mruby' }
|
||||
exec = exefile("#{build_dir}/bin/mruby")
|
||||
objs = Dir.glob("#{dir}/*.{c}").map { |f| f.pathmap("#{build_dir}/%X.o") }
|
||||
|
||||
file exec => objs + ["#{build_dir}/lib/libmruby.a"] do |t|
|
||||
link t.name, t.prerequisites, gems.map { |g| g.mruby_ldflags }, gems.map { |g| g.mruby_libs }
|
||||
file exec => objs + ["#{build_dir}/lib/libmruby.a"] do |t|
|
||||
link t.name, t.prerequisites, gems.map { |g| g.mruby_ldflags }, gems.map { |g| g.mruby_libs }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user