[macruby-changes] [4472] MacRuby/trunk

source_changes at macosforge.org source_changes at macosforge.org
Thu Aug 26 23:43:46 PDT 2010


Revision: 4472
          http://trac.macosforge.org/projects/ruby/changeset/4472
Author:   joshua.ballanco at apple.com
Date:     2010-08-26 23:43:45 -0700 (Thu, 26 Aug 2010)
Log Message:
-----------
Added some linker options to rubyc

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

Modified: MacRuby/trunk/bin/rubyc
===================================================================
--- MacRuby/trunk/bin/rubyc	2010-08-27 03:37:03 UTC (rev 4471)
+++ MacRuby/trunk/bin/rubyc	2010-08-27 06:43:45 UTC (rev 4472)
@@ -16,6 +16,7 @@
     @archs = []
     @internal = argv.delete('--internal')
     @frameworks = %w{Foundation}
+    @linkf = []
 
     # Parse arguments.
     OptionParser.new do |opts|
@@ -26,6 +27,9 @@
       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('--compatibility_version <VERSION>', "Compatibility Version for linking") { |ver| @linkf << "-compatibility_version #{ver}" }
+      opts.on('--current_version <VERSION>', "Current Version for linking") { |ver| @linkf << "-current_version #{ver}" }
+      opts.on('--install_name <NAME>', "Install Name for linking") { |name| @linkf << "-install_name #{name}" }
       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 }
       opts.on('-v', '--version', 'Display the version') { puts RUBY_DESCRIPTION; exit 1 }
@@ -139,7 +143,7 @@
   end
 
   def cleanup
-    @tmpfiles.each { |x| File.delete(x) }
+    @tmpfiles.each { |x| File.delete(x) if File.exist?(x) }
   end
 
   private
@@ -224,9 +228,9 @@
     # Build.
     main = gen_tmpfile('main', 'c')
     File.open(main, 'w') { |io| io.write(main_txt) }
-    linkf = @internal ? "-L. -lmacruby" : "-L#{RbConfig::CONFIG['libdir']} -lmacruby"
+    @linkf << @internal ? "-L. -lmacruby" : "-L#{RbConfig::CONFIG['libdir']} -lmacruby"
     objs = objs_data.map { |obj, f| "\"#{obj}\"" }.join(' ') 
-    execute("#{@gcxx} \"#{main}\" -dynamiclib -dynamic -undefined suppress -flat_namespace #{arch_flags} #{linkf} #{objs} -o \"#{output}\"")
+    execute("#{@gcxx} \"#{main}\" -dynamiclib -dynamic -undefined suppress -flat_namespace #{arch_flags} #{@linkf.join(' ')} #{objs} -o \"#{output}\"")
     strip(output)
   end
 

Modified: MacRuby/trunk/rubyc.1
===================================================================
--- MacRuby/trunk/rubyc.1	2010-08-27 03:37:03 UTC (rev 4471)
+++ MacRuby/trunk/rubyc.1	2010-08-27 06:43:45 UTC (rev 4472)
@@ -45,6 +45,16 @@
 .Nm require
 method.
 .Pp
+.It Fl h, Fl -help
+Display a short description of the command line options.
+.Pp
+.It Fl o Ar file
+Place the output into
+.Ar file .
+If this option is not given, 
+.Nm macrubyc
+will try to determine a default output file name based on the object file type that is being generated. For executables, the default is a.out. For objects, the default is the original source file name with the object type extension. For dynamic libraries, this option is mandatory.
+.Pp
 .It Fl -dylib
 Create a dynamic library instead of an executable. This option compiles every Ruby source file passed to 
 .Nm macrubyc
@@ -54,16 +64,17 @@
 .Fl o
 option must be provided when building dynamic libraries.
 .Pp
-.It Fl h, Fl -help
-Display a short description of the command line options.
+.Bl -tag -width XXXXXXXXXX
+The
+.Fl -dylib
+option can also take the following optional linker arguments (see
+.Xr libtool 1
+for more information):
+.It Fl -compatibility_version Ar VERSION
+.It Fl -current_version Ar VERSION
+.It Fl -install_name Ar NAME
+.El
 .Pp
-.It Fl o Ar file
-Place the output into
-.Ar file .
-If this option is not given, 
-.Nm macrubyc
-will try to determine a default output file name based on the object file type that is being generated. For executables, the default is a.out. For objects, the default is the original source file name with the object type extension. For dynamic libraries, this option is mandatory.
-.Pp
 .It Fl -static
 Create a standalone, static executable. By default, executables created by
 .Nm macrubyc
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20100826/7c2a26bd/attachment.html>


More information about the macruby-changes mailing list