[PLUG] RPM v build from source- removing?

Paul Heinlein heinlein at attbi.com
Fri May 24 13:33:46 UTC 2002


On Thu, 23 May 2002, Craighead, Scot D wrote:

> How do you force it to install into the directory you want?

I'm not sure what question you're asking:

1. How do I compile a package so that its final resting place will be 
   somewhere other than /usr/local?

2. How do compile a package so that it'll install into /tmp/package
   even though it'll eventually end up in /usr/local?

As many people have suggested, the answer to #1 is typically to set 
the --prefix variable when running the configure script, e.g.,

  ./configure --prefix=/opt/package --sysconfdir=/opt/etc ...
  make 
  make install

The answer to #2 varies a bit, and usually the only way to know for 
sure is to look in the Makefile that configure builds. Let's say that 
you're building a package that will reside in

  /etc/
  /usr/
    - bin/
    - lib/
    - sbin/
    - share/

but you want to have it install itself into

  /tmp/package-build/
     - etc/
     - usr/
       - bin/
       - lib/
       - sbin/
       - share/

Using a fake buildroot is a trick that most package managers use, and 
a good way to get an idea of what any given <package> is going to 
install into your filesystem. Let's assume that you set the prefix and 
sysconfdir correctly at build time:

  ./configure --prefix=/usr --sysconfdir=/etc
  make

Then what? Well, it depends. Here are the two most common tricks:

  make install \
    prefix=/tmp/package-build/usr \
    sysconfdir=/tmp/package-build/etc

or

  make DESTDIR=/tmp/package-build install

I usually grep a package's Makefiles looking for DESTDIR first of all.
If I get lots of return values, that's the easiest path to take. Other
package maintainers, however, use other environment variables for
accomplishing the same thing, so it's usually a good thing to read the
README and INSTALL files :-)

--Paul Heinlein <heinlein at attbi.com>






More information about the PLUG mailing list