[Rpm-maint] rpm %makeinstall macro brokenness

Lennert Buytenhek buytenh at wantstofly.org
Mon Dec 24 13:04:30 UTC 2007

Hi all,

I noticed this (rpm

  make \
        prefix=%{?buildroot:%{buildroot}}%{_prefix} \
        exec_prefix=%{?buildroot:%{buildroot}}%{_exec_prefix} \
        bindir=%{?buildroot:%{buildroot}}%{_bindir} \
        sbindir=%{?buildroot:%{buildroot}}%{_sbindir} \
        sysconfdir=%{?buildroot:%{buildroot}}%{_sysconfdir} \
        datadir=%{?buildroot:%{buildroot}}%{_datadir} \
        libdir=%{?buildroot:%{buildroot}}%{_libdir} \
        libexecdir=%{?buildroot:%{buildroot}}%{_libexecdir} \
        localstatedir=%{?buildroot:%{buildroot}}%{_localstatedir} \
        sharedstatedir=%{?buildroot:%{buildroot}}%{_sharedstatedir} \
        mandir=%{?buildroot:%{buildroot}}%{_mandir} \
        infodir=%{?buildroot:%{buildroot}}%{_infodir} \

Apart from the funny way of writing %{?buildroot}, trying to coax
'make install' into installing files into %{buildroot} by redefining
prefix= is very much the wrong thing to do.

"Prefix" is the path that the application/library will end up in in
the eventual filesystem after installation (i.e. not during the
packaging phase), and applications are free to e.g. compile the prefix
path into their binaries so that they can e.g. look for plugins,
modules, header files or whatever in this directory at run time.

Although it will _probably_ do the right thing most of the time,
there is no guarantee that the 'make install' step doesn't rebuild
some of the objects that were built in the 'make' step.  And so,
doing the 'make' step with prefix=/usr but the 'make install' step
with prefix=/var/tmp/foo-1.2.3/usr can still cause the application
to try and refer to "/var/tmp/foo-1.2.3" at run time, which is Not

For example, this causes the F8 libgnomeprint22 build to fail, as it
uses %makeinstall, and so, some of the files actually contain the
"/var/tmp/libgnomeprint22-*" string after building

The _right_ way is just to set prefix=/usr (or whatever it was), and
set DESTDIR=%{buildroot} (for most autoconf-using applications) or
install_root=%{buildroot} (which things like glibc seem to insist on.)
This will install the files in the right place without abusing prefix=,
i.e. do the right thing.


More information about the Rpm-maint mailing list