[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

DESTDIR-awareness [Was: Re: RFS: b43-fwcutter (updated package)]



On Wed, Mar 09, 2011 at 12:25:24PM +0100, Alessandro Ghedini wrote:
> On Tue, Mar 08, 2011 at 10:34:00PM +0100, Fabrizio Regalli wrote:
> > Dear mentors,
> > 
> > I am looking for a sponsor for the new version 1:013-4
> > of my package "b43-fwcutter".
> > 
> > It builds these binary packages:
> > b43-fwcutter - Utility for extracting Broadcom 43xx firmware
> > firmware-b43-installer - Installer package for firmware for the b43
> > driver
> > firmware-b43-lpphy-installer - Installer package for firmware for the
> > b43 driver (LP-PHY version
> > firmware-b43legacy-installer - Installer package for firmware for the
> > b43legacy driver
> > 
> > The package appears to be lintian clean.
> > 
> > The upload would fix these bugs: 581798, 599741
> > 
> > The package can be found on mentors.debian.net:
> > - URL: http://mentors.debian.net/debian/pool/contrib/b/b43-fwcutter
> > - Source repository: deb-src http://mentors.debian.net/debian unstable
> > main contrib non-free
> > - dget
> > http://mentors.debian.net/debian/pool/contrib/b/b43-fwcutter/b43-fwcutter_013-4.dsc
> 
> The package FTBFS:
> 
>    make[1]: Entering directory `/tmp/b43-fwcutter-013'
>    install -d -o 0 -g 0 -m 755 /usr/local/bin/
>    install -o 0 -g 0 -m 755 b43-fwcutter /usr/local/bin/
>    install: cannot create regular file "/usr/local/bin/b43-fwcutter": Permission denied
>    make[1]: *** [install] Error 1
> 
> Why is it installing under /usr/local, anyway? In the upstream Makefile you 
> should replace
> 
>    PREFIX ?= /usr/local
> 
> with
> 
>    PREFIX ?= $(DESTDIR)/usr
> 
> That fixes both the issues. See maint-guide §3.3 [0].

Just a note: adding DESTDIR to PREFIX, BINDIR, MANDIR, etc in the
upstream Makefile is not always the best solution.  Sometimes part of
the install (or even the build) process consists of updating some
configuration files, documentation, etc. with the actual locations of
some files and directories on the target system; if one appends DESTDIR
to those directories, the results might be... funny :)

A much better approach is to make the installation process
"DESTDIR-aware" - look through all the install* targets in the Makefile
and add a ${DESTDIR} at any places that do not have it.  For example, if
the upstream Makefile has something like this:

install-program:
	install (some options) fooclient ${PREFIX}/bin
	install (some options) fooserver ${PREFIX}/sbin

...that should be changed to:

install-program:
	install (some options) fooclient ${DESTDIR}${PREFIX}/bin
	install (some options) fooserver ${DESTDIR}${PREFIX}/sbin

This achieves both goals - the files end up in the DESTDIR tree and
PREFIX, BINDIR, etc keep their "real" values that correspond to the
paths where the files will be at runtime.

Of course, the change should then be forwarded upstream :)

G'luck,
Peter

-- 
Peter Pentchev	roam@ringlet.net roam@FreeBSD.org peter@packetscale.com
PGP key:	http://people.FreeBSD.org/~roam/roam.key.asc
Key fingerprint	FDBA FD79 C26F 3C51 C95E  DF9E ED18 B68D 1619 4553
I am the meaning of this sentence.

Attachment: signature.asc
Description: Digital signature


Reply to: