[macruby-changes] [4070] MacRuby/trunk/rakelib/builder/options.rb

source_changes at macosforge.org source_changes at macosforge.org
Tue May 11 14:26:07 PDT 2010


Revision: 4070
          http://trac.macosforge.org/projects/ruby/changeset/4070
Author:   lsansonetti at apple.com
Date:     2010-05-11 14:26:06 -0700 (Tue, 11 May 2010)
Log Message:
-----------
added the optz_level rakefile variable: set it to 0 to build a version of MacRuby without optimizations (no inlining), default is 3

Modified Paths:
--------------
    MacRuby/trunk/rakelib/builder/options.rb

Modified: MacRuby/trunk/rakelib/builder/options.rb
===================================================================
--- MacRuby/trunk/rakelib/builder/options.rb	2010-05-11 21:25:23 UTC (rev 4069)
+++ MacRuby/trunk/rakelib/builder/options.rb	2010-05-11 21:26:06 UTC (rev 4070)
@@ -47,6 +47,7 @@
 ENABLE_DEBUG_LOGGING    = b.option('enable_debug_logging', true) { |x| x == 'true' }
 SIMULTANEOUS_JOBS       = b.option('jobs', 1) { |x| x.to_i }
 COMPILE_STDLIB          = b.option('compile_stdlib', true) { |x| x == 'true' }
+OPTZ_LEVEL              = b.option('optz_level', 3) { |x| x.to_i }
 
 # Everything below this comment should *not* be modified.
 
@@ -72,6 +73,11 @@
   exit 1
 end
 
+if OPTZ_LEVEL < 0 || OPTZ_LEVEL > 3
+  $stderr.puts "Incorrect optimization level: #{OPTZ_LEVEL}"
+  exit 1
+end
+
 version_h = File.read('version.h')
 NEW_RUBY_VERSION = version_h.scan(/#\s*define\s+RUBY_VERSION\s+\"([^"]+)\"/)[0][0]
 unless defined?(MACRUBY_VERSION)
@@ -104,10 +110,12 @@
 
 CC = '/usr/bin/gcc-4.2'
 CXX = '/usr/bin/g++-4.2'
-CFLAGS = "-I. -I./include -I/usr/include/libxml2 #{ARCHFLAGS} -fno-common -pipe -O3 -g -Wall -fexceptions"
+OPTZFLAG = "-O#{OPTZ_LEVEL}"
+CFLAGS = "-I. -I./include -I/usr/include/libxml2 #{ARCHFLAGS} -fno-common -pipe -g -Wall -fexceptions #{OPTZFLAG}"
 CFLAGS << " -Wno-deprecated-declarations -Werror" if NO_WARN_BUILD
 OBJC_CFLAGS = CFLAGS + " -fobjc-gc-only"
 CXXFLAGS = `#{LLVM_CONFIG} --cxxflags #{LLVM_MODULES}`.sub(/-DNDEBUG/, '').sub(/-fno-exceptions/, '').strip
+CXXFLAGS.sub!(/-O\d/, OPTZFLAG)
 CXXFLAGS << " -I. -I./include -g -Wall #{ARCHFLAGS}"
 CXXFLAGS << " -Wno-deprecated-declarations -Werror" if NO_WARN_BUILD
 CXXFLAGS << " -DLLVM_TOT" if ENV['LLVM_TOT']
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20100511/e800d0d7/attachment.html>


More information about the macruby-changes mailing list