Skip to content

Commit

Permalink
Add --libmruby-path support to mruby-bin-mruby-config.
Browse files Browse the repository at this point in the history
  • Loading branch information
yyamano committed Apr 22, 2017
1 parent c900fff commit 52a0380
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion mrbgems/mruby-bin-mruby-config/mrbgem.rake
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ MRuby.each_target do
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)/) {|x| config[$1].empty? ? '' : "echo #{config[$1]}"}
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
Expand Down
2 changes: 2 additions & 0 deletions mrbgems/mruby-bin-mruby-config/mruby-config
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@ while [ $# -gt 0 ]; do
--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
Expand Down
6 changes: 6 additions & 0 deletions mrbgems/mruby-bin-mruby-config/mruby-config.bat
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ 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
Expand All @@ -27,10 +28,15 @@ goto top
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
2 changes: 2 additions & 0 deletions tasks/libmruby.rake
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ MRuby.each_target do

gem_libraries = gems.map { |g| g.linker.libraries }
f.puts "MRUBY_LIBS = #{linker.option_library % 'mruby'} #{linker.library_flags(gem_libraries)}"

f.puts "MRUBY_LIBMRUBY_PATH = #{libfile("#{build_dir}/lib/libmruby")}"
end
end
task :all => "#{build_dir}/lib/libmruby.flags.mak"
Expand Down

0 comments on commit 52a0380

Please sign in to comment.