From: ar0 on
I'm sorry for the weird subject. Here's my problem:
I'm stuck on a system without root-priviledges. Thus if
I want some program the admin doesn't want to install
systemwide, I'll have to locally install it $HOME.

Now, if I can simply build the program from source everything is
fine. I configure with --prefix="$HOME" and add
PATH=~/bin:"$PATH"
to my ~/.bashrc. This way I get "my" versions of programs,
even if another version may already be in the "rest" of
PATH.

But what if some program needs a libary which is either
outdated or non-existant on the system?
If I build that library from source and install it in $HOME,
I still have to communicate its whereabouts
to the programs that depend on that particular lib.

Up to now every program I built uses the "classic"
../configure && make
combo, ie all use makefiles. So can I perhaps use
a makefile with certain variable definitions
which is then included automatically by all other makefiles?

If I could talk to the apropriate tools (gcc, ld), I would
tell them:
"Before you look for anything in the 'default' places, please
first take a look in $HOME"

Like, first look for headers in $HOME/include, then the default
locations. If the library you need is already in $HOME/lib, use it.
Etc.

Is this possible in any convenient way?

Greetings

--
Sick nature.
From: William Ahern on
ar0 <noone(a)nospam.invalid> wrote:
> I'm sorry for the weird subject. Here's my problem:
> I'm stuck on a system without root-priviledges. Thus if
> I want some program the admin doesn't want to install
> systemwide, I'll have to locally install it $HOME.
<snip>
> Like, first look for headers in $HOME/include, then the default
> locations. If the library you need is already in $HOME/lib, use it.
> Etc.

> Is this possible in any convenient way?

I do this on OS X. I install everything under /usr/local/[project]. You
could try to get fancy and use LD_LIBRARY_PATH and any number of other
tricks. But it creates more headaches then its worth, in my experience.

Basically, I've added some simple shell functions to generate option flags,
the two most important being `cppflags' and `ldflags'. They scan
/usr/local/[project] for lib/ and include/ directories. Then for any new
autoconf build I just do

../configure --prefix=[PATH] CPPFLAGS="$(cppflags)" LDFLAGS="$(ldflags)"

It works just as well for non-autoconf builds--not all the world uses
autoconf. Most builds already know to set the builtin linker paths, but if
they don't then you also might need to add that to the LDFLAGS (e.g.
"-Wl,-rpath /path/to/lib/"). You can make an `rpaths' shell function to
generate those.

I also set my MANPATH and PATH accordingly, so I can use and read the
documentation to, say, newer OpenSSL versions, etc. (But I cache these
otherwise opening a new shell can sometimes stall as it scans the 85+
directories /usr/local).

I used to alias `make' and friends (e.g. alias make='make
CPPFLAGS="$(cppflags)" LDFLAGS="$(ldflags)"') but it ultimately created more
headaches then it was worse.

This works much better for me than Fink or Darwin Ports, but then most of
the projects are plain C. Trying to control Java and Perl builds are more
complicated, in part because there's no simple way for those applications to
compile in library paths, and instead rely on environment variables for
non-system default library paths.

These are two of my functions, using zsh's extended globbing features:

cppflags() {
for D in /usr/local/*/include(-F); do
print -n -- "-I${D} "
done | sed -e 's/ $//'
}

ldflags() {
for D in /usr/local/*/lib(-F); do
print -n -- "-L${D} "
done | sed -e 's/ $//'
}

From: ar0 on
William Ahern <william(a)wilbur.25thandclement.com> wrote:
> [...]
> Basically, I've added some simple shell functions to generate option flags,
> the two most important being `cppflags' and `ldflags'. They scan
> /usr/local/[project] for lib/ and include/ directories. Then for any new
> autoconf build I just do
>
> ./configure --prefix=[PATH] CPPFLAGS="$(cppflags)" LDFLAGS="$(ldflags)"
Hm, rather straightforward actually. That'll do just fine.


Thanks for the input guys.

--
Sick nature.