Compiling/installing ruby in a nonstandard directory

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 :slight_smile:

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

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 :slight_smile:

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

路路路

On Thu, Oct 07, 2004 at 02:00:36PM +0900, Mark Hubbart wrote:

> 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 :slight_smile:
>
> 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.

I realize now why this is... It was a problem I had been a bit confused about.

>
> 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.

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 :slight_smile:
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. :confused:

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

Thanks,
Mark

路路路

On Thu, 7 Oct 2004 17:32:37 +0900, Michal 'hramrach' Suchanek <hramrach@centrum.cz> wrote:

On Thu, Oct 07, 2004 at 02:00:36PM +0900, Mark Hubbart wrote:

perhaps

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

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

-a

路路路

On Fri, 8 Oct 2004, Mark Hubbart wrote:

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. :confused:

--

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

===============================================================================

> 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. :confused:

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

路路路

On Fri, 8 Oct 2004 03:04:45 +0900, ara.t.howard@noaa.gov <ara.t.howard@noaa.gov> wrote:

On Fri, 8 Oct 2004, Mark Hubbart wrote:

-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

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 Hubbart wrote:

路路路

On Fri, 8 Oct 2004 03:04:45 +0900, ara.t.howard@noaa.gov ><ara.t.howard@noaa.gov> wrote:

On Fri, 8 Oct 2004, Mark Hubbart wrote:

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. :confused:
     

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

===============================================================================