[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

Rubygems, native ruby extensions (and their dependencies

Johan Nilsson

1/19/2005 8:40:00 AM

The title might not be all too clear but here goes:

I'm looking into alternatives for installing my ruby extension library
(which is used by some utility applications). I've looked at install.rb,
setup.rb, rubyscript2exe/tar2rubyscript and finally RubyGems. Even if I'll
right now only will be doing local installations I find RubyGems my current
favorite - just some questions:

- How should I handle native ruby extensions (building them at install time
is not an option here). Part of the library is implemented natively (Win32
for now).

- How should I handle the native ruby extensions' dependencies (e.g.
myrubyext.dll depends on boost-regex-...dll)? Where would such files go[1]?

- [a bit off-topic] Should/could I install applications through RubyGems as
well? Any special considerations with regards to application-specific
configuration files, invoking the application etc. Ideally I'd just like the
user to be able to run <myappname-without-rb-extension> from the command
line after installation.

Thanks // Johan

[1] For now I've made a hack where such dlls are put in the same directory
as the extension dll - I then load the extension through myrubyextrb.rb,
which on it's first line manipulates ENV['PATH'] to include the current
directory.

5 Answers

Jim Weirich

1/19/2005 12:15:00 PM

0

On Wednesday 19 January 2005 03:41 am, Johan Nilsson wrote:
> - How should I handle native ruby extensions (building them at install time
> is not an option here). Part of the library is implemented natively (Win32
> for now).

I released my first binary gem yesterday. What I did: I compiled the gem
software locally on my own machine. Then used the same gemspec I used for
the source distribution with the following changes:

(1) removed the extension
(2) added the arch directory in the lib list
(3) included the .so file in the list of included files.

It seems to be working. It is the x10-cm17a gem for the windows platform if
anyone is interested in trying it.

The rake task for building gems is broken with regard to binary gems. I'll
fix that for the next rake release.

> - How should I handle the native ruby extensions' dependencies (e.g.
> myrubyext.dll depends on boost-regex-...dll)? Where would such files go[1]?

There is a requirements field in the gemspec that where you can list the
dependencies. This is for comment purposes only, we don't do autodetection
of non-gem dependencies.

> - [a bit off-topic] Should/could I install applications through RubyGems as
> well? Any special considerations with regards to application-specific
> configuration files, invoking the application etc. Ideally I'd just like
> the user to be able to run <myappname-without-rb-extension> from the
> command line after installation.

I've released applications as gems. Rake is a prime example.

--
-- Jim Weirich jim@weirichhouse.org http://onest...
-----------------------------------------------------------------
"Beware of bugs in the above code; I have only proved it correct,
not tried it." -- Donald Knuth (in a memo to Peter van Emde Boas)


Johan Nilsson

1/21/2005 8:03:00 AM

0


"Jim Weirich" <jim@weirichhouse.org> wrote in message
news:200501190718.30178.jim@weirichhouse.org...
> On Wednesday 19 January 2005 03:41 am, Johan Nilsson wrote:
>> - How should I handle native ruby extensions (building them at install
>> time
>> is not an option here). Part of the library is implemented natively
>> (Win32
>> for now).
>
> I released my first binary gem yesterday. What I did: I compiled the gem
> software locally on my own machine. Then used the same gemspec I used for
> the source distribution with the following changes:
>
> (1) removed the extension

From what? It might be obvious, but please treat me like a total beginner.

> (2) added the arch directory in the lib list

Ok, sorry for being ignorant again, but what's the 'arch' directory?

> (3) included the .so file in the list of included files.
>
> It seems to be working. It is the x10-cm17a gem for the windows platform
> if
> anyone is interested in trying it.
>
> The rake task for building gems is broken with regard to binary gems.
> I'll
> fix that for the next rake release.

Hmmm, I haven't looked at using rake at all; I was merely trying to put
together a gemspec.

>
>> - How should I handle the native ruby extensions' dependencies (e.g.
>> myrubyext.dll depends on boost-regex-...dll)? Where would such files
>> go[1]?
>
> There is a requirements field in the gemspec that where you can list the
> dependencies. This is for comment purposes only, we don't do
> autodetection
> of non-gem dependencies.

Could you expand on that a bit - do you mean that:

- The user would him/herself manually have to install such dependencies
- It's not possible to submit them as part of the gem?

>
>> - [a bit off-topic] Should/could I install applications through RubyGems
>> as
>> well? Any special considerations with regards to application-specific
>> configuration files, invoking the application etc. Ideally I'd just like
>> the user to be able to run <myappname-without-rb-extension> from the
>> command line after installation.
>
> I've released applications as gems. Rake is a prime example.

I'll take a look.


Many thanks // Johan

Jim Weirich

1/21/2005 12:50:00 PM

0

