[lug] Building RPMs - alternate install directories

Kevin Fenzi kevin at scrye.com
Wed Jul 15 09:55:45 MDT 2009

On Tue, 14 Jul 2009 10:27:44 -0600
Kenneth D Weinert <kenw at quarter-flash.com> wrote:

> Hash: SHA1
> OK, so it's coming along fairly well.
> I am running into a specific problem - I've been told I need to
> install into a separate directory, /tools.
> Under /tools it will have the normal directory structure (bin, lib,
> etc) but I'm having a difficult time sorting out exactly how to do
> that in the spec file.

You should be able to use '%prefix /tools' and the usual %{_bindir} and
such will then expand to '/tools/bin/' and the like. 

> I'm building locally, and the install in my Makefile is going to the
> right place, but stuff like the documentation is a problem.
> If I use %doc  then it wants to put the documents
> in /usr/share/doc/... but putting the full path doesn't get stuff
> installed and I end up with errors.

yeah, %doc is a macro that basically takes the file and puts it
in /usr/share/doc/packagename-packageverion/ 
You likely don't want to use that... unless you change the prefix as
above, then it would put them in '/tools/share/doc/...'

> Part of the spec file:
> %files devel
> %defattr(-,root,root)
> /tools/include/config/config.h
> /tools/include/config/log.h
> /tools/share/doc/%{name}-%{version}/examples
> %files
> %defattr(-,root,root,-)
> /tools/lib/libconfig.so.*
> %doc /tools/share/doc/%{name}-%{version}/AUTHORS
> %doc /tools/share/doc/%{name}-%{version}/ChangeLog
> %doc /tools/share/doc/%{name}-%{version}/COPYING
> %doc /tools/share/doc/%{name}-%{version}/NEWS
> %doc /tools/share/doc/%{name}-%{version}/README
> I don't recall that it made a difference whether or not I use the %doc
> macro.  If I use it this way:
> then the files get installed, but into /usr/share/doc/...

Yeah, change prefix. ;) 

> - From rpmbuild -ba config.spec:
> Processing files: config-1.0.0-7
> error: File not found:
> /var/tmp/config-1.0.0-7-root-kenw/tools/share/doc/config-
> 1.0.0/AUTHORS
> error: File not found:
> /var/tmp/config-1.0.0-7-root-kenw/tools/share/doc/config-
> 1.0.0/ChangeLog
> /var/tmp/config-1.0.0-7-root-kenw/tools/share/doc/config-
> 1.0.0/COPYING
> error: File not found:
> /var/tmp/config-1.0.0-7-root-kenw/tools/share/doc/config-
> 1.0.0/NEWS
> error: File not found:
> /var/tmp/config-1.0.0-7-root-kenw/tools/share/doc/config-
> 1.0.0/README
> Processing files: config-devel-1.0.0-7
> error: File not found:
> /var/tmp/config-1.0.0-7-root-kenw/tools/share/doc/config-
> 1.0.0/examples
> Processing files: config-debuginfo-1.0.0-7
> Checking for unpackaged file(s): /usr/lib/rpm/check-files
> /var/tmp/config-1.0.0-
> 7-root-kenw
> error: Installed (but unpackaged) file(s) found:
>    /tools/lib/libconfig.so
> Note that it's finding the soft linked library (the linking is done in
> the Makefile as the ldconfig doesn't appear to do that, even when I
> was putting it in /usr/local/lib, mainly, I think, because when
> ldconfig is run I get an error:  /usr/lib is not a shared library)
> which I'll probably need to fix at some time as well.
> I'm still very willing to look at references, I'm just not finding
> anything that addresses this situation. A result, I'm sure, of me not
> using the right keywords. I usually end up finding how to *build* in
> an alternate directory (which is working great), or how to make a
> package relocatable, but not anything about using the normal macros
> and installing into an alternate directory.
> So, pointers and other advice are *greatly* appreciated.

Yeah, places like Fedora and EPEL and Centos and RedHat prohibit the
use of 'prefix' so there isn't much in the way of docs on it. ;( 

> Thanks.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.lug.boulder.co.us/pipermail/lug/attachments/20090715/bdd15025/attachment.pgp>

More information about the LUG mailing list