/ Zope / Apsis / Pound Mailing List / Archive / 2006 / 2006-02 / small patch proposal for Makefile

[ << ] [ >> ]

[ problems with Pound 2.0 / alessio ... ] [ [Pound Mailing List] server overloaded / Sietjp ... ]

small patch proposal for Makefile
alessio <a.cervellin(at)virgilio.it>
2006-02-08 11:55:10 [ SNIP ]
Sometimes it happens that it's needed for a software to allow itself to 
be temporarily installed to an offset location ahead of the $PREFIX 
location.
One of these cases is the one explianed here [1].I
So it's a 
common (anche best) practice to use a $DESTDIR (or $INSTALL_ROOT or 
$INSTALL_PREFIX) variable in the "install" target of the Maefile, to be 
used before the ${prefix} occurencies.
This does not alter in any way 
the normal "install" process, but allows a non-root user to do 
something like this:

make DESTDIR=/tmp/destdir install

To allows 
this, i think that the Pound Malkefile should be changed from:

install:        all
                [ -d ${exec_prefix}/sbin ] || mkdir 
${exec_prefix}/sbin
                ./install-sh -c -o bin -g bin -m 
555 -s pound ${exec_prefix}/sbi
                [ -d ${prefix}/man ] || 
mkdir ${prefix}/man
                [ -d ${prefix}/man/man8 ] || mkdir 
${prefix}/man/man8
                ./install-sh -c -o bin -g bin -m 644 
pound.8 ${prefix}/man/man8/

To:

install:        all
                [ 
-d ${DESTDIR}${exec_prefix}/sbin ] || mkdir ${DESTDIR}${exec_prefix}
/sbin
                ./install-sh -c -o bin -g bin -m 555 -s pound 
${DESTDIR}${exec_prefix}/sbi
                [ -d ${DESTDIR}${prefix}
/man ] || mkdir ${DESTDIR}${prefix}/man
                [ -d 
${DESTDIR}${prefix}/man/man8 ] || mkdir ${DESTDIR}${prefix}/man/man8
                ./install-sh -c -o bin -g bin -m 644 pound.8 
${DESTDIR}${prefix}/man/man8/

