Subject: Re: Using (or Not Using) DESTDIR
To: Curt Sampson <cjs@cynic.net>
From: Frederick Bruckman <fb@enteract.com>
List: tech-pkg
Date: 03/26/2000 14:28:10
On Sun, 26 Mar 2000, Curt Sampson wrote:

> On Sat, 25 Mar 2000, Frederick Bruckman wrote:
> 
> > So why not wrap it with ".ifndef (BSD_PKG_MK)"...
> 
> Because that was never documented anywhere, and I had no idea it
> existed? Certainly you don't expect that everyone out there building
> NetBSD and just ocasionally using pkgsrc to install a program once
> in a while is going to be intimately familiar with over three
> thousand lines of makefile source.

Fair 'nuff. I've added comments to mk.conf.example.

> > or better, ".if make(release)"
> 
> Now you show your ignorance of the makefiles you don't frequently
> work with. :-)

That would be nothing new...

> This ignores all of the following targets which also
> use DESTDIR: snapshot, install, distribution, distrib-dirs, build.
> (This is only a partial list, but includes the ones most frequently
> used on the make command line.)

Of course, since it's _your_ mk.conf, you only have to account for the
targets you use. Whatever works for you. I built the mac68k release
with this /etc/mk.conf (abbreviated).

# Packages and userland
OBJMACHINE=	YES

.ifndef (BSD_PKG_MK)
.ifndef (DESTDIR)

# Options for private, local build
#COPTS+=                -m68040
MANINSTALL=             catinstall

.else

# Release specific options
BUILD_KERNELS=          INSTALL INSTALLSBC
EXTRA_KERNELS=          GENERIC GENERICSBC

.endif # !DESTDIR
.else

# Package only options
NO_CHECKSUM=            yes # Run checksums on the NFS host
PACKAGES=               ${PKGSRCDIR}/packages/${MACHINE_ARCH}
PAPERSIZE=              Letter
PATCH_FUZZ_FACTOR?=     -F0
SU_CMD=                 ${SU} -K - root -c
WRKOBJDIR=              /usr/pkgobj

.endif # BSD_PKG_MK

So I _never_ set DESTDIR in /etc/mk.conf, but when I set it on the
make command line, it pulls in a different set of options. This exact
plan may not suit you, but you could still set DESTDIR conditionally
on "defined (BSD_PKG_MK)". (Setting in the environment doesn't work,
BTW, for xsrc.)

> What do you think? I don't see any reason for forcing the build
> variables for src and pkgsrc together, since they really don't
> share much in common.

That's _exactly_ what BSD_PKG_MK is for. Besides, they do share
OBJMACHINE in common, and DESTDIR. In fact, sharing DESTDIR will be
essential once we pkg'ize the userland sets, so there goes your
justification for another mk.conf.