[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Installation dirs in code

From: Brian Dessent
Subject: Re: Installation dirs in code
Date: Tue, 12 Dec 2006 15:56:34 -0800

Brendon Costa wrote:

> I have a program that requires a configuration file that will usually go
> into the ${prefix}/etc as given by $sysconfdir. So this program needs to
> know where it is going to find this installed configuration file. I was
> initially going to export the evaluated value of $sysconfigdir into a
> define in config.h as an absolute path, however I found there are two
> problems with this.
> 1) On windows using MinGW/MSYS the path is not a native windows one but
> rather a MSYS path. So then i started to write a autoconf macro that
> converted a MSYS path to a native windows one.

Instead of using an absolute path, you can use a relative path, which
makes the binary relocatable.  For Win32, this means you can avoid
completely the hassle of converting between native and posix-emulated
(aka MSYS/Cygwin) paths.  It also means the user can install your
package into any location and have it work correctly, which is common
accepted practice with most Windows software.  You need to base these
relative paths on something fixed though, commonly the location of the
binary itself.  See also:

> When doing a cross compile
> usually the installation prefix is not the name of the actual install
> path that will be used on the end system, but just some temporary
> directory that the binaries are compiled into before being copied across
> to the host system later.

That sounds seriously broken.  --prefix should always reflect the
desired final location of the package, even if it does not exist on the
build system.  If you need to use a temporary staging directory for the
purposes of creating a distribution package, then the correct method is
to override DESTDIR during the install phase, not to lie to configure
about prefix, e.g.

path/to/configure --prefix=/actual/final/destination
make check
make install DESTDIR=/tmp/install
(cd /tmp/install && tar cjf binaries.tar.bz2 *)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]