[1] http://www.blastwave.
org/standards/pkgcreation.php ("How to create the package file without 
root access")

Re: [Pound Mailing List] small patch proposal for Makefile
Robert Segall <roseg(at)apsis.ch>
2006-02-08 12:19:30 [ SNIP ]
On Wed, 2006-02-08 at 11:55 +0100, alessio wrote:
> Sometimes it happens that it's needed for a software to allow itself to 
> be temporarily installed to an offset location ahead of the $PREFIX 
> location.
> One of these cases is the one explianed here [1].I
> So it's a 
> common (anche best) practice to use a $DESTDIR (or $INSTALL_ROOT or 
> $INSTALL_PREFIX) variable in the "install" target of the Maefile, to be 
> used before the ${prefix} occurencies.
> This does not alter in any way 
> the normal "install" process, but allows a non-root user to do 
> something like this:
> 
> make DESTDIR=/tmp/destdir install
> 
> To allows 
> this, i think that the Pound Malkefile should be changed from:
> 
> install:        all
>                 [ -d ${exec_prefix}/sbin ] || mkdir 
> ${exec_prefix}/sbin
>                 ./install-sh -c -o bin -g bin -m 
> 555 -s pound ${exec_prefix}/sbi
>                 [ -d ${prefix}/man ] || 
> mkdir ${prefix}/man
>                 [ -d ${prefix}/man/man8 ] || mkdir 
> ${prefix}/man/man8
>                 ./install-sh -c -o bin -g bin -m 644 
> pound.8 ${prefix}/man/man8/
> 
> To:
> 
> install:        all
>                 [ 
> -d ${DESTDIR}${exec_prefix}/sbin ] || mkdir ${DESTDIR}${exec_prefix}
> /sbin
>                 ./install-sh -c -o bin -g bin -m 555 -s pound 
> ${DESTDIR}${exec_prefix}/sbi
>                 [ -d ${DESTDIR}${prefix}
> /man ] || mkdir ${DESTDIR}${prefix}/man
>                 [ -d 
> ${DESTDIR}${prefix}/man/man8 ] || mkdir ${DESTDIR}${prefix}/man/man8
>                 ./install-sh -c -o bin -g bin -m 644 pound.8 
> ${DESTDIR}${prefix}/man/man8/
> 
> [1] http://www.blastwave.
> org/standards/pkgcreation.php ("How to create the package file without 
> root access")

This is available when you configure the package. Try

./configure --prefix=/tmp

for example (or just ./configure --help for detailed instructions).
Alternately you can manually edit the generated Makefile and change
prefix to whatever suits you.
-- 
Robert Segall
Apsis GmbH
Postfach, Uetikon am See, CH-8707
Tel: +41-44-920 4904


R: Re: [Pound Mailing List] small patch proposal for Makefile
alessio <a.cervellin(at)virgilio.it>
2006-02-08 12:35:03 [ SNIP ]
> ./configure --prefix=/tmp

this is different from specifying 
$DESTDIR... DESTDIR is added in front of $PREFIX and have a different 
purpose (see [1])

> Alternately you can manually edit the generated 
Makefile and change
> prefix to whatever suits you.

I know I can, but 
it would be nice if it should not require any manual change by the user 
(a lot of Makefiles use the $DESTDIR variable in front of $PREFIX, it's 
something like a best practice)

Re: R: Re: [Pound Mailing List] small patch proposal for Makefile
Robert Segall <roseg(at)apsis.ch>
2006-02-08 12:43:58 [ SNIP ]
On Wed, 2006-02-08 at 12:35 +0100, alessio wrote:
> > ./configure --prefix=/tmp
> 
> this is different from specifying 
> $DESTDIR... DESTDIR is added in front of $PREFIX and have a different 
> purpose (see [1])
> 
> > Alternately you can manually edit the generated 
> Makefile and change
> > prefix to whatever suits you.
> 
> I know I can, but 
> it would be nice if it should not require any manual change by the user 
> (a lot of Makefiles use the $DESTDIR variable in front of $PREFIX, it's 
> something like a best practice)

The DESTDIR thing is also a security risk: if someone manages to change
or set it without your knowledge you'll be installing in unexpected
places. Personally I don't call that "best practise".
-- 
Robert Segall
Apsis GmbH
Postfach, Uetikon am See, CH-8707
Tel: +41-44-920 4904


Re: R: Re: [Pound Mailing List] small patch proposal for Makefile
Alessio Cervellin <a.cervellin(at)acm.org>
2006-02-09 06:52:05 [ SNIP ]
Robert Segall ha scritto:

> The DESTDIR thing is also a security risk: if someone manages to change
> or set it without your knowledge you'll be installing in unexpected
> places. 

Security risk? Unexpeteced places? A user can write only where he is 
allowed to by the sysadmin, this has nothing to whether you allow to 
define $destdir or not (that's exactly the same with $prefix)

> Personally I don't call that "best practise".

If you don't want to call it best practice... well, call it common 
practice, since most of the OSS' makefiles have a $destdir ;)

Re: R: Re: [Pound Mailing List] small patch proposal for Makefile
Steven Van Acker <deepstar(at)ulyssis.org>
2006-02-09 09:02:48 [ SNIP ]
On Thu, Feb 09, 2006 at 06:52:05AM +0100, Alessio Cervellin wrote:
> Robert Segall ha scritto:
> 
> >The DESTDIR thing is also a security risk: if someone manages to change
> >or set it without your knowledge you'll be installing in unexpected
> >places. 
> 
> Security risk? Unexpeteced places? A user can write only where he is 
> allowed to by the sysadmin, this has nothing to whether you allow to 
> define $destdir or not (that's exactly the same with $prefix)

DESTDIR is as much a security risk as --prefix: it isn't

> >Personally I don't call that "best practise".
> 
> If you don't want to call it best practice... well, call it common 
> practice, since most of the OSS' makefiles have a $destdir ;)

I agree.

DESTDIR is a necessity for package builders. It allows one to build
pound in a temporary directory, which can then be rolled into e.g. a
Debian package.

greets,
-- Steven


R: Re: R: Re: [Pound Mailing List] small patch proposal for Makefile
alessio <a.cervellin(at)virgilio.it>
2006-02-09 09:31:29 [ SNIP ]
>> If you don't want to call it best practice... well, call it common 
>> practice, since most of the OSS' makefiles have a $destdir ;)

> I 
agree.
>
> DESTDIR is a necessity for package builders. It allows one 
to build
> pound in a temporary directory, which can then be rolled 
into e.g. a
> Debian package.

Yes, and last words to this discussion 
should be these: 
the latest automake/autoconf official manual:
http:
//www.gnu.org/software/automake/manual/html_node/Install.html#Install

DESTDIR is documented in the "staged install" chapter.
Shortly:
- 
$prefix is used for defining the final destination.
- $DESTDIR is used 
for defining a staging area.

And here:
http://www.gnu.
org/software/automake/manual/standards/Makefile-Conventions.
html#Makefile%20Conventions

So DESTDIR is both e best practice, a 
common practice, and a convention.
Is this enough? ;)



Re: R: Re: R: Re: [Pound Mailing List] small patch proposal for Makefile
Robert Segall <roseg(at)apsis.ch>
2006-02-09 13:20:52 [ SNIP ]
On Thu, 2006-02-09 at 09:31 +0100, alessio wrote:
> >> If you don't want to call it best practice... well, call it common 
> >> practice, since most of the OSS' makefiles have a $destdir ;)
> 
> > I 
> agree.
> >
> > DESTDIR is a necessity for package builders. It allows one 
> to build
> > pound in a temporary directory, which can then be rolled 
> into e.g. a
> > Debian package.
> 
> Yes, and last words to this discussion 
> should be these: 
> the latest automake/autoconf official manual:
> http:
> //www.gnu.org/software/automake/manual/html_node/Install.html#Install
> 
> DESTDIR is documented in the "staged install" chapter.
> Shortly:
> - 
> $prefix is used for defining the final destination.
> - $DESTDIR is used 
> for defining a staging area.
> 
> And here:
> http://www.gnu.
> org/software/automake/manual/standards/Makefile-Conventions.
> html#Makefile%20Conventions
> 
> So DESTDIR is both e best practice, a 
> common practice, and a convention.
> Is this enough? ;)

OK, if you guys feel so strongly about it, it will be added to the next
release...
-- 
Robert Segall
Apsis GmbH
Postfach, Uetikon am See, CH-8707
Tel: +41-44-920 4904


MailBoxer