[macruby-changes] [4307] MacRuby/trunk/bin/rubyc

source_changes at macosforge.org source_changes at macosforge.org
Tue Jun 29 18:33:47 PDT 2010


Revision: 4307
          http://trac.macosforge.org/projects/ruby/changeset/4307
Author:   lsansonetti at apple.com
Date:     2010-06-29 18:33:47 -0700 (Tue, 29 Jun 2010)
Log Message:
-----------
rubyc: add --sdk option (work in progress)

Modified Paths:
--------------
    MacRuby/trunk/bin/rubyc

Modified: MacRuby/trunk/bin/rubyc
===================================================================
--- MacRuby/trunk/bin/rubyc	2010-06-30 01:31:12 UTC (rev 4306)
+++ MacRuby/trunk/bin/rubyc	2010-06-30 01:33:47 UTC (rev 4307)
@@ -24,6 +24,7 @@
       opts.on('-o <file>', 'Place the output into <file>') { |output| @output = output }
       opts.on('--static', "Create a standalone static executable") { @static = true }
       opts.on('--framework <name>', "Link standalone static executable with given framework") { |p| @frameworks << p }
+      opts.on('--sdk <path>', "Use SDK when compiling standalone static executable") { |x| @sdk = x }
       opts.on('--dylib', "Create a dynamic library") { @dylib = true }
       opts.on('-C', 'Compile, assemble and link a loadable object file') { @bundle = true }
       opts.on('-a', '--arch <ARCH>', 'Compile for specified CPU architecture') { |arch| @archs << arch }
@@ -44,6 +45,9 @@
           die "Invalid CPU architecture `#{arch}'. Possible values are: " + VALID_ARCHS.join(", ")
         end
       end
+      if @sdk and !File.exist?(@sdk)
+        die "Given SDK path `#{@sdk}' doesn't exist."
+      end
       @frameworks.uniq!
     end
 
@@ -80,12 +84,13 @@
         if File.exist?(f)
 	  "#{f}/Resources/BridgeSupport/#{File.basename(f)}Full.bridgesupport"
         else
-          "/System/Library/Frameworks/#{f}.framework/Resources/BridgeSupport/#{f}Full.bridgesupport"
+          base = (@sdk || '')
+          File.join(base, "/System/Library/Frameworks/#{f}.framework/Resources/BridgeSupport/#{f}Full.bridgesupport")
         end
       if File.exist?(p)
         @uses_bs_flags << "--uses-bs #{p} "
       else
-        die "Couldn't locate the Full BridgeSupport file for framework: `%{f}'"
+        $stderr.puts "Couldn't locate the Full BridgeSupport file for framework `#{f}' at path `#{p}', compilation might generate a unusable binary!"
       end
     end
     if @dont_link or @bundle
@@ -294,7 +299,12 @@
 
     # Link all objects into executable.
     path = @internal ? "-L." : "-L#{RbConfig::CONFIG['libdir']}"
-    linkf = "-lobjc -licucore -lauto "
+    linkf = ""
+    if @sdk
+      path = ''
+      linkf << "-F#{@sdk}/System/Library/Frameworks -L#{@sdk}/usr/lib "
+    end
+    linkf << "-lobjc -licucore -lauto "
     @frameworks.each { |f| linkf << "-framework #{f} " }
     linkf << (@static ?
       "#{path} #{RbConfig::CONFIG['LIBRUBYARG_STATIC_REALLY']}" :
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20100629/898f2f7d/attachment.html>


More information about the macruby-changes mailing list