ruby_select experimental implementation
kimura wataru
kimuraw at macports.org
Wed Apr 22 06:00:51 PDT 2009
Hi,
I write experimental ruby_select for ruby186 and ruby18.
http://trac.macports.org/browser/users/kimuraw/ruby_select
== install destinations
* different name for ruby bundled commands and libraries
* share library and document directory for additional libraries
this allows to activate both of ruby186 and ruby18.
dir,file 1.8.6(ruby186) 1.8.7(ruby18)
------------------------------------------------------------
bin/ruby bin/ruby186 bin/ruby18
bin/irb bin/irb186 bin/irb18
:
libdir lib/ruby/1.8.6/ lib/ruby/1.8.7/
sitedir lib/ruby/site_ruby/1.8/ (share)
vendordir lib/ruby/vendor_ruby/1.8/ (share)
libruby.so libruby186.dylib libruby18.dylib
ri sysdir share/ri/1.8/system1.8.6/ share/ri/1.8/system1.8.7/
ri sitedir share/ri/1.8/site/ (share)
------------------------------------------------------------
macports' vendor-specific.rb and site-specific.rb are moved
to lidir from vendordir and sitedir to avoid conflicts.
== ruby_select
sysutils/ruby_select uses same tool as port:python_select or port:gcc_selct.
% sudo ruby_select ruby18
Selecting version "ruby18" for ruby
% ls -l /opt/local/bin/ruby
lrwxr-xr-x 1 root admin 21 Apr 18 21:03 /opt/local/bin/ruby@ -> /opt/local/bin/ruby18
% sudo ruby_select ruby186
Selecting version "ruby186" for ruby
% ls -l /opt/local/bin/ruby
lrwxr-xr-x 1 root admin 22 Apr 18 21:06 /opt/local/bin/ruby@ -> /opt/local/bin/ruby186
the following files are targets of ruby_select.
* bin/ ruby, erb, irb, rdoc, ri, testrb
* lib/ libruby.dylib, libruby-static.a
ruby_select make symlinks the above files at post-activate.
then, install ruby_select means existence of ${prefix}/bin/ruby (without suffix).
I expect this port become a meta port port:ruby.
== linking libruby
ruby_select introduce libruby.dylib. this file is a symbolic link for
libruby186.dylib or libruby18.dylib. and, vendor-specific.rb changes
LIBRUBYARG and so on.
% ruby -rrbconfig -e 'p Config::CONFIG["LIBRUBYARG"]'
"-lruby18"
% ruby -rvendor-specific -rrbconfig -e 'p Config::CONFIG["LIBRUBYARG"]'
"-lruby"
so, port:rb-* links libruby.dylib and extension modules (.bundle)
use ruby_select-ed libruby.
this implementation is not enough. please tell me your thoughts.
--
kimura wataru
More information about the macports-dev
mailing list