Subject: DESTDIR support
To: None <tech-pkg@netbsd.org>
From: Joerg Sonnenberger <joerg@britannica.bec.de>
List: tech-pkg
Date: 10/09/2006 15:04:49
Hi all,
I've just commited the initial DESTDIR support. To use it, set
USE_DESTDIR= yes
in /etc/mk.conf and try building one of the modifed packages. You will
note, that it won't get installed into ${LOCALBASE} directly, but a
binary package is created first. This can be installed with
"make bin-install" afterwards.
Developers which want to modify existing packages should also try
USE_DESTDIR= full
This makes the build completely unprivileged and in turn detects any
attempt to write e.g. to ${LOCALBASE}. This is not supported for actual
installation yet, due to short comings of pkg_create.
To allow a package to use it, set
PKG_DESTDIR_SUPPORT= user-destdir
when the owner/group of all files is following the default rules
(e.g. because BSD_INSTALL_* was used) or at least are supposed so.
I'll add mechanisms to override owner and group for individual files
shortly to soften this requirement. If the package has weired hard-coded
user names and no easy way to change that is found, try
PKG_DESTDIR_SUPPORT= destdir
instead, but you will loose the protection in that case.
This works by setting DESTDIR in the environemnt of the installation for
packages using make (and additional on the command line to override
DESTDIR= entries in the Makefiles). Don't forgot to modify the
pre-install/post-install rules and keep in mind that INSTALL is *not*
run.
The conversion for packages using imake or automake 1.4+ should be
straight forward, other systems might need more work.
Joerg