compiling/installing ruby in a nonstandard directory

M

Mark Hubbart

Hi all,

I've been intermittently working on a build/packaging script that will
make Mac Installer packages of the ruby distribution. I need to
include, at minimum, readline support, and distribute the readline
binaries along with it. I'm not a C programmer; I've compiled a lot of
software, but I still don't claim to know what I'm doing :)

To make this project easier, and so I don't have to back up my
/usr/local dir while I'm building, I've been trying to build it and
install ruby (and readline) in non-standard directories; then I can
package up the directories for installation (I think). But it isn't
that easy... It seems impossible to get ruby extensions to compile
using the libraries that are installed in the non-standard locations.

Since I'm not convinced I'm going about this the right way, I'll just
ask: What is the best way to compile several dependent software
projects, without having to install them in their final destination?

thanks,
Mark
 
M

Michal 'hramrach' Suchanek

Hi all,

I've been intermittently working on a build/packaging script that will
make Mac Installer packages of the ruby distribution. I need to
include, at minimum, readline support, and distribute the readline
binaries along with it. I'm not a C programmer; I've compiled a lot of
software, but I still don't claim to know what I'm doing :)

To make this project easier, and so I don't have to back up my
/usr/local dir while I'm building, I've been trying to build it and
install ruby (and readline) in non-standard directories; then I can
package up the directories for installation (I think). But it isn't
that easy... It seems impossible to get ruby extensions to compile
using the libraries that are installed in the non-standard locations.
Ruby currently (as of 1.8.2preview2) does not support this, see my
patch to add LDFLAGS support.
This should enable installing ruby and the libraries it depends in into
an arbitrary directory. But you could not move it elswhere because it
would break.
Since I'm not convinced I'm going about this the right way, I'll just
ask: What is the best way to compile several dependent software
projects, without having to install them in their final destination?

On OS X there is linker support for bundling software in a directory
(like Ruby.app) with its libraries. I beleive it has something to do
with the @executable_path stuff because mozilla uses that too but I did
not really try to use that myself.

Looking at my Firefox installation it seems @executable_path expands to
the directory where the binary is installed.

I am not sure this is what you want. This makes your package
"relocatable" in the sense that you can put the directory in which it
resides anywhere on the disk, but you would have to install all binary
extensions and programs using libruby in there too.

I also looked at the linker man page but it does not seem very helpful
Perhaps the Apple's developer documentation would be better.

Thanks

Michal Suchanek
 
M

Mark Hubbart

Ruby currently (as of 1.8.2preview2) does not support this, see my
patch to add LDFLAGS support.
This should enable installing ruby and the libraries it depends in into
an arbitrary directory. But you could not move it elswhere because it
would break.

I realize now why this is... It was a problem I had been a bit confused about.
On OS X there is linker support for bundling software in a directory
(like Ruby.app) with its libraries. I beleive it has something to do
with the @executable_path stuff because mozilla uses that too but I did
not really try to use that myself.

Looking at my Firefox installation it seems @executable_path expands to
the directory where the binary is installed.

I am not sure this is what you want. This makes your package
"relocatable" in the sense that you can put the directory in which it
resides anywhere on the disk, but you would have to install all binary
extensions and programs using libruby in there too.

I also looked at the linker man page but it does not seem very helpful
Perhaps the Apple's developer documentation would be better.

The mac branch of the RubyOneClickInstaller is working on making the
ruby libs into a framework, moving it out of /usr or /usr/local...
That would be the canonical setup, but last I looked, they are hitting
some snags. I wish them the best on this, I'd really like to see it :)
The way it works with Python and Perl is excellent; I want to be able
to use Ruby with it.

However, my main problem is that I want to be able to compile up some
packages without fubaring my system. I guess I'll have to figure out
some better way of setting this up; since It appears that there is no
way to do this while avoiding installing the binaries in their end
location. :/

Well, thanks for the answer :) I'll see what I can do.

Thanks,
Mark
 
A

Ara.T.Howard

However, my main problem is that I want to be able to compile up some
packages without fubaring my system. I guess I'll have to figure out
some better way of setting this up; since It appears that there is no
way to do this while avoiding installing the binaries in their end
location. :/

perhaps

configure --prefix=/somewhere
make
make prefix=/somewhere/else/ install

or are you talking ruby extentions? if so something similar should work

-a
--
===============================================================================
| EMAIL :: Ara [dot] T [dot] Howard [at] noaa [dot] gov
| PHONE :: 303.497.6469
| A flower falls, even though we love it;
| and a weed grows, even though we do not love it.
| --Dogen
===============================================================================
 
M

Mark Hubbart

perhaps

configure --prefix=/somewhere
make
make prefix=/somewhere/else/ install

Well, I didn't know I could do that... I'm guessing that will make the
binaries relocatable? I want to end up installing them in /usr/local,
but I want 'make install' to put them in ~/tmp/install.
or are you talking ruby extentions? if so something similar should work

Yes. I need to be able to link the ruby readline extension against the
readline library, which I would like to make/install in the same
manner. In fact, thar's the main problem I'm having. If it wasn't for
the linking difficulties, I'd have just skipped the install step and
pulled the binaries/libs out of the source dir once they were
compiled.

Thanks,
Mark
-a
--
===============================================================================
| EMAIL :: Ara [dot] T [dot] Howard [at] noaa [dot] gov
| PHONE :: 303.497.6469
| A flower falls, even though we love it;
| and a weed grows, even though we do not love it.
| --Dogen
===============================================================================
 
P

Patrick Bennett

Mark, do a search for the thread 'can $LOAD_PATH be relative'.
I believe I posted a patch I made to Ruby that enables it to be run from
any path and treat its lib directories as paths relative to where it was
launched (just like it works in Windows).
It was a really easy patch (as I too despise the 'fixed' path).

Mark said:
perhaps

configure --prefix=/somewhere
make
make prefix=/somewhere/else/ install

Well, I didn't know I could do that... I'm guessing that will make the
binaries relocatable? I want to end up installing them in /usr/local,
but I want 'make install' to put them in ~/tmp/install.


or are you talking ruby extentions? if so something similar should work

Yes. I need to be able to link the ruby readline extension against the
readline library, which I would like to make/install in the same
manner. In fact, thar's the main problem I'm having. If it wasn't for
the linking difficulties, I'd have just skipped the install step and
pulled the binaries/libs out of the source dir once they were
compiled.

Thanks,
Mark


-a
--
===============================================================================
| EMAIL :: Ara [dot] T [dot] Howard [at] noaa [dot] gov
| PHONE :: 303.497.6469
| A flower falls, even though we love it;
| and a weed grows, even though we do not love it.
| --Dogen
===============================================================================
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,159
Messages
2,570,879
Members
47,417
Latest member
DarrenGaun

Latest Threads

Top