Commit f911b235 authored by Yukihiro "Matz" Matsumoto's avatar Yukihiro "Matz" Matsumoto

Merge pull request #1801 from mattn/mruby-config

Add mruby-bin-mruby-config
parents 13d9ed45 67b8f6ec
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| x.split(/\s*=\s*/, 2)}]
IO.write(t.name, File.open(t.name) {|f|
f.read.gsub (/echo (MRUBY_CFLAGS|MRUBY_LDFLAGS|MRUBY_LIBS)/) {|x| config[$1].empty? ? '' : "echo #{config[$1]}"}
})
FileUtils.chmod(0755, t.name)
end
end
#!/bin/sh
while [ $# -gt 0 ]; do
case $1 in
--cflags) echo MRUBY_CFLAGS;;
--ldflags) echo MRUBY_LDFLAGS;;
--libs) echo MRUBY_LIBS;;
esac
shift
done
@echo off
:top
shift
if "%0" equ "" goto :eof
if "%0" equ "--cflags" goto cflags
if "%0" equ "--ldflags" goto ldflags
if "%0" equ "--libs" goto libs
echo Invalid Option
goto :eof
:cflags
echo MRUBY_CFLAGS
goto top
:libs
echo MRUBY_LIBS
goto top
:ldflags
echo MRUBY_LDFLAGS
goto top
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment