setup.rb question



  • 1. result of assignment is not the return value
    Given a simple class like this class MyClass attr_reader :value def value=(val) @value = val.to_s end end Why the the following code return the value passed and not the value assigned? c = result = c.value = 2 puts result puts c.value This is currently outputing 2 "2" The results are the same when MyClass is modified to be this. class MyClass attr_reader :value def value=(val) @value = val.to_s return @value end end Shouldn't the result of the 'value=' method be the return value?
  • 2. Hello,everybody,the good shoping place,the new year approaching, click in. Let's facelift bar!
    Hello,everybody,the good shoping place,the new year approaching, click in. Let's facelift bar! ===== HTTP:// ==== Air jordan(1-24)shoes $33 UGG BOOT $50 Nike shox(R4,NZ,OZ,TL1,TL2,TL3) $35 Handbags(Coach lv fendi d&g) $35 Tshirts (Polo ,ed hardy,lacoste) $16 Jean(True Religion,ed hardy,coogi) $30 Sunglasses(Oakey,coach,gucci,Armaini) $16 New era cap $15 Bikini (Ed hardy,polo) $25 FREE SHIPPING
  • 3. where to ruby tk in gem format?
    Wondering, where can I find ruby tcl/tk in gem format? Thank you, -Robin

setup.rb question

Postby Bill Kelly » Sat, 25 Jun 2005 07:07:04 GMT


I'm packaging a ruby extension, and want setup.rb to perform 
a particular part of the install only on a particular platform.

I figure others may have dealt with this with their own 
extensions, and I was wondering how it's usually done.

On win32, I'm including a pre-built .dll that my extension
requires, because it's kind of a pain to build on windows.
I've put the .dll in the bin/ directory - and setup.rb does
the right thing (for windows) and installs the .dll alongside
the ruby.exe binary, wherever that may be on the system.

However, on Linux, the shared library .so's needed by the
extension a) are easy to build, so I see no need to include
pre-built ones, and b) don't belong next to the ruby 
executable anyway... and c) I certainly don't want the
win32 .dll copied into /usr/bin or wherever on Linux.  :)

So my question is how to have setup.rb do the right thing
on windows with the files in ./bin (which it currently is)...
and basically ignore the files in ./bin on Linux.

Is it typical to just hack setup.rb to add the desired
behavior?  Just wondering how it's usually done.



Re: setup.rb question

Postby Timothy Hunter » Sat, 25 Jun 2005 08:13:08 GMT

setup.rb support a set of 8 "hooks" that you might be able to leverage. 
You can create a hook to run before or after each of setup's config, 
setup, install, and clean steps. Each hook is just a fragment of Ruby 
code that setup runs if it's present. Setup defines a few APIs that the 
hook code can use to find out about the configuration. 
( http://www.**--****.com/ )

Just thinking out loud, maybe you could put the .dll somewhere other 
than bin (to keep setup from automatically installing it) and then 
create a post-install hook that copied the .dll only for Windows installs.

There's probably a better way but still I don't think you should have to 
hack setup.rb itself.

Re: setup.rb question

Postby Aredridel » Sat, 25 Jun 2005 09:04:02 GMT

> Is it typical to just hack setup.rb to add the desired

Yup. Hack as needed.


Re: setup.rb question

Postby Bill Kelly » Sat, 25 Jun 2005 09:27:05 GMT

From: "Timothy Hunter" < XXXX@XXXXX.COM >

Cool, thanks!

It was as simple as creating a post-install.rb containing:

when /mswin32/
  install "./my/win32/library.dll", config('bindir'), 0555




Similar Threads:

1.[ANN] Ruby Setup 5 (setup.rb)

2.Package, a future replacement for setup.rb and mkmf.rb

3.setup.rb problems and possible fix

As I reported earlier there seems to be some issues with setup.rb.
After investingating deeper it appears that there may be some very odd
bugs lurking within. There's is a lot of good code in their, but I'm
starting to think it may need a fresh rewrite. Of course, it doesn't
help that Minero whas not responded to my emails, and appearnetly does
not frequent this list.

The issue I'm currently facing is that setup.rb does not seem to be
handling --prefix correctly. While most things get the prefix, the lib/
directory does not. Looking at the code one sees these relavent pieces.

  def install_dir_lib(rel)
    install_files libfiles(), "#{config('rbdir')}/#{rel}", 0644

  def install_files(list, dest, mode)
    mkdir_p dest, @config.install_prefix
    list.each do |fname|
      install fname, dest, mode, @config.install_prefix

  def mkdir_p(dirname, prefix = nil)
    dirname = prefix + File.expand_path(dirname) if prefix
    $stderr.puts "mkdir -p #{dirname}" if verbose?
    return if no_harm?

    # Does not check '/', it's too abnormal.
    dirs = File.expand_path(dirname).split(%r<(?=/)>)
    if /\A[a-z]:\z/i =~ dirs[0]
      disk = dirs.shift
      dirs[0] = disk + dirs[0]
    dirs.each_index do |idx|
      path = dirs[0..idx].join('')
      Dir.mkdir path unless File.dir?(path)

Looking at this code one would expect that @config.install_prefix would
hold the value of the --prefix command line option. But oddly it does
not --I'm almost inclined to think that this is unintended in itself.
But assuming that's not how it's supposed to be, then obviously
config('rbdir') must contain the prefix. But it doesn't. The other
similiar config dirs do, config('bindir'), config('datadir'), etc. But
not 'rbdir', which leads me to think that it should actually be


P.S. Although I've now subscribed to the RubyGems mailing list and
posted my simple solution to the datadir problem, no one has responded

4.setup.rb metaconfig

Anyone have a real iusecase of setup.rb's "metaconfig" ability? I'm
curious as to how useful this capability really is.


5.RubyNodes gems and setup.rb failing....

6. State of the art in setup.rb land?

7. setup.rb and shared data

8. need to run setup.rb after 'gem install facets'

Return to ruby


Who is online

Users browsing this forum: No registered users and 73 guest