The attached patches implement DESTDIR support in the ports infrastructure, which can be
used to install ports into separate jail environments. Besides, some ports need a slight
modification to work with DESTDIR. I did a lot of effort so that individual ports
need the least modification, but I had to change the behaviour of LOCALBASE, LINUXBASE,
X11BASE a bit. They contain DESTDIR in itself, thus we can just leave lines like
BUILD_DEPENDS= ${LOCALBASE}/bin/foo:${PORTSDIR}/misc/foo alone. I introduced
LOCALBASE_REL, LINUXBASE_REL and X11BASE_REL for the old functionality. Note, that
LOCALBASE, LINUXBASE and X11BASE are still overrideable with my workaround, so this change
doesn't break compatibility! Simpler ports like net/csup already work with this
implementation, but e.g. shells/bash needs just a little bit of modification.
This PR supersedes ports/28155.
Sponsored by: Google Summer of Code 2006
Reviewed by: erwin
Wiki: http://wikitest.freebsd.org/DESTDIR
See also: http://perforce.freebsd.org/depotTreeBrowser.cgi?FSPC=//depot/projects/soc2006/gabor%5fdocs/porters%2dhandbook&HIDEDEL=NO
(I wrote some sentences for porters-handbook, how one can write DESTDIR-respective ports)

The part of this PR that recently got committed to bsd.port.mk seems to
cause breakage with KDE ports on pointyhat, see
http://pointyhat.freebsd.org/errorlogs/i386-errorlogs/e.4.2006071303/kdelibs-nocups-3.5.3.log
for an example.
I get the same error ("cp: /var/db/pkg/<portname>/+MTREE_DIRS: No such
file or directory") on our own small
build cluster, which runs a fork of the pointyhat scripts. Reverting bsd.port.mk to the
previous revision got rid of the problem there. I'm not really sure whether KDE is actually the common
thing for these errors - I've seen them myself for qt and arts, the pointyhat error is for kdehier - none
of these three ports has much in common, kdehier doesn't even include bsd.kde.mk (although the failure
on pointyhat as seen in the log above happens during the kdelibs build, which does).
Please take a look at this as soon as possible.

Update:
I found the trigger for the bug: FORCE_PKG_REGISTER.
kdelibs fails on pointyhat because it depends on kdehier via the old
DEPENDS mechanism, which sets this flag.
The failures I've been seeing on the KDE cluster happen because our
custom automatic plist building script sets it as well.
You can easily reproduce this with any port though via make
-DFORCE_PKG_REGISTER package.

Michael Nottebrock wrote:
> Update:
>
> I found the trigger for the bug: FORCE_PKG_REGISTER.
>
> kdelibs fails on pointyhat because it depends on kdehier via the old
> DEPENDS mechanism, which sets this flag.
> The failures I've been seeing on the KDE cluster happen because our
> custom automatic plist building script sets it as well.
>
> You can easily reproduce this with any port though via make
> -DFORCE_PKG_REGISTER package.
>
Thanks, I'm already working on the issue, the dependencies of kdelibs3
are just being built on my test machine, but this observation might help
a lot.
--
Cheers,
Gabor

G=E1bor K=F6vesd=E1n schrieb:
> Michael Nottebrock wrote:
>>
>> You can easily reproduce this with any port though via make
>> -DFORCE_PKG_REGISTER package.
>> =20
> Thanks, I'm already working on the issue, the dependencies of kdelibs3
> are just being built on my test machine, but this observation might
> help a lot.
It's actually a little more tricky to reproduce than just doing make
-DFORCE_PKG_REGISTER package, but I found this sequence to be readily
reproducable:
cd /usr/ports/audio/yell
make package # succeed=
s
make clean
make package # fails,
already installed
make -DFORCE_PKG_REGISTER package # fails, with the error as seen on
pointyhat
make deinstall clean
(redo from start)

Michael Nottebrock wrote:
> Gábor Kövesdán schrieb:
>
>> Michael Nottebrock wrote:
>>
>>> You can easily reproduce this with any port though via make
>>> -DFORCE_PKG_REGISTER package.
>>>
>>>
>> Thanks, I'm already working on the issue, the dependencies of kdelibs3
>> are just being built on my test machine, but this observation might
>> help a lot.
>>
> It's actually a little more tricky to reproduce than just doing make
> -DFORCE_PKG_REGISTER package, but I found this sequence to be readily
> reproducable:
>
> cd /usr/ports/audio/yell
> make package # succeeds
> make clean
> make package # fails,
> already installed
> make -DFORCE_PKG_REGISTER package # fails, with the error as seen on
> pointyhat
> make deinstall clean
>
> (redo from start)
>
>
This patch seems to fix it:
http://gabor.t-hosting.hu/patches/destdir_package.diff
Could you confirm it? Unfortunately, I don't have too much resource to
test kdelibs3, the dependencies are still being built. Anyway, I dont'
actually know yet why this ${RM} invocation was necessary and why this
worked before.
--
Cheers,
Gabor