[Fedora-packaging] Re: The better way to use %install section

David A. Wheeler dwheeler at dwheeler.com
Thu Jun 11 00:08:28 UTC 2009


Murilo Opsfelder Ara?jo mopsfelder at gmail dot com asked:
> I'm packing a third party software and this third party software is a
> tarball with a install.sh and other binaries.
...
> $ ls
...
> install.sh
> 
> To install this software I just need to run (as root) install.sh and
> myprogram runs fine.
> 
> After finishing installation I have all the files installed as the
> following example:
> /usr/bin/bin1
> /usr/bin/bin2
> Or do I need to copy all install.sh commands inside %install section?

Tom Callaway graciously replied:
 > Well, this is a bit off topic for this list, but I'm in a
 > good mood, so I'll try to answer your questions.
...
 > The problem with the install.sh is that it almost certainly has the
 > install directories for those binaries hardcoded to /usr/bin. When
 > you're installing files during %install in an rpm, you want to install
 > those files into %{buildroot}%{_bindir}.

I agree.  Ideally, program authors would support the "DESTDIR" 
environment variable, so that you could easily install programs to an 
intermediate (DESTDIR) directory for later execution in the  "real" 
directory (e.g., /usr/bin/).  In my experience, almost nobody supports 
DESTDIR :-(.   This lack of DESTDIR support causes trouble for rpm-based 
packagers (Fedora, RHEL, etc.) _and_ deb-based packagers (Debian, 
Ubuntu, etc.).  For now, you have to re-implement the installation by hand.

Ideally, DESTDIR support would be automated instead of requiring the 
modification of every makefile in the universe. That's not as easy as it 
seems; I've documented some options for doing that:
  http://www.dwheeler.com/essays/automating-destdir.html
I intend to release some code relatively soon that should automate 
DESTDIR for most installations, as noted there.  But for now, you'll 
need to do what Tom Callaway explained above.

--- David A. Wheeler




More information about the Fedora-packaging mailing list