From 89b931a9325db2623490bf5f99672213b600e10e Mon Sep 17 00:00:00 2001 From: Tom Black Date: Sun, 25 Feb 2018 17:18:27 -0800 Subject: Fix native building of apps --- bin/ruby2d | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'bin') diff --git a/bin/ruby2d b/bin/ruby2d index 5c11a67..d7b1e15 100755 --- a/bin/ruby2d +++ b/bin/ruby2d @@ -60,8 +60,8 @@ def make_lib end lib << " -include Ruby2D::DSL -include Ruby2D\n" +include Ruby2D +extend Ruby2D::DSL\n" File.write('build/lib.rb', lib) end @@ -87,13 +87,16 @@ def build_native(rb_file) exit end + # Add debugging information to produce backtrace + if @debug then debug_flag = '-g' end + # Assemble the Ruby 2D library in one `.rb` file and compile to bytecode make_lib - `mrbc -Bruby2d_lib -obuild/lib.c build/lib.rb` + `mrbc #{debug_flag} -Bruby2d_lib -obuild/lib.c build/lib.rb` # Read the provided Ruby source file, copy to build dir and compile to bytecode File.open('build/src.rb', 'w') { |file| file << strip_require(rb_file) } - `mrbc -Bruby2d_app -obuild/src.c build/src.rb` + `mrbc #{debug_flag} -Bruby2d_app -obuild/src.c build/src.rb` # Combine contents of C source files and bytecode into one file open('build/app.c', 'w') do |f| @@ -165,13 +168,16 @@ def build_apple(rb_file, device) exit end + # Add debugging information to produce backtrace + if @debug then debug_flag = '-g' end + # Assemble the Ruby 2D library in one `.rb` file and compile to bytecode make_lib - `mrbc -Bruby2d_lib -obuild/lib.c build/lib.rb` + `mrbc #{debug_flag} -Bruby2d_lib -obuild/lib.c build/lib.rb` # Read the provided Ruby source file, copy to build dir and compile to bytecode File.open('build/src.rb', 'w') { |file| file << strip_require(rb_file) } - `mrbc -Bruby2d_app -obuild/src.c build/src.rb` + `mrbc #{debug_flag} -Bruby2d_app -obuild/src.c build/src.rb` # Copy over iOS project FileUtils.cp_r "#{@gem_dir}/assets/#{device}", "build" -- cgit v1.2.3