[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: autoconf for ruby

Brian Candler

9/29/2004 3:31:00 PM

> i need also something to test a generic lib.
> i.e.:
>
> AC_PATH_PROG([FTOOL], ftools.rb, [], [$RUBYLIB:/usr/lib/ruby/1.8])
> if test -z $FTOOL; then
> AC_MSG_ERROR(no ftools.rb library)
> fi

From this, I guess you want to modify your xxx.rb file so it contains the
correct path to ftools? Normally that's not necessary, you'd just say

require 'ftools'

or:

$:.unshift '.'
require 'ftools'

(Ruby does a run-time search for ftools.rb; it the second case it will first
look in the current directory, and then in the usual places)

I'd say it's the Ruby Way[TM] to let the user install the package anyway,
and let it give a runtime error if ftools is not actually available at the
time it is required. The user can then install ftools, in its usual place,
to fix the problem.

If you want your program to behave differently depending on whether or not
ftools is available, then again this can be done at run-time:

begin
require 'ftools'
rescue LoadError
warn "Certain functionality not available without ftools"
end

However, if this is the main concern for you, then the way Gems handles
libraries is probably of interest. You can even have multiple versions of
the same library installed; Gems puts each version in a different directory,
and finds and loads the requested one for your application. And instead of
just giving an error at install time, it can go and fetch and install the
required library automatically.

> i prefer the idea to use gnu tools to setup.rb or mkmf library because
> they are allready a standard de facto for gnu/linux systems,
> the maintanance would be simpler and it can expand ruby
> language usage.

But you are talking about installing *Ruby* packages are you not? In which
case, you know that Ruby is already installed on the system. This means you
can rely on mkmf being there, and also include setup.rb in your package.
This is really no different to including "configure" in your package; one is
a Ruby script, the other is a shell script.

GNU autoconf is, at the end of the day, a hacked-together bunch of shell
scripts and m4 macros. It's done that way because a Bourne-like shell is
probably the lowest common denominator you can expect on a system. But once
you know there's a decent scripting language like Ruby on your system, it
makes a lot of sense to install further Ruby components using Ruby. It's
much cleaner and easier to maintain.

You'll find the same with Perl modules in CPAN: the typical installation is
perl Makefile.PL
make
make install

> much more automake supports, in opposition to setup.rb,
> the unistall option too.

Good point. If that's important then I'd go with Gems again.

Regards,

Brian.


4 Answers

Ara.T.Howard

9/29/2004 3:53:00 PM

0

saiph

9/30/2004 8:05:00 AM

0



>> Too bad that they suck so hard
i'm a beginner, and i agree with Ara when he says:

> must continually evolve to support every /bin/sh shell

or better freeze because the compatibility is, as i see,
grant to obsolete systems.

a solution might be to use a bash modern synopsys to write autoconf macro
considering compatibility in a pragmatic way?!

however what are the other relavant reasons that do them suck?

>> autotools does not work on windows.
projects i've in mind are strictly for linux.
for windows, of course, won't be a reasonable thought.

>> ~/tmp > for op in config setup install;do ruby setup.rb $op || sudo ruby
setup.rb $op;done

this is the best solution for a developer but from the user point of view
reading the setup.rb manual to know options and behaviour is a pure waste of
time.

it can be unhappy to know after 5min that another ruby project he want to
test uses gem.

so, imo, the relax of configure && make && sudo make install
can help the spread of a software in unix env. is it true?

the promblem is that many sys-adm are even to lazy to install an interpreter,
in general when even valid people see something of new is a bit discouraged
because it can be a source of problem or bugs.




--
>here are more things in heaven and earth,
horatio, than are dreamt of in your philosophy.


Brian Candler

10/4/2004 5:19:00 PM

0

On Thu, Sep 30, 2004 at 01:05:21AM +0900, Ara.T.Howard@noaa.gov wrote:
> ~/tmp > cat InstalledFiles
> /usr/local/lib/ruby/site_ruby/1.8/a.rb
>
> ~/tmp > sudo rm -rf `cat InstalledFiles`
>
> doesn't get much easier than that.

That's smart. Would be nice to make "ruby setup.rb uninstall" do that
though.

Regards,

Brian.


Ara.T.Howard

10/4/2004 7:53:00 PM

0