From a87fcea92bd274687f52e0e512b4a949f29d0666 Mon Sep 17 00:00:00 2001 From: Watson Date: Tue, 1 Oct 2013 17:26:28 +0900 Subject: [PATCH] introduce the flag to stop strip in order to debug RubyMotion app --- README.md | 13 +++---------- bin/Rakefile | 10 ++++++---- data/Rakefile | 9 +++++++-- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index e927c38c..8d78dc70 100644 --- a/README.md +++ b/README.md @@ -22,22 +22,15 @@ $ bundle install ## How to debug on RubyMotion app -First, comment out `[ios, sim].map ...` (line 31) in `data/Rakefile` as following: -```ruby - 29 # remove debug symbols - 30 strip = File.join(PLATFORMS_DIR, '../usr/bin/strip') - 31 # [ios, sim].map { |x| Dir.glob(x + '/*.{a,dylib}') }.flatten.each { |x| sh("\"#{strip}\" -S \"#{x}\"") } -``` - -Then, build RubyMotion +Build RubyMotion as following (enable `DEBUG` environment variable) ``` -$ rake optz_level=0 +$ DEBUG=true rake $ sudo rake install ``` -At last, debug on RubyMotion app +Debug on RubyMotion app ``` $ rake debug=1 no_continue=1 diff --git a/bin/Rakefile b/bin/Rakefile index f19c3574..7b084ed5 100644 --- a/bin/Rakefile +++ b/bin/Rakefile @@ -1,4 +1,5 @@ verbose(true) +NEED_STRIP = !ENV['DEBUG'] task :default => :all task :all => [:files, :deploy, :sim, :nfd] @@ -6,8 +7,9 @@ task :all => [:files, :deploy, :sim, :nfd] STRIP = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/strip" task :files do + bin = 'ruby' install '../vm/miniruby', 'ruby' - sh "#{STRIP} -x ruby" + sh "#{STRIP} -x \"#{bin}\"" if NEED_STRIP end task :deploy do @@ -15,7 +17,7 @@ task :deploy do bin = 'ios/deploy' if !File.exist?(bin) or File.mtime('deploy.m') > File.mtime(bin) or File.mtime('builtin_debugger_cmds.h') > File.mtime(bin) sh "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -mmacosx-version-min=10.6 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk -I./src -std=c99 -Wall -O3 deploy.m -o \"#{bin}\" -framework Foundation -I." - sh "#{STRIP} -x \"#{bin}\"" + sh "#{STRIP} -x \"#{bin}\"" if NEED_STRIP end end @@ -26,7 +28,7 @@ task :sim do if !File.exist?(bin) or File.mtime('sim.m') > File.mtime(bin) or File.mtime('builtin_debugger_cmds.h') > File.mtime(bin) define = "-DSIMULATOR_#{template.upcase}" sh "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang #{define} -mmacosx-version-min=10.6 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk -I./src -std=c99 -Wall -O3 sim.m -o \"#{bin}\" -framework Foundation -framework ApplicationServices -framework AppKit -L. -ledit -Wl,-rpath,/usr/lib -I." - sh "#{STRIP} -x \"#{bin}\"" + sh "#{STRIP} -x \"#{bin}\"" if NEED_STRIP end end end @@ -35,7 +37,7 @@ task :nfd do bin = 'nfd' if !File.exist?(bin) or File.mtime('nfd.m') > File.mtime(bin) sh "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -mmacosx-version-min=10.6 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk -I./src -std=c99 -Wall -O3 nfd.m -o \"#{bin}\" -framework Foundation -I." - sh "#{STRIP} -x \"#{bin}\"" + sh "#{STRIP} -x \"#{bin}\"" if NEED_STRIP end end diff --git a/data/Rakefile b/data/Rakefile index c7ea2aa8..94e692fd 100644 --- a/data/Rakefile +++ b/data/Rakefile @@ -3,6 +3,7 @@ IOS_SDK_VERSIONS = ENV['ios_sdk_versions'].split(',') OSX_SDK_VERSIONS = ENV['osx_sdk_versions'].split(',') verbose(true) +NEED_STRIP = !ENV['DEBUG'] task :default => :all task :all => [:vm_files, :bridgesupport_files, :bridgesupport_static_stubs] @@ -22,7 +23,9 @@ task :vm_files do install File.join(objs, 'libmacruby-repl.dylib'), sdk # remove debug symbols - Dir.glob(sdk + '/*.{a,dylib}').each { |x| sh("\"#{strip}\" -S \"#{x}\"") } + if NEED_STRIP + Dir.glob(sdk + '/*.{a,dylib}').each { |x| sh("\"#{strip}\" -S \"#{x}\"") } + end end IOS_SDK_VERSIONS.each do |sdk_version| @@ -45,7 +48,9 @@ task :vm_files do install File.join(objs, 'libmacruby-repl.dylib'), sim # remove debug symbols - [ios, sim].map { |x| Dir.glob(x + '/*.{a,dylib}') }.flatten.each { |x| sh("\"#{strip}\" -S \"#{x}\"") } + if NEED_STRIP + [ios, sim].map { |x| Dir.glob(x + '/*.{a,dylib}') }.flatten.each { |x| sh("\"#{strip}\" -S \"#{x}\"") } + end end end