[lug] Building RPMs - alternate install directories

HB hbmath at gmail.com
Tue Jul 14 19:18:36 MDT 2009


Kenneth D Weinert wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> 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.
> 
> 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.
> 
> 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:
> 
> %doc AUTHORS ChangeLog COPYING NEWS README
> 
> then the files get installed, but into /usr/share/doc/...
> 
> - 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.
> 
> Thanks.
> 
> - --
> Ken


When I've built packages for use on our systems (that aren't provided by 
the distribution), I've put things in /usr/local via these %define at 
the top of the spec file:

%define _prefix /usr/local
%define _datadir  %{_prefix}/share
%define _mandir %{_datadir}/man
%define _infodir %{_datadir}/info
%define _docdir %{_datadir}/doc

and build and fix when it errors out (usually I'm revamping other packages).

You can also put those define statements in your .rpmmacros file.

Hugh



More information about the LUG mailing list