Re: make options

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Kurt Granroth
Date:  
To: nathan, Main PLUG discussion list
Subject: Re: make options
On Thursday 20 April 2006 22:38, Nathan England wrote:
> I'm also looking for some documentation that mentions something about the
> DESTDIR or prefix options when make install is run. Some places say to use
> DESTDIR, others say prefix ... ?


Nothing should be saying "use DESTDIR". That's useful for building RPMs (or
other packages) but almost never useful for the end user that's compiling
from source.

The 'prefix' and 'DESTDIR' variables are both part of the autotools suit of
build tools. The former says where the files should be installed. The
latter describes a temporary installation root for use while packaging.

For instance, all source packages that support both will have their install
targets set to something like ${DESTDIR}/${prefix}/bin/file. By default,
DESTDIR is empty and (on most source packages), prefix defaults
to /usr/local/. So this would expand to '/usr/local/bin/file', which is
where you want it so it's all good.

But say you want to make an RPM. If you do a 'make install' during the
packaging process, then it will install it into /usr/local... but what if you
already have a version of that software there? Or maybe you don't have
permissions to install there? Or you want to maintain a clean system?
Whatever your reason, you typically do *not* want to install the files into
your primary system while you are creating the package.

So, instead, you set the DESTDIR to something like '/tmp/build-root'. Then,
the file location expands to '/tmp/build-root/usr/local/bin/file'. When you
do 'make install' this time, everything is installed into temp. You can then
change your root (chroot) to /tmp/build-root and assemble your package at
your leisure.

The next obvious question is this: why not just set 'prefix' to the full
'/tmp/build-root/usr/local/bin' when building a binary package? Well, it's
due to the fact that quite a few apps actually encode their location one way
or another into the executable itself. The most common "automatic" way of
this happening is encoding the path of associated libraries (using 'rpath')
into the executable so you don't have to set ld.so.conf for every single
application install. If you build the package with the library in
'/tmp/build-root/usr/local/lib/libmylib.so' but it's installed in the end
into /usr/local/lib, then the encoded path will be bogus.

In short: Always use 'prefix'. Only use 'DESTDIR' if you are building RPMs or
DEBs or something similar.

Here's a quick (not detailed enough) description:
http://sources.redhat.com/autobook/autobook/autobook_107.html

Kurt
---------------------------------------------------
PLUG-discuss mailing list -
To subscribe, unsubscribe, or to change you mail settings:
http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss