[csw-devel] SF.net SVN: gar:[6972] csw/mgar/pkg/ruby/trunk

bdwalton at users.sourceforge.net bdwalton at users.sourceforge.net
Mon Oct 26 02:57:14 CET 2009


Revision: 6972
          http://gar.svn.sourceforge.net/gar/?rev=6972&view=rev
Author:   bdwalton
Date:     2009-10-26 01:57:14 +0000 (Mon, 26 Oct 2009)

Log Message:
-----------
ruby: setup support for switching rbconfig.rb for alternation gem compilation settings, etc

Modified Paths:
--------------
    csw/mgar/pkg/ruby/trunk/Makefile

Added Paths:
-----------
    csw/mgar/pkg/ruby/trunk/files/README.csw
    csw/mgar/pkg/ruby/trunk/files/cswrbconfig
    csw/mgar/pkg/ruby/trunk/files/rbconfig.rb.GCC4

Modified: csw/mgar/pkg/ruby/trunk/Makefile
===================================================================
--- csw/mgar/pkg/ruby/trunk/Makefile	2009-10-25 22:08:57 UTC (rev 6971)
+++ csw/mgar/pkg/ruby/trunk/Makefile	2009-10-26 01:57:14 UTC (rev 6972)
@@ -114,11 +114,23 @@
 
 SPKG_REVSTAMP := $(SPKG_REVSTAMP)_rev=$(PATCHLEVEL)
 
-PI_TARGETS  = samples rbconfig rbscripts rubymode
+RBCONFIG = /opt/csw/lib/ruby/1.8/$(GARCH)-solaris2.8/rbconfig.rb
 
+PI_TARGETS  = samples rbconfig rbscripts rubymode multiconfig
+
 post-install-modulated: $(PI_TARGETS)
 	@$(MAKECOOKIE)
 
+multiconfig:
+	@echo "Setting up the CSW rbconfig stuff so we can switch between compilers"
+	@mv $(DESTDIR)$(RBCONFIG) $(DESTDIR)$(RBCONFIG).SOS11
+	@gcp $(FILEDIR)/rbconfig.rb.GCC4 $(DESTDIR)/$(RBCONFIG).GCC4
+	@gln -s $(RBCONFIG).SOS11 $(DESTDIR)$(RBCONFIG)
+	@gcp $(FILEDIR)/cswrbconfig $(DESTDIR)/opt/csw/bin/
+	@chmod 755 $(DESTDIR)/opt/csw/bin/cswrbconfig
+	@ginstall -c -d -m 0755 $(DESTDIR)$(docdir)/ruby/
+	@ginstall -c -m 0644 $(FILEDIR)/README.csw $(DESTDIR)$(docdir)/ruby/
+
 rubymode: RMDIR=$(DESTDIR)/$(datadir)/emacs/site-lisp/ruby-mode
 rubymode:
 	@echo " ===> Installing and Compilingn ruby-mode elisp"

Added: csw/mgar/pkg/ruby/trunk/files/README.csw
===================================================================
--- csw/mgar/pkg/ruby/trunk/files/README.csw	                        (rev 0)
+++ csw/mgar/pkg/ruby/trunk/files/README.csw	2009-10-26 01:57:14 UTC (rev 6972)
@@ -0,0 +1,11 @@
+It is possible to switch rbconfig.rb files in order to use alternate
+compilation options or even compilers.  CSWruby ships with settings
+for Sun Studio 11 (what ruby was built with) and GCC4.  Our
+distribution of ruby sees rbconfig.rb be a symlink to
+rbconfig.rb.SOS11 by default.  To switch your settings, use the
+cswrbconfig tool provided.  Running it with no arguments will provide
+more details and list available configurations.
+
+Please file a bug on CSWruby if you have problems using this tool.
+
+Ben Walton <bwalton at opencsw.org>

Added: csw/mgar/pkg/ruby/trunk/files/cswrbconfig
===================================================================
--- csw/mgar/pkg/ruby/trunk/files/cswrbconfig	                        (rev 0)
+++ csw/mgar/pkg/ruby/trunk/files/cswrbconfig	2009-10-26 01:57:14 UTC (rev 6972)
@@ -0,0 +1,54 @@
+#!/opt/csw/bin/ruby -w
+
+ARCH = %x{uname -p}.chomp
+CONFD = "/opt/csw/lib/ruby/1.8/#{ARCH}-solaris2.8"
+RBC = File.join(CONFD, "rbconfig.rb")
+CUR_RBC = File.readlink(RBC).gsub(/.*\./, '')
+
+CONF_OPTS = Dir.glob("#{CONFD}/rbconfig.rb.*").map! { |c| c.gsub(/.*\./, '') }
+
+def usage(errstr)
+  puts "ERROR: #{errstr}"
+  puts <<-"EOF"
+
+Usage: #{File.basename($0)} <new rbconfig option>
+
+This tool allows you to switch rbconfig.rb between options available
+on your system.  The benefit of this is that you can build native gems
+using options other than those used to build Ruby itself (Sun Studio
+11 -> sos11), including alternate compilers.
+
+rbconfig.rb is found in #{CONFD}.
+
+Existing options are determined by the presence of rbconfig.rb.FOO
+files in #{CONFD}.
+
+The current value is: #{CUR_RBC}
+
+The options present on your system are:
+    EOF
+
+  puts CONF_OPTS.join("\n")
+  exit(1)
+end
+
+if ARGV.size.eql?(0)
+  usage("No argument specified.")
+else
+  usage("Something is wrong with your rbconfig.rb symlink setup.") unless File.symlink?(RBC) and File.exists?(RBC)
+
+  usage("No action required.") if CUR_RBC.eql?(ARGV[0])
+
+  usage("Invalid rbconfig option.") unless CONF_OPTS.include?(ARGV[0])
+
+  opt_rbc = RBC + '.' + ARGV[0]
+
+  usage("Selection option is valid but there's something wrong with the file it refers to (#{opt_rbc}).") unless File.exists?(opt_rbc) and File.file?(opt_rbc)
+
+  begin
+    File.unlink(RBC)
+    File.symlink(opt_rbc, RBC)
+  rescue
+    usage("Error while switching rbconfig.rb symlink.  Please inspect the situation in #{CONFD}.")
+  end
+end


Property changes on: csw/mgar/pkg/ruby/trunk/files/cswrbconfig
___________________________________________________________________
Added: svn:executable
   + *

Added: csw/mgar/pkg/ruby/trunk/files/rbconfig.rb.GCC4
===================================================================
--- csw/mgar/pkg/ruby/trunk/files/rbconfig.rb.GCC4	                        (rev 0)
+++ csw/mgar/pkg/ruby/trunk/files/rbconfig.rb.GCC4	2009-10-26 01:57:14 UTC (rev 6972)
@@ -0,0 +1,182 @@
+
+# This file was created by mkconfig.rb when ruby was built.  Any
+# changes made to this file will be lost the next time ruby is built.
+
+module Config
+  RUBY_VERSION == "1.8.7" or
+    raise "ruby lib version (1.8.7) doesn't match executable version (#{RUBY_VERSION})"
+
+  TOPDIR = File.dirname(__FILE__).chomp!("/lib/ruby/1.8/i386-solaris2.8")
+  DESTDIR = '' unless defined? DESTDIR
+  CONFIG = {}
+  CONFIG["DESTDIR"] = DESTDIR
+  CONFIG["INSTALL"] = '/opt/csw/bin/ginstall -c'
+  CONFIG["prefix"] = (TOPDIR || DESTDIR + "/opt/csw")
+  CONFIG["EXEEXT"] = ""
+  CONFIG["ruby_install_name"] = "ruby"
+  CONFIG["RUBY_INSTALL_NAME"] = "ruby"
+  CONFIG["RUBY_SO_NAME"] = "ruby"
+  CONFIG["SHELL"] = "/bin/bash"
+  CONFIG["PATH_SEPARATOR"] = ":"
+  CONFIG["PACKAGE_NAME"] = ""
+  CONFIG["PACKAGE_TARNAME"] = ""
+  CONFIG["PACKAGE_VERSION"] = ""
+  CONFIG["PACKAGE_STRING"] = ""
+  CONFIG["PACKAGE_BUGREPORT"] = ""
+  CONFIG["exec_prefix"] = "$(DESTDIR)/opt/csw"
+  CONFIG["bindir"] = "$(DESTDIR)/opt/csw/bin"
+  CONFIG["sbindir"] = "$(DESTDIR)/opt/csw/sbin"
+  CONFIG["libexecdir"] = "$(DESTDIR)/opt/csw/libexec"
+  CONFIG["datarootdir"] = "$(prefix)/share"
+  CONFIG["datadir"] = "$(DESTDIR)/opt/csw/share"
+  CONFIG["sysconfdir"] = "$(DESTDIR)/opt/csw/etc"
+  CONFIG["sharedstatedir"] = "$(DESTDIR)/opt/csw/share"
+  CONFIG["localstatedir"] = "$(DESTDIR)/opt/csw/var"
+  CONFIG["includedir"] = "$(DESTDIR)/opt/csw/include"
+  CONFIG["oldincludedir"] = "/usr/include"
+  CONFIG["docdir"] = "$(datarootdir)/doc/$(PACKAGE)"
+  CONFIG["infodir"] = "$(DESTDIR)/opt/csw/share/info"
+  CONFIG["htmldir"] = "$(docdir)"
+  CONFIG["dvidir"] = "$(docdir)"
+  CONFIG["pdfdir"] = "$(docdir)"
+  CONFIG["psdir"] = "$(docdir)"
+  CONFIG["libdir"] = "$(DESTDIR)/opt/csw/lib"
+  CONFIG["localedir"] = "$(datarootdir)/locale"
+  CONFIG["mandir"] = "$(DESTDIR)/opt/csw/share/man"
+  CONFIG["DEFS"] = "-D_FILE_OFFSET_BITS=64"
+  CONFIG["ECHO_C"] = ""
+  CONFIG["ECHO_N"] = "-n"
+  CONFIG["ECHO_T"] = ""
+  CONFIG["LIBS"] = "-lpthread -lrt -ldl -lcrypt -lm "
+  CONFIG["build_alias"] = ""
+  CONFIG["host_alias"] = ""
+  CONFIG["target_alias"] = ""
+  CONFIG["MAJOR"] = "1"
+  CONFIG["MINOR"] = "8"
+  CONFIG["TEENY"] = "7"
+  CONFIG["build"] = "i386-pc-solaris2.8"
+  CONFIG["build_cpu"] = "i386"
+  CONFIG["build_vendor"] = "pc"
+  CONFIG["build_os"] = "solaris2.8"
+  CONFIG["host"] = "i386-pc-solaris2.8"
+  CONFIG["host_cpu"] = "i386"
+  CONFIG["host_vendor"] = "pc"
+  CONFIG["host_os"] = "solaris2.8"
+  CONFIG["target"] = "i386-pc-solaris2.8"
+  CONFIG["target_cpu"] = "i386"
+  CONFIG["target_vendor"] = "pc"
+  CONFIG["target_os"] = "solaris2.8"
+  CONFIG["CC"] = "/opt/csw/gcc4/bin/gcc"
+  CONFIG["CFLAGS"] = "-mtune=i686 -O2 -pipe -m32 -march=i386 -I/opt/csw/include  -fPIC $(cflags)"
+  CONFIG["LDFLAGS"] = "-L. -L/opt/csw/gcc4/lib/. -m32 -march=i386 -R /opt/csw/gcc4/lib -L/opt/csw/lib"
+  CONFIG["CPPFLAGS"] = "-I/opt/csw/include $(DEFS) $(cppflags)"
+  CONFIG["OBJEXT"] = "o"
+  CONFIG["CPP"] = "/opt/csw/gcc4/bin/gcc -E"
+  CONFIG["GREP"] = "/opt/csw/bin/ggrep"
+  CONFIG["EGREP"] = "/opt/csw/bin/ggrep -E"
+  CONFIG["GNU_LD"] = "no"
+  CONFIG["CPPOUTFILE"] = "-o conftest.i"
+  CONFIG["OUTFLAG"] = "-o "
+  CONFIG["YACC"] = "bison -y"
+  CONFIG["YFLAGS"] = ""
+  CONFIG["RANLIB"] = "ranlib"
+  CONFIG["AR"] = "ar"
+  CONFIG["AS"] = "as"
+  CONFIG["ASFLAGS"] = ""
+  CONFIG["NM"] = ""
+  CONFIG["WINDRES"] = ""
+  CONFIG["DLLWRAP"] = ""
+  CONFIG["OBJDUMP"] = ""
+  CONFIG["LN_S"] = "ln -s"
+  CONFIG["SET_MAKE"] = ""
+  CONFIG["INSTALL_PROGRAM"] = "$(INSTALL)"
+  CONFIG["INSTALL_SCRIPT"] = "$(INSTALL)"
+  CONFIG["INSTALL_DATA"] = "$(INSTALL) -m 644"
+  CONFIG["RM"] = "rm -f"
+  CONFIG["CP"] = "cp"
+  CONFIG["MAKEDIRS"] = "mkdir -p"
+  CONFIG["ALLOCA"] = ""
+  CONFIG["DLDFLAGS"] = ""
+  CONFIG["ARCH_FLAG"] = ""
+  CONFIG["STATIC"] = ""
+  CONFIG["CCDLFLAGS"] = " -fPIC"
+  CONFIG["LDSHARED"] = "$(CC) -shared"
+  CONFIG["DLEXT"] = "so"
+  CONFIG["DLEXT2"] = ""
+  CONFIG["LIBEXT"] = "a"
+  CONFIG["LINK_SO"] = ""
+  CONFIG["LIBPATHFLAG"] = " -L%1$-s"
+  CONFIG["RPATHFLAG"] = " -Wl,-R%1$-s"
+  CONFIG["LIBPATHENV"] = "LD_LIBRARY_PATH"
+  CONFIG["TRY_LINK"] = ""
+  CONFIG["STRIP"] = "strip"
+  CONFIG["EXTSTATIC"] = ""
+  CONFIG["setup"] = "Setup"
+  CONFIG["PREP"] = "miniruby$(EXEEXT)"
+  CONFIG["EXTOUT"] = ".ext"
+  CONFIG["ARCHFILE"] = ""
+  CONFIG["RDOCTARGET"] = "install-doc"
+  CONFIG["cppflags"] = "-I/opt/csw/include"
+  CONFIG["cflags"] = "$(optflags) $(debugflags)"
+  CONFIG["optflags"] = ""
+  CONFIG["debugflags"] = ""
+  CONFIG["LIBRUBY_LDSHARED"] = "$(CC) -shared"
+  CONFIG["LIBRUBY_DLDFLAGS"] = " -Wl,-h,$(@|#_!!_#|F)"
+  CONFIG["rubyw_install_name"] = ""
+  CONFIG["RUBYW_INSTALL_NAME"] = ""
+  CONFIG["LIBRUBY_A"] = "lib$(RUBY_SO_NAME)-static.a"
+  CONFIG["LIBRUBY_SO"] = "lib$(RUBY_SO_NAME).so.$(MAJOR)"
+  CONFIG["LIBRUBY_ALIASES"] = "lib$(RUBY_SO_NAME).so.$(MAJOR).$(MINOR).$(TEENY) lib$(RUBY_SO_NAME).so"
+  CONFIG["LIBRUBY"] = "$(LIBRUBY_SO)"
+  CONFIG["LIBRUBYARG"] = "$(LIBRUBYARG_SHARED)"
+  CONFIG["LIBRUBYARG_STATIC"] = "-l$(RUBY_SO_NAME)-static"
+  CONFIG["LIBRUBYARG_SHARED"] = "-Wl,-R -Wl,$(libdir) -L$(libdir) -l$(RUBY_SO_NAME)"
+  CONFIG["SOLIBS"] = "$(LIBS)"
+  CONFIG["DLDLIBS"] = " -lc"
+  CONFIG["ENABLE_SHARED"] = "yes"
+  CONFIG["MAINLIBS"] = ""
+  CONFIG["COMMON_LIBS"] = ""
+  CONFIG["COMMON_MACROS"] = ""
+  CONFIG["COMMON_HEADERS"] = ""
+  CONFIG["EXPORT_PREFIX"] = ""
+  CONFIG["MAKEFILES"] = "Makefile"
+  CONFIG["arch"] = "i386-solaris2.8"
+  CONFIG["sitearch"] = "i386-solaris2.8"
+  CONFIG["sitedir"] = "$(libdir)/ruby/site_ruby"
+  CONFIG["vendordir"] = "$(libdir)/ruby/vendor_ruby"
+  CONFIG["configure_args"] = " '--prefix=/opt/csw' '--exec_prefix=/opt/csw' '--bindir=/opt/csw/bin' '--sbindir=/opt/csw/sbin' '--libexecdir=/opt/csw/libexec' '--datadir=/opt/csw/share' '--sysconfdir=/opt/csw/etc' '--sharedstatedir=/opt/csw/share' '--localstatedir=/opt/csw/var' '--libdir=/opt/csw/lib' '--infodir=/opt/csw/share/info' '--includedir=/opt/csw/include' '--mandir=/opt/csw/share/man' '--enable-pthread' '--enable-shared' '--with-tcl-dir=/opt/csw' '--with-tk-dir=/opt/csw' '--with-dbm-dir=/opt/csw' '--with-gdbm-dir=/opt/csw' '--with-iconv-dir=/opt/csw' '--with-openssl-dir=/opt/csw' '--with-readline-dir=/opt/csw' '--with-zlib-dir=/opt/csw' '--enable-install-doc' 'CC=/opt/csw/gcc4/bin/gcc' 'CFLAGS=-mtune=i686 -O2 -pipe -m32 -march=i386 -I/opt/csw/include' 'LDFLAGS=-L/opt/csw/gcc4/lib/. -m32 -march=i386 -R /opt/csw/gcc4/lib -L/opt/csw/lib' 'CPPFLAGS=-I/opt/csw/include'"
+  CONFIG["NROFF"] = "/usr/bin/nroff"
+  CONFIG["MANTYPE"] = "man"
+  CONFIG["ruby_version"] = "$(MAJOR).$(MINOR)"
+  CONFIG["rubylibdir"] = "$(libdir)/ruby/$(ruby_version)"
+  CONFIG["archdir"] = "$(rubylibdir)/$(arch)"
+  CONFIG["sitelibdir"] = "$(sitedir)/$(ruby_version)"
+  CONFIG["sitearchdir"] = "$(sitelibdir)/$(sitearch)"
+  CONFIG["vendorlibdir"] = "$(vendordir)/$(ruby_version)"
+  CONFIG["vendorarchdir"] = "$(vendorlibdir)/$(sitearch)"
+  CONFIG["topdir"] = File.dirname(__FILE__)
+  MAKEFILE_CONFIG = {}
+  CONFIG.each{|k,v| MAKEFILE_CONFIG[k] = v.dup}
+  def Config::expand(val, config = CONFIG)
+    val.gsub!(/\$\$|\$\(([^()]+)\)|\$\{([^{}]+)\}/) do |var|
+      if !(v = $1 || $2)
+	'$'
+      elsif key = config[v = v[/\A[^:]+(?=(?::(.*?)=(.*))?\z)/]]
+	pat, sub = $1, $2
+	config[v] = false
+	Config::expand(key, config)
+	config[v] = key
+	key = key.gsub(/#{Regexp.quote(pat)}(?=\s|\z)/n) {sub} if pat
+	key
+      else
+	var
+      end
+    end
+    val
+  end
+  CONFIG.each_value do |val|
+    Config::expand(val)
+  end
+end
+RbConfig = Config # compatibility for ruby-1.9
+CROSS_COMPILING = nil unless defined? CROSS_COMPILING


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



More information about the devel mailing list