On Friday 21 January 2005 03:00 am, Johan Nilsson wrote:
> "Jim Weirich" <jim@weirichhouse.org> wrote in message
> news:200501190718.30178.jim@weirichhouse.org...
>
> > On Wednesday 19 January 2005 03:41 am, Johan Nilsson wrote:
> >> - How should I handle native ruby extensions (building them at install
> >> time
> >> is not an option here). Part of the library is implemented natively
> >> (Win32
> >> for now).
> >
> > I released my first binary gem yesterday. What I did: I compiled the gem
> > software locally on my own machine. Then used the same gemspec I used
> > for the source distribution with the following changes:
> >
> > (1) removed the extension
>
> From what? It might be obvious, but please treat me like a total beginner.

Just to be clear, I had a gemspec for the project (x10-cm17a) that created a
non-binary gem. I started with that gemspec and made the following changes..

(1) The gemspec has an extension field that is filled out if you have
extensions to build. Because the extension is already built when you
distribute an binary gem, you shouldn't set the extension field.

(2) The "arch" directory is a directory that contains the .so files for a
particular architecture. The directory is usually named something like
i386-mswin32 or i686-linux. You can get the name of the arch directory from
the ruby config, e.g.

require 'rbconfig'
ARCH = Config::CONFIG['arch']

The 'lib' field of the gemspec is a list if directories to be added to the
load path when the gem is loaded. You need to add the arch directory to that
list. The resulting line will look like this:

s.require_paths << 'lib' << "lib/#{ARCH}"

(3) The list of files to be included with the gem need to be updated to
include the .so file. I added the following line to append the .so file to
the list of files:

s.files += ["lib/#{ARCH}/cm17a_api.so"]

(4) Forget to mention this earlier, but I changed the gemspec platform from
the default of 'RUBY' to ARCH (see the definition of ARCH in step 2 above.

s.platform = ARCH

I've included the modified Rakefile that I used to build the gemspec as an
attachment. That will give the complete details.

> > There is a requirements field in the gemspec that where you can list the
> > dependencies. This is for comment purposes only, we don't do
> > autodetection
> > of non-gem dependencies.
>
> Could you expand on that a bit - do you mean that:
>
> - The user would him/herself manually have to install such dependencies
> - It's not possible to submit them as part of the gem?

Essentially, yes.

--
-- Jim Weirich jim@weirichhouse.org http://onest...
-----------------------------------------------------------------
"Beware of bugs in the above code; I have only proved it correct,
not tried it." -- Donald Knuth (in a memo to Peter van Emde Boas)

Stormin Mormon

7/1/2008 1:46:00 PM

0

You may wish to do some research on what Mormons really believe. Jesus,
being both God and Man, provided the necessary means for us to return to
live with Heavenly Father.

Hmm. I've only got a couple years of college. And sometimes words escape me.
Supposing John W uses mistaken, incorrect information to call Stormin a
liar. There's got to be a catchy word for that.

--
Christopher A. Young
Learn more about Jesus
www.lds.org
.


"john w @yahoo.com>" <j<no> wrote in message
news:dbgj6491dq1klt9hs1gg74rsqad0s4inpl@4ax.com...
x-no-archive: yes
On Mon, 30 Jun 2008 20:29:21 -0400, "Stormin Mormon"
<cayoung61**spamblock##@hotmail.com> wrote:
? 2008 John D Weatherly all rights reserved; no portion of this post
may be used anywhere else without written permission of the author.
>The Church of Jesus Christ (of Latter-day Saint) is as Christian as they
>come.

^ ^ ^ That is a lie from the pits of Hell.

Your Jesus Christ is not God in flesh.

That's a BIG difference.

You have a need for "other scripture."

That directly violates Galatians 1.





john w

7/1/2008 2:37:00 PM

0

x-no-archive: yes
On Tue, 1 Jul 2008 09:46:23 -0400, "Stormin Mormon"
<cayoung61**spamblock##@hotmail.com> wrote:
? 2008 John D Weatherly all rights reserved; no portion of this post
may be used anywhere else without written permission of the author.
>You may wish to do some research on what Mormons really believe. Jesus,
>being both God and Man, provided the necessary

means for us to return to
>live with Heavenly Father.

"Return?"

You haven't been to Heaven yet! So you can't return!

And your God is not the God of the Bible.

Your God was once a man.

You in turn, can evolve into being a deity.

The God of the Bible has always been God. He's never been anything
BUT God.

So while you score on a few points, "you believe Jesus is God in
flesh."

Which god is he?

He is not the God of the Bible, who has always been God.

Way back before ANYTHING existed (Genesis 1:1)

there was God.

At no time has God been a human who was not God.


>
>Hmm. I've only got a couple years of college. And sometimes words escape me.
>Supposing John W uses mistaken, incorrect information to call Stormin a
>liar. There's got to be a catchy word for that.

The person using incorrect information is "Stormin Mormon."

And if you are not LYING (if you actually BELIEVE the crap you're
pushing), then you are simply sadly DECEIVED. "A Dupe."