Fri Apr 12 19:56:23 2024 UTC (44d)
mk/pkgformat/pkg: Make default cross-built PKG_DBDIR nicer.

`bootstrap --prefix /home/user/pkg' will create an mk.conf with
PKG_DBDIR=/home/user/pkg/pkgdb, but if you are using that installation
to cross-build packages, you likely want the default cross-built
PKG_DBDIR to be /usr/pkg/pkgdb just like the default cross-built
LOCALBASE is /usr/pkg.  This change implements that.

You can still override the cross-built PKG_DBDIR by setting
CROSS_PKG_DBDIr in mk.conf.

No change to native builds because the new logic is conditional on
USE_CROSS_COMPILE = yes.


(riastradh)
diff -r1.16 -r1.17 pkgsrc/mk/pkgformat/pkg/pkgformat-vars.mk

cvs diff -r1.16 -r1.17 pkgsrc/mk/pkgformat/pkg/pkgformat-vars.mk (expand / switch to unified diff)

--- pkgsrc/mk/pkgformat/pkg/pkgformat-vars.mk 2024/01/26 12:40:04 1.16
+++ pkgsrc/mk/pkgformat/pkg/pkgformat-vars.mk 2024/04/12 19:56:23 1.17
@@ -1,32 +1,46 @@ @@ -1,32 +1,46 @@
1# $NetBSD: pkgformat-vars.mk,v 1.16 2024/01/26 12:40:04 riastradh Exp $ 1# $NetBSD: pkgformat-vars.mk,v 1.17 2024/04/12 19:56:23 riastradh Exp $
2# 2#
3# This Makefile fragment is included indirectly by bsd.prefs.mk and 3# This Makefile fragment is included indirectly by bsd.prefs.mk and
4# defines some variables which must be defined earlier than where 4# defines some variables which must be defined earlier than where
5# pkgformat.mk is included. 5# pkgformat.mk is included.
6# 6#
7 7
8PKGSRC_MESSAGE_RECIPIENTS?= # empty 8PKGSRC_MESSAGE_RECIPIENTS?= # empty
9 9
10.if !empty(PKGSRC_MESSAGE_RECIPIENTS) 10.if !empty(PKGSRC_MESSAGE_RECIPIENTS)
11USE_TOOLS+= mail 11USE_TOOLS+= mail
12.endif 12.endif
13 13
14.if defined(PKG_PRESERVE) 14.if defined(PKG_PRESERVE)
15USE_TOOLS+= date 15USE_TOOLS+= date
16.endif 16.endif
17 17
18# This is the package database directory for the default view. 18# This is the package database directory for the default view.
 19.if ${USE_CROSS_COMPILE:tl} != "yes"
19PKG_DBDIR?= ${LOCALBASE}/pkgdb 20PKG_DBDIR?= ${LOCALBASE}/pkgdb
 21.else
 22. ifndef HOST_PKG_DBDIR
 23# XXX This isn't quite right: if PKG_DBDIR is defined in terms of
 24# LOCALBASE, we really want to resolve it (`HOST_PKG_DBDIR:=') in
 25# bsd.prefs.mk before we switch LOCALBASE to CROSS_LOCALBASE. But
 26# there's no place there to put pkgformat-vars business. Fortunately,
 27# bootstrap just writes out the full path so this is only an issue if
 28# you explicitly write out `PKG_DBDIR= ...${LOCALBASE}...' in your
 29# mk.conf.
 30HOST_PKG_DBDIR:= ${PKG_DBDIR:U${TOOLBASE}/pkgdb}
 31. endif
 32PKG_DBDIR= ${CROSS_PKG_DBDIR:U${LOCALBASE}/pkgdb}
 33.endif
20 34
21# _PKG_DBDIR is the actual packages database directory where we register 35# _PKG_DBDIR is the actual packages database directory where we register
22# packages. 36# packages.
23# 37#
24_PKG_DBDIR= ${_CROSS_DESTDIR}${PKG_DBDIR} 38_PKG_DBDIR= ${_CROSS_DESTDIR}${PKG_DBDIR}
25_HOST_PKG_DBDIR= ${HOST_PKG_DBDIR:U${PKG_DBDIR}} 39_HOST_PKG_DBDIR= ${HOST_PKG_DBDIR:U${PKG_DBDIR}}
26 40
27PKG_ADD_CMD?= ${PKG_TOOLS_BIN}/pkg_add 41PKG_ADD_CMD?= ${PKG_TOOLS_BIN}/pkg_add
28PKG_ADMIN_CMD?= ${PKG_TOOLS_BIN}/pkg_admin 42PKG_ADMIN_CMD?= ${PKG_TOOLS_BIN}/pkg_admin
29PKG_CREATE_CMD?= ${PKG_TOOLS_BIN}/pkg_create 43PKG_CREATE_CMD?= ${PKG_TOOLS_BIN}/pkg_create
30PKG_DELETE_CMD?= ${PKG_TOOLS_BIN}/pkg_delete 44PKG_DELETE_CMD?= ${PKG_TOOLS_BIN}/pkg_delete
31PKG_INFO_CMD?= ${PKG_TOOLS_BIN}/pkg_info 45PKG_INFO_CMD?= ${PKG_TOOLS_BIN}/pkg_info
32LINKFARM_CMD?= ${PKG_TOOLS_BIN}/linkfarm 46LINKFARM_CMD?= ${PKG_TOOLS_BIN}/linkfarm