first commit
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
unless MRuby::Build.current.kind_of?(MRuby::CrossBuild)
|
||||
MRuby::Gem::Specification.new('mruby-bin-config') do |spec|
|
||||
name = 'mruby-config'
|
||||
spec.license = 'MIT'
|
||||
spec.author = 'mruby developers'
|
||||
spec.summary = "#{name} command"
|
||||
|
||||
mruby_config_dir = "#{build.build_dir}/bin"
|
||||
mruby_config = name + (ENV['OS'] == 'Windows_NT' ? '.bat' : '')
|
||||
mruby_config_path = "#{mruby_config_dir}/#{mruby_config}"
|
||||
make_cfg = "#{build.build_dir}/lib/libmruby.flags.mak"
|
||||
tmplt_path = "#{__dir__}/#{mruby_config}"
|
||||
build.bins << mruby_config
|
||||
|
||||
directory mruby_config_dir
|
||||
|
||||
file mruby_config_path => [mruby_config_dir, make_cfg, tmplt_path] do |t|
|
||||
config = Hash[File.readlines(make_cfg).map!(&:chomp).map! {|l|
|
||||
l.gsub('\\"', '"').split(' = ', 2).map! {|s| s.sub(/^(?=.)/, 'echo ')}
|
||||
}]
|
||||
tmplt = File.read(tmplt_path)
|
||||
File.write(t.name, tmplt.gsub(/(#{Regexp.union(*config.keys)})\b/, config))
|
||||
chmod(0755, t.name)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,20 @@
|
||||
#!/bin/sh
|
||||
|
||||
while [ $# -gt 0 ]; do
|
||||
case $1 in
|
||||
--cflags) echo MRUBY_CFLAGS;;
|
||||
--ldflags) echo MRUBY_LDFLAGS;;
|
||||
--ldflags-before-libs) echo MRUBY_LDFLAGS_BEFORE_LIBS;;
|
||||
--libs) echo MRUBY_LIBS;;
|
||||
--libmruby-path) echo MRUBY_LIBMRUBY_PATH;;
|
||||
--help) echo "Usage: mruby-config [switches]"
|
||||
echo " switches:"
|
||||
echo " --cflags print flags passed to compiler"
|
||||
echo " --ldflags print flags passed to linker"
|
||||
echo " --ldflags-before-libs print flags passed to linker before linked libraries"
|
||||
echo " --libs print linked libraries"
|
||||
echo " --libmruby-path print libmruby path"
|
||||
exit 0;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
@@ -0,0 +1,42 @@
|
||||
@echo off
|
||||
|
||||
:top
|
||||
shift
|
||||
if "%0" equ "" goto :eof
|
||||
if "%0" equ "--cflags" goto cflags
|
||||
if "%0" equ "--ldflags" goto ldflags
|
||||
if "%0" equ "--ldflags-before-libs" goto ldflagsbeforelibs
|
||||
if "%0" equ "--libs" goto libs
|
||||
if "%0" equ "--libmruby-path" goto libmrubypath
|
||||
if "%0" equ "--help" goto showhelp
|
||||
echo Invalid Option
|
||||
goto :eof
|
||||
|
||||
:cflags
|
||||
echo MRUBY_CFLAGS
|
||||
goto top
|
||||
|
||||
:libs
|
||||
echo MRUBY_LIBS
|
||||
goto top
|
||||
|
||||
:ldflags
|
||||
echo MRUBY_LDFLAGS
|
||||
goto top
|
||||
|
||||
:ldflagsbeforelibs
|
||||
echo MRUBY_LDFLAGS_BEFORE_LIBS
|
||||
goto top
|
||||
|
||||
:libmrubypath
|
||||
echo MRUBY_LIBMRUBY_PATH
|
||||
goto top
|
||||
|
||||
:showhelp
|
||||
echo Usage: mruby-config [switches]
|
||||
echo switches:
|
||||
echo --cflags print flags passed to compiler
|
||||
echo --ldflags print flags passed to linker
|
||||
echo --ldflags-before-libs print flags passed to linker before linked libraries
|
||||
echo --libs print linked libraries
|
||||
echo --libmruby-path print libmruby path
|
||||
Reference in New Issue
Block a user