tech-pkg archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Split LOCALBASE for cross-compiled packages



It would be nice if you could do an unprivileged pkgsrc build, say in
~~/cross/pkg, of a cross-built binary package that will get installed
in /usr/pkg.

The attached patch implements just that, by introducing:

- a user-defined variable CROSS_LOCALBASE (default /usr/pkg), which
  determines the LOCALBASE that gets baked into any cross-compiled
  packages and is available via the value of LOCALBASE in the makefile
  when cross-compiling; and

- a variable TOOLBASE available for reference by makefiles, which
  gives the LOCALBASE that any toolchain packages (TOOL_DEPENDS) are
  natively installed into and can be executed from.

More details in the commit message.  Lots of packages need to be
updated to recognize this distinction, of course, but that can be done
as we encounter problems.

For native compilation, there is no change to the effect of setting
LOCALBASE in mk.conf or to what you get by referring to LOCALBASE in
package makefiles.

OK?
>From 0a994451f55c6d5775ab56a6a77f1875fd9099a6 Mon Sep 17 00:00:00 2001
From: Taylor R Campbell <riastradh%NetBSD.org@localhost>
Date: Sat, 11 Mar 2023 13:27:45 +0000
Subject: [PATCH] Split native and cross LOCALBASE for cross-compilation.

This way, you can use an unprivileged prefix of ~/cross/pkg to
cross-compile packages that, when installed, will go in /usr/pkg.

In mk.conf:

- Set CROSS_LOCALBASE to determine the installation prefix of
  packages that you cross-compile.

- Set LOCALBASE to determine the installation prefix of native
  packages needed for cross compilation.

Both default to /usr/pkg.  Note: CROSS_LOCALBASE defaults to /usr/pkg
even if you set LOCALBASE.  Of course, if you're not cross-compiling,
this has no effect.

When cross-compiling a package:

- LOCALBASE is where cross-compiled packages will be installed.

  (`make install' will put it in ${CROSS_DESTDIR}${LOCALBASE}, of
  course, but when you later use pkg_add to install the binary
  package on the system you're compiling it for, it will go in
  ${LOCALBASE}.  And you can still set PREFIX for an individual
  package, but LOCALBASE refers to where cross-compiled packages are
  generally installed, other than the specific ones that override
  PREFIX.)

- TOOLBASE is where tool dependencies are installed and available to
  be executed at build-time.

  For example, if you have TOOL_DEPENDS on a program that is
  installed in (say) foo/bin/xyz which is not in PATH so you have to
  refer ot its full pathname, you can execute ${TOOLBASE}/foo/bin/xyz
  instead of ${LOCALBASE}/foo/bin/xyz.

I chose this split, rather than the other way around, because I
expect that references that are baked into installed packages to be
more common than references that are executed at build-time, but I
didn't do an extensive study of the matter.  I chose the name
TOOLBASE because it's where TOOL_DEPENDS go.
---
 doc/HOWTO-dev-crosscompile         |   9 ++
 doc/HOWTO-use-crosscompile         |  10 +-
 mk/bsd.pkg.mk                      |   4 +-
 mk/bsd.pkg.use.mk                  |  14 +--
 mk/bsd.prefs.mk                    |   7 +-
 mk/check/check-perms.mk            |   4 +-
 mk/compiler/ccache.mk              |  10 +-
 mk/compiler/clang.mk               |   2 +-
 mk/compiler/f2c.mk                 |   6 +-
 mk/compiler/gcc.mk                 |   6 +-
 mk/compiler/gfortran.mk            |   2 +-
 mk/compiler/pcc.mk                 |   2 +-
 mk/cwrappers.mk                    |   3 +-
 mk/pkgformat/pkg/package.mk        |   2 +-
 mk/pkgformat/pkg/pkgformat-vars.mk |  35 +++---
 mk/pkginstall/bsd.pkginstall.mk    |   2 +-
 mk/platform/NetBSD.mk              |   5 +-
 mk/tools/autoconf.mk               |  26 ++---
 mk/tools/automake.mk               |   8 +-
 mk/tools/digest.mk                 |   2 +-
 mk/tools/gettext.mk                |   4 +-
 mk/tools/gmake.mk                  |   2 +-
 mk/tools/intltool.mk               |   2 +-
 mk/tools/perl.mk                   |   2 +-
 mk/tools/replace.mk                | 168 ++++++++++++++---------------
 mk/tools/tools.AIX.mk              |   2 +-
 mk/tools/tools.UnixWare.mk         |   2 +-
 textproc/xmlcatmgr/Makefile        |   2 +-
 28 files changed, 185 insertions(+), 158 deletions(-)

diff --git a/doc/HOWTO-dev-crosscompile b/doc/HOWTO-dev-crosscompile
index 0459ff62cc65..ac93b5c5b877 100644
--- a/doc/HOWTO-dev-crosscompile
+++ b/doc/HOWTO-dev-crosscompile
@@ -50,6 +50,15 @@ transforming some XML with XSLT, you might add:
 
 TOOL_DEPENDS+=  libxslt>=1.1.0:../../textproc/libxslt
 
+If you need to refer to the full pathname of a file in a package
+installed with TOOL_DEPENDS, it will generally be relative to TOOLBASE
+rather than LOCALBASE.  For example:
+
+XSLTPROC=	${TOOLBASE}/bin/xsltproc
+
+post-build:
+	cd ${WRKSRC}/xmlstuff && ${XSLTPROC} ...
+
 * Native C and C++ compilers
 
 Some software wants build tools written in C and C++ and then execute
diff --git a/doc/HOWTO-use-crosscompile b/doc/HOWTO-use-crosscompile
index 1c46b5ede3ab..c95eec33b2d4 100644
--- a/doc/HOWTO-use-crosscompile
+++ b/doc/HOWTO-use-crosscompile
@@ -61,9 +61,13 @@ In addition to whatever else you want in your mk.conf for pkgsrc, add:
    MACHINE_ARCH=        powerpc
    .endif
 
-XXX Some variables, notably LOCALBASE and other paths that get baked
-into packages, cannot currently be set differently for native and
-target packages.
+Optionally, you can set CROSS_LOCALBASE for cross-compiled packages
+separately from LOCALBASE for natively compiled packages.  For example,
+you can use an unprivileged pkgsrc build into /home/user/cross/pkg that
+will create packages which install to /opt/pkg:
+
+   LOCALBASE=		/home/user/cross/pkg
+   CROSS_LOCALBASE=	/opt/pkg
 
 ** Bootstrapped pkgsrc
 
diff --git a/mk/bsd.pkg.mk b/mk/bsd.pkg.mk
index b55678c094bf..aa49f03b4d08 100644
--- a/mk/bsd.pkg.mk
+++ b/mk/bsd.pkg.mk
@@ -179,7 +179,7 @@ ALL_ENV+=	LC_NUMERIC=C
 ALL_ENV+=	LC_TIME=C
 ALL_ENV+=	LDFLAGS=${LDFLAGS:M*:Q}
 ALL_ENV+=	LINKER_RPATH_FLAG=${LINKER_RPATH_FLAG:Q}
-ALL_ENV+=	PATH=${PATH:Q}:${LOCALBASE}/bin:${X11BASE}/bin
+ALL_ENV+=	PATH=${PATH:Q}:${TOOLBASE}/bin:${X11BASE}/bin
 ALL_ENV+=	PREFIX=${PREFIX}
 ALL_ENV+=	MAKELEVEL=0
 ALL_ENV+=	CONFIG_SITE=${PKGSRC_CONFIG_SITE:U}
@@ -685,7 +685,7 @@ su-target: .USE
 # Run pkglint:
 .PHONY: lint
 lint:
-	${RUN} ${LOCALBASE}/bin/pkglint
+	${RUN} ${TOOLBASE}/bin/pkglint
 
 # List of flags to pass to pkg_add(1) for bin-install:
 
diff --git a/mk/bsd.pkg.use.mk b/mk/bsd.pkg.use.mk
index 6dadcdab09f1..5e1adc1adb2b 100644
--- a/mk/bsd.pkg.use.mk
+++ b/mk/bsd.pkg.use.mk
@@ -82,8 +82,8 @@ BUILD_DEFS+=		KERBEROS
 PKG_FAIL_REASON+=	"Cross-compiling Fortran with libtool NYI."
 .  endif
 
-PKG_LIBTOOL?=		${LOCALBASE}/bin/libtool-fortran
-PKG_SHLIBTOOL?=		${LOCALBASE}/bin/shlibtool-fortran
+PKG_LIBTOOL?=		${TOOLBASE}/bin/libtool-fortran
+PKG_SHLIBTOOL?=		${TOOLBASE}/bin/shlibtool-fortran
 
 .  if defined(USE_LIBTOOL)
 # XXX This really needs cross-libtool-fortran like cross-libtool-base.
@@ -91,11 +91,11 @@ TOOL_DEPENDS+=		libtool-fortran>=${_OPSYS_LIBTOOL_REQD:U${LIBTOOL_REQD}}:../../d
 .  endif
 .else
 .  if !empty(USE_CROSS_COMPILE:M[yY][eE][sS])
-PKG_LIBTOOL?=		${LOCALBASE}/cross-${TARGET_ARCH:U${MACHINE_ARCH}}/bin/libtool
-PKG_SHLIBTOOL?=		${LOCALBASE}/cross-${TARGET_ARCH:U${MACHINE_ARCH}}/bin/shlibtool
+PKG_LIBTOOL?=		${TOOLBASE}/cross-${TARGET_ARCH:U${MACHINE_ARCH}}/bin/libtool
+PKG_SHLIBTOOL?=		${TOOLBASE}/cross-${TARGET_ARCH:U${MACHINE_ARCH}}/bin/shlibtool
 .  else
-PKG_LIBTOOL?=		${LOCALBASE}/bin/libtool
-PKG_SHLIBTOOL?=		${LOCALBASE}/bin/shlibtool
+PKG_LIBTOOL?=		${TOOLBASE}/bin/libtool
+PKG_SHLIBTOOL?=		${TOOLBASE}/bin/shlibtool
 .  endif
 .endif
 LIBTOOL?=		${WRAPPER_BINDIR}/libtool
@@ -115,5 +115,5 @@ MAKE_ENV+=		LIBTOOL="${LIBTOOL} ${LIBTOOL_FLAGS}"
 # when building cwrappers, so use the shell tools in that instance.
 .if ${_PKGSRC_USE_MKTOOLS} == "yes" && empty(PKGPATH:Mpkgtools/cwrappers)
 TOOL_DEPENDS+=		mktools-[0-9]*:../../pkgtools/mktools
-PKG_MKSYMLINKS?=	${LOCALBASE}/libexec/mktools/mk-buildlink-symlinks
+PKG_MKSYMLINKS?=	${TOOLBASE}/libexec/mktools/mk-buildlink-symlinks
 .endif
diff --git a/mk/bsd.prefs.mk b/mk/bsd.prefs.mk
index 765b1a713ce3..e32e1c131798 100644
--- a/mk/bsd.prefs.mk
+++ b/mk/bsd.prefs.mk
@@ -601,6 +601,11 @@ IPV6_READY=		NO
 .endif
 
 LOCALBASE?=		/usr/pkg
+NATIVE_LOCALBASE:=	${LOCALBASE}
+TOOLBASE=		${NATIVE_LOCALBASE}
+.if !empty(USE_CROSS_COMPILE:M[yY][eE][sS])
+LOCALBASE=		${CROSS_LOCALBASE:U/usr/pkg}
+.endif
 X11_TYPE?=		modular
 .if !empty(X11_TYPE:Mnative)
 .  if ${OPSYS} == "SunOS"
@@ -626,7 +631,7 @@ X11BASE?=	/usr
 X11BASE?=	/usr/X11R6
 .  endif
 .endif
-CROSSBASE?=	${LOCALBASE}/cross
+CROSSBASE?=	${NATIVE_LOCALBASE}/cross
 
 .if defined(FIX_SYSTEM_HEADERS) && ${FIX_SYSTEM_HEADERS} == "yes" && \
     !defined(BOOTSTRAP_PKG) && \
diff --git a/mk/check/check-perms.mk b/mk/check/check-perms.mk
index 09943856f77d..60adbc433d0f 100644
--- a/mk/check/check-perms.mk
+++ b/mk/check/check-perms.mk
@@ -32,7 +32,7 @@ _USER_VARS.check-perms=	CHECK_PERMS
 _PKG_VARS.check-perms=	CHECK_PERMS_SKIP CHECK_PERMS_AUTOFIX
 _DEF_VARS.check-perms=	TOOL_DEPENDS
 _USE_VARS.check-perms=	PKG_DEVELOPER MACHINE_PLATFORM DESTDIR PREFIX
-_IGN_VARS.check-perms=	_* LOCALBASE PKGNAME HOST_PKG_INFO
+_IGN_VARS.check-perms=	_* TOOLBASE PKGNAME HOST_PKG_INFO
 
 .if ${PKG_DEVELOPER:Uno} != "no"
 CHECK_PERMS?=		yes
@@ -59,7 +59,7 @@ TOOL_DEPENDS+=	checkperms>=1.1:../../sysutils/checkperms
 privileged-install-hook: _check-perms
 .endif
 
-_CHECK_PERMS_CMD=	${LOCALBASE}/bin/checkperms
+_CHECK_PERMS_CMD=	${TOOLBASE}/bin/checkperms
 _CHECK_PERMS_GETDIRS_AWK=						\
 	/.*/ {								\
 		print $$0;						\
diff --git a/mk/compiler/ccache.mk b/mk/compiler/ccache.mk
index 619e681827bf..477beedde290 100644
--- a/mk/compiler/ccache.mk
+++ b/mk/compiler/ccache.mk
@@ -32,9 +32,9 @@
 #
 # CCACHE_BASE
 #	The directory where ccache is installed. The build dependency on
-#	devel/ccache is only added when this is ${LOCALBASE}.
+#	devel/ccache is only added when this is ${TOOLBASE}.
 #
-#	Default: ${LOCALBASE}
+#	Default: ${TOOLBASE}
 #
 # CCACHE_DIR
 #	The directory where the cached compiler results are stored. By
@@ -71,7 +71,7 @@ _PKG_VARS.ccache=	IGNORE_CCACHE
 
 .include "../bsd.fast.prefs.mk"
 
-CCACHE_BASE?=	${LOCALBASE}
+CCACHE_BASE?=	${TOOLBASE}
 CCACHE_DIR?=	${WRKDIR}/.ccache-cache
 
 _USE_CCACHE=	yes
@@ -93,7 +93,7 @@ _CCACHE_CIRCULAR_DEPENDENCY_PACKAGES=	\
 	sysutils/checkperms
 
 # break circular dependencies
-.if ${CCACHE_BASE} == ${LOCALBASE} &&	\
+.if ${CCACHE_BASE} == ${TOOLBASE} &&	\
 	!empty(_CCACHE_CIRCULAR_DEPENDENCY_PACKAGES:M${PKGPATH})
 _USE_CCACHE=	no
 MAKEFLAGS+=	_USE_CCACHE=${_USE_CCACHE}
@@ -138,7 +138,7 @@ PKG_CXX:=	${_CCACHE_CXX}
 PREPEND_PATH+=	${_CCACHE_DIR}/bin
 
 # Add the dependency on ccache.
-.  if ${CCACHE_BASE} == ${LOCALBASE}
+.  if ${CCACHE_BASE} == ${TOOLBASE}
 TOOL_DEPENDS+=	ccache-[0-9]*:../../devel/ccache3
 .  endif
 
diff --git a/mk/compiler/clang.mk b/mk/compiler/clang.mk
index b15ff9a38850..b5c895f7420e 100644
--- a/mk/compiler/clang.mk
+++ b/mk/compiler/clang.mk
@@ -17,7 +17,7 @@ COMPILER_CLANG_MK=	defined
 
 .include "../../mk/bsd.prefs.mk"
 
-CLANGBASE?=		${LOCALBASE}
+CLANGBASE?=		${TOOLBASE}
 LANGUAGES.clang=	# empty
 
 .if exists(${CLANGBASE}/bin/clang)
diff --git a/mk/compiler/f2c.mk b/mk/compiler/f2c.mk
index eacea17f615a..18b28293bde0 100644
--- a/mk/compiler/f2c.mk
+++ b/mk/compiler/f2c.mk
@@ -60,7 +60,7 @@ PKG_FC?=	${FC}
 _F2C_VARS+=	FC
 _F2C_FC:=	${_F2C_DIR}/bin/${PKG_FC:T}
 _ALIASES.FC+=	f77 g77 f2c-f77
-FCPATH=		${LOCALBASE}/bin/f2c-f77
+FCPATH=		${TOOLBASE}/bin/f2c-f77
 PKG_FC:=	${_F2C_FC}
 #
 # The f2c-f77 shell script invokes the C compiler, so ensure that it finds
@@ -111,11 +111,11 @@ override-tools: ${_F2C_${_var_}}
 ${_F2C_${_var_}}:
 	${RUN}${MKDIR} ${.TARGET:H}
 	${RUN}					\
-	${LN} -fs ${LOCALBASE}/bin/f2c-f77 ${.TARGET}
+	${LN} -fs ${TOOLBASE}/bin/f2c-f77 ${.TARGET}
 .      for _alias_ in ${_ALIASES.${_var_}:S/^/${.TARGET:H}\//}
 	${RUN}					\
 	if [ ! -x "${_alias_}" ]; then					\
-		${LN} -fs ${LOCALBASE}/bin/f2c-f77 ${_alias_};		\
+		${LN} -fs ${TOOLBASE}/bin/f2c-f77 ${_alias_};		\
 	fi
 .      endfor
 .    endif
diff --git a/mk/compiler/gcc.mk b/mk/compiler/gcc.mk
index a10ece5daaf4..02775c00f2b3 100644
--- a/mk/compiler/gcc.mk
+++ b/mk/compiler/gcc.mk
@@ -117,7 +117,7 @@ _DEF_VARS.gcc=	\
 	_SSP_CFLAGS \
 	_CXX_STD_FLAG.c++03 _CXX_STD_FLAG.gnu++03
 _USE_VARS.gcc=	\
-	MACHINE_ARCH PATH DRAGONFLY_CCVER OPSYS LOCALBASE \
+	MACHINE_ARCH PATH DRAGONFLY_CCVER OPSYS TOOLBASE \
 	USE_LIBTOOL \
 	LIBABISUFFIX \
 	COMPILER_RPATH_FLAG \
@@ -244,7 +244,7 @@ _CXX_STD_FLAG.c++03=	-std=c++0x
 _CXX_STD_FLAG.gnu++03=	-std=gnu++0x
 .endif
 
-.if !empty(_CC:M${LOCALBASE}/*)
+.if !empty(_CC:M${TOOLBASE}/*)
 _IS_BUILTIN_GCC=	NO
 GCC_REQD+=		${_GCC_VERSION}
 .else
@@ -690,6 +690,8 @@ _COMPILER_RPATH_FLAG=	-Wl,${_LINKER_RPATH_FLAG}
 # Ensure that the correct rpath is passed to the linker if we need to
 # link against gcc shared libs.
 #
+# XXX cross-compilation -- is this TOOLBASE or LOCALBASE?
+#
 _GCC_SUBPREFIX!=	\
 	if ${PKG_INFO} -qe ${_GCC_PKGBASE}; then			\
 		${PKG_INFO} -f ${_GCC_PKGBASE} |			\
diff --git a/mk/compiler/gfortran.mk b/mk/compiler/gfortran.mk
index 46a0e69a6140..f1c24e59307b 100644
--- a/mk/compiler/gfortran.mk
+++ b/mk/compiler/gfortran.mk
@@ -91,7 +91,7 @@ _USE_GFORTRAN=	YES
 .endif
 
 .if !empty(_USE_GFORTRAN:M[yY][eE][sS])
-_GFORTRANBASE=	${LOCALBASE}/gcc${GFORTRAN_VERSION}
+_GFORTRANBASE=	${TOOLBASE}/gcc${GFORTRAN_VERSION}
 FC=		gfortran
 
 _GFORTRAN_DIR=	${WRKDIR}/.gfortran
diff --git a/mk/compiler/pcc.mk b/mk/compiler/pcc.mk
index 2b4d0a94b0b8..96ac9b649f53 100644
--- a/mk/compiler/pcc.mk
+++ b/mk/compiler/pcc.mk
@@ -18,7 +18,7 @@ COMPILER_PCC_MK=	defined
 
 .include "../../mk/bsd.prefs.mk"
 
-PCCBASE?=		${LOCALBASE}
+PCCBASE?=		${TOOLBASE}
 
 # common definitions
 _COMPILER_TYPE.c=	CC
diff --git a/mk/cwrappers.mk b/mk/cwrappers.mk
index 980051854319..128a301c2a25 100644
--- a/mk/cwrappers.mk
+++ b/mk/cwrappers.mk
@@ -7,8 +7,7 @@
 
 TOOL_DEPENDS+=		cwrappers>=20150314:../../pkgtools/cwrappers
 
-# XXX This should be PREFIX, but USE_CROSSBASE overrides it.
-CWRAPPERS_SRC_DIR=	${LOCALBASE}/libexec/cwrappers
+CWRAPPERS_SRC_DIR=	${TOOLBASE}/libexec/cwrappers
 CWRAPPERS_CONFIG_DIR=	${WRKDIR}/.cwrapper/config
 CONFIGURE_ENV+=		CWRAPPERS_CONFIG_DIR=${CWRAPPERS_CONFIG_DIR}
 MAKE_ENV+=		CWRAPPERS_CONFIG_DIR=${CWRAPPERS_CONFIG_DIR}
diff --git a/mk/pkgformat/pkg/package.mk b/mk/pkgformat/pkg/package.mk
index 1af91783d6a1..f67ff37d7b42 100644
--- a/mk/pkgformat/pkg/package.mk
+++ b/mk/pkgformat/pkg/package.mk
@@ -100,7 +100,7 @@ stage-package-remove:
 ### tarup is a public target to generate a binary package from an
 ### installed package instance.
 ###
-_PKG_TARUP_CMD= ${LOCALBASE}/bin/pkg_tarup
+_PKG_TARUP_CMD= ${TOOLBASE}/bin/pkg_tarup
 
 .PHONY: tarup
 tarup: package-remove tarup-pkg
diff --git a/mk/pkgformat/pkg/pkgformat-vars.mk b/mk/pkgformat/pkg/pkgformat-vars.mk
index c0d076dbefbe..06fd7afdfcbd 100644
--- a/mk/pkgformat/pkg/pkgformat-vars.mk
+++ b/mk/pkgformat/pkg/pkgformat-vars.mk
@@ -31,6 +31,13 @@ PKG_DELETE_CMD?=	${PKG_TOOLS_BIN}/pkg_delete
 PKG_INFO_CMD?=		${PKG_TOOLS_BIN}/pkg_info
 LINKFARM_CMD?=		${PKG_TOOLS_BIN}/linkfarm
 
+NATIVE_PKG_ADD_CMD?=		${NATIVE_PKG_TOOLS_BIN}/pkg_add
+NATIVE_PKG_ADMIN_CMD?=		${NATIVE_PKG_TOOLS_BIN}/pkg_admin
+NATIVE_PKG_CREATE_CMD?=		${NATIVE_PKG_TOOLS_BIN}/pkg_create
+NATIVE_PKG_DELETE_CMD?=		${NATIVE_PKG_TOOLS_BIN}/pkg_delete
+NATIVE_PKG_INFO_CMD?=		${NATIVE_PKG_TOOLS_BIN}/pkg_info
+NATIVE_LINKFARM_CMD?=		${NATIVE_PKG_TOOLS_BIN}/linkfarm
+
 # Latest versions of tools required for correct pkgsrc operation.
 .if !empty(USE_PKG_ADMIN_DIGEST:M[Yy][Ee][Ss])
 PKGTOOLS_REQD=		20191008
@@ -46,7 +53,7 @@ PKGTOOLS_VERSION_REQD=	20091115
 PKGTOOLS_ENV?=		# empty
 
 .if !defined(PKGTOOLS_VERSION)
-PKGTOOLS_VERSION!=	${PKG_INFO_CMD} -V 2>/dev/null || echo 20010302
+PKGTOOLS_VERSION!=	${NATIVE_PKG_INFO_CMD} -V 2>/dev/null || echo 20010302
 MAKEFLAGS+=		PKGTOOLS_VERSION=${PKGTOOLS_VERSION}
 .endif
 
@@ -69,19 +76,19 @@ _AUDIT_CONFIG_OPTION=	IGNORE_URL
 PKGTOOLS_ARGS?=		-K ${_PKG_DBDIR}
 HOST_PKGTOOLS_ARGS?=	-K ${_HOST_PKG_DBDIR}
 
-PKG_ADD?=	${PKG_ADD_CMD} ${PKGTOOLS_ARGS}
-PKG_ADMIN?=	${PKG_ADMIN_CMD} ${PKGTOOLS_ARGS}
-PKG_CREATE?=	${PKG_CREATE_CMD} ${PKGTOOLS_ARGS}
-PKG_DELETE?=	${PKG_DELETE_CMD} ${PKGTOOLS_ARGS}
-PKG_INFO?=	${PKG_INFO_CMD} ${PKGTOOLS_ARGS}
-LINKFARM?=	${LINKFARM_CMD}
-
-HOST_PKG_ADD?=		${PKG_ADD_CMD} ${HOST_PKGTOOLS_ARGS}
-HOST_PKG_ADMIN?=	${PKG_ADMIN_CMD} ${HOST_PKGTOOLS_ARGS}
-HOST_PKG_CREATE?=	${PKG_CREATE_CMD} ${HOST_PKGTOOLS_ARGS}
-HOST_PKG_DELETE?=	${PKG_DELETE_CMD} ${HOST_PKGTOOLS_ARGS}
-HOST_PKG_INFO?=		${PKG_INFO_CMD} ${HOST_PKGTOOLS_ARGS}
-HOST_LINKFARM?=		${LINKFARM_CMD}
+PKG_ADD?=	${NATIVE_PKG_ADD_CMD} ${PKGTOOLS_ARGS}
+PKG_ADMIN?=	${NATIVE_PKG_ADMIN_CMD} ${PKGTOOLS_ARGS}
+PKG_CREATE?=	${NATIVE_PKG_CREATE_CMD} ${PKGTOOLS_ARGS}
+PKG_DELETE?=	${NATIVE_PKG_DELETE_CMD} ${PKGTOOLS_ARGS}
+PKG_INFO?=	${NATIVE_PKG_INFO_CMD} ${PKGTOOLS_ARGS}
+LINKFARM?=	${NATIVE_LINKFARM_CMD}
+
+HOST_PKG_ADD?=		${NATIVE_PKG_ADD_CMD} ${HOST_PKGTOOLS_ARGS}
+HOST_PKG_ADMIN?=	${NATIVE_PKG_ADMIN_CMD} ${HOST_PKGTOOLS_ARGS}
+HOST_PKG_CREATE?=	${NATIVE_PKG_CREATE_CMD} ${HOST_PKGTOOLS_ARGS}
+HOST_PKG_DELETE?=	${NATIVE_PKG_DELETE_CMD} ${HOST_PKGTOOLS_ARGS}
+HOST_PKG_INFO?=		${NATIVE_PKG_INFO_CMD} ${HOST_PKGTOOLS_ARGS}
+HOST_LINKFARM?=		${NATIVE_LINKFARM_CMD}
 
 # "${_PKG_BEST_EXISTS} pkgpattern" prints out the name of the installed
 # package that best matches pkgpattern.  Use this instead of
diff --git a/mk/pkginstall/bsd.pkginstall.mk b/mk/pkginstall/bsd.pkginstall.mk
index 1c09486c0089..79d3eb37d894 100644
--- a/mk/pkginstall/bsd.pkginstall.mk
+++ b/mk/pkginstall/bsd.pkginstall.mk
@@ -1077,7 +1077,7 @@ FILES_SUBST+=		GTAR=${GTAR:Q}
 FILES_SUBST+=		HEAD=${HEAD:Q}
 FILES_SUBST+=		ID=${ID:Q}
 FILES_SUBST+=		INSTALL_INFO=${INSTALL_INFO:Q}
-FILES_SUBST+=		LINKFARM=${LINKFARM:Q}
+FILES_SUBST+=		LINKFARM=${LINKFARM_CMD:Q}
 FILES_SUBST+=		LN=${LN:Q}
 FILES_SUBST+=		LS=${LS:Q}
 FILES_SUBST+=		MKDIR=${MKDIR:Q}
diff --git a/mk/platform/NetBSD.mk b/mk/platform/NetBSD.mk
index e81689e2b34d..3fef968f8ae0 100644
--- a/mk/platform/NetBSD.mk
+++ b/mk/platform/NetBSD.mk
@@ -33,8 +33,9 @@ EXPORT_SYMBOLS_LDFLAGS?=-Wl,--export-dynamic
 MOTIF_TYPE_DEFAULT?=	motif	# default 2.0 compatible libs type
 NOLOGIN?=		/sbin/nologin
 # This must be lazy and using :? evaluation doesn't work due to a make bugs.
-PKG_TOOLS_BIN_cmd=	if [ -x ${LOCALBASE}/sbin/pkg_info ]; then echo ${LOCALBASE}/sbin; else echo /usr/sbin; fi
-PKG_TOOLS_BIN?=		${PKG_TOOLS_BIN_cmd:sh}
+NATIVE_PKG_TOOLS_BIN_cmd=	if [ -x ${TOOLBASE}/sbin/pkg_info ]; then echo ${TOOLBASE}/sbin; else echo /usr/sbin; fi
+NATIVE_PKG_TOOLS_BIN?=		${NATIVE_PKG_TOOLS_BIN_cmd:sh}
+PKG_TOOLS_BIN?=			${"${USE_CROSS_COMPILE:U:tl}" == "yes":?${CROSS_PKG_TOOLS_BIN:U/usr/sbin}:${NATIVE_PKG_TOOLS_BIN}}
 ROOT_CMD?=		${SU} - root -c
 ROOT_USER?=		root
 ROOT_GROUP?=	wheel
diff --git a/mk/tools/autoconf.mk b/mk/tools/autoconf.mk
index e2d2eb035993..8573af3670b5 100644
--- a/mk/tools/autoconf.mk
+++ b/mk/tools/autoconf.mk
@@ -108,25 +108,25 @@ ${_TOOLS_DEPMETHOD.autoconf}+=	${TOOLS_DEPENDS.autoconf}
 .    endif
 
 _TOOLS_AC_TYPE.autoconf=	TOOLS_CREATE
-TOOLS_PATH.autoconf=		${LOCALBASE}/bin/autoconf
+TOOLS_PATH.autoconf=		${TOOLBASE}/bin/autoconf
 
 _TOOLS_AC_TYPE.autoheader=	TOOLS_CREATE
-TOOLS_PATH.autoheader=		${LOCALBASE}/bin/autoheader
+TOOLS_PATH.autoheader=		${TOOLBASE}/bin/autoheader
 
 _TOOLS_AC_TYPE.autom4te=	TOOLS_CREATE
-TOOLS_PATH.autom4te=		${LOCALBASE}/bin/autom4te
+TOOLS_PATH.autom4te=		${TOOLBASE}/bin/autom4te
 
 _TOOLS_AC_TYPE.autoreconf=	TOOLS_CREATE
-TOOLS_PATH.autoreconf=		${LOCALBASE}/bin/autoreconf
+TOOLS_PATH.autoreconf=		${TOOLBASE}/bin/autoreconf
 
 _TOOLS_AC_TYPE.autoscan=	TOOLS_CREATE
-TOOLS_PATH.autoscan=		${LOCALBASE}/bin/autoscan
+TOOLS_PATH.autoscan=		${TOOLBASE}/bin/autoscan
 
 _TOOLS_AC_TYPE.autoupdate=	TOOLS_CREATE
-TOOLS_PATH.autoupdate=		${LOCALBASE}/bin/autoupdate
+TOOLS_PATH.autoupdate=		${TOOLBASE}/bin/autoupdate
 
 _TOOLS_AC_TYPE.ifnames=		TOOLS_CREATE
-TOOLS_PATH.ifnames=		${LOCALBASE}/bin/ifnames
+TOOLS_PATH.ifnames=		${TOOLBASE}/bin/ifnames
 .  endif
 .endif
 
@@ -150,32 +150,32 @@ ${_TOOLS_DEPMETHOD.autoconf213}+=	${TOOLS_DEPENDS.autoconf213}
 
 _TOOLS_AC_TYPE.autoconf-2.13=	TOOLS_CREATE
 _TOOLS_AC_TYPE.autoconf=	# empty
-TOOLS_PATH.autoconf-2.13=	${LOCALBASE}/bin/autoconf-2.13
+TOOLS_PATH.autoconf-2.13=	${TOOLBASE}/bin/autoconf-2.13
 TOOLS_ALIASES.autoconf-2.13=	autoconf
 
 _TOOLS_AC_TYPE.autoheader-2.13=	TOOLS_CREATE
 _TOOLS_AC_TYPE.autoheader=	# empty
-TOOLS_PATH.autoheader-2.13=	${LOCALBASE}/bin/autoheader-2.13
+TOOLS_PATH.autoheader-2.13=	${TOOLBASE}/bin/autoheader-2.13
 TOOLS_ALIASES.autoheader-2.13=	autoheader
 
 _TOOLS_AC_TYPE.autoreconf-2.13=	TOOLS_CREATE
 _TOOLS_AC_TYPE.autoreconf=	# empty
-TOOLS_PATH.autoreconf-2.13=	${LOCALBASE}/bin/autoreconf-2.13
+TOOLS_PATH.autoreconf-2.13=	${TOOLBASE}/bin/autoreconf-2.13
 TOOLS_ALIASES.autoreconf-2.13=	autoreconf
 
 _TOOLS_AC_TYPE.autoscan-2.13=	TOOLS_CREATE
 _TOOLS_AC_TYPE.autoscan=	# empty
-TOOLS_PATH.autoscan-2.13=	${LOCALBASE}/bin/autoscan-2.13
+TOOLS_PATH.autoscan-2.13=	${TOOLBASE}/bin/autoscan-2.13
 TOOLS_ALIASES.autoscan-2.13=	autoscan
 
 _TOOLS_AC_TYPE.autoupdate-2.13=	TOOLS_CREATE
 _TOOLS_AC_TYPE.autoupdate=	# empty
-TOOLS_PATH.autoupdate-2.13=	${LOCALBASE}/bin/autoupdate-2.13
+TOOLS_PATH.autoupdate-2.13=	${TOOLBASE}/bin/autoupdate-2.13
 TOOLS_ALIASES.autoupdate-2.13=	autoupdate
 
 _TOOLS_AC_TYPE.ifnames-2.13=	TOOLS_CREATE
 _TOOLS_AC_TYPE.ifnames=		# empty
-TOOLS_PATH.ifnames-2.13=	${LOCALBASE}/bin/ifnames-2.13
+TOOLS_PATH.ifnames-2.13=	${TOOLBASE}/bin/ifnames-2.13
 TOOLS_ALIASES.ifnames-2.13=	ifnames
 
 .    if defined(USE_LIBTOOL)
diff --git a/mk/tools/automake.mk b/mk/tools/automake.mk
index 9d3f8866ea8f..d9c7e9ef43b8 100644
--- a/mk/tools/automake.mk
+++ b/mk/tools/automake.mk
@@ -128,10 +128,10 @@ ${_TOOLS_DEPMETHOD.automake}+=	${TOOLS_DEPENDS.automake}
 .    endif
 
 _TOOLS_AM_TYPE.aclocal=		TOOLS_CREATE
-TOOLS_PATH.aclocal=		${LOCALBASE}/bin/aclocal
+TOOLS_PATH.aclocal=		${TOOLBASE}/bin/aclocal
 
 _TOOLS_AM_TYPE.automake=	TOOLS_CREATE
-TOOLS_PATH.automake=		${LOCALBASE}/bin/automake
+TOOLS_PATH.automake=		${TOOLBASE}/bin/automake
 .  endif
 .endif
 
@@ -156,12 +156,12 @@ ${_TOOLS_DEPMETHOD.automake14}+=	${TOOLS_DEPENDS.automake14}
 
 _TOOLS_AM_TYPE.aclocal-1.4=	TOOLS_CREATE
 _TOOLS_AM_TYPE.aclocal=		# empty
-TOOLS_PATH.aclocal-1.4=		${LOCALBASE}/bin/aclocal-1.4
+TOOLS_PATH.aclocal-1.4=		${TOOLBASE}/bin/aclocal-1.4
 TOOLS_ALIASES.aclocal-1.4=	aclocal
 
 _TOOLS_AM_TYPE.automake-1.4=	TOOLS_CREATE
 _TOOLS_AM_TYPE.automake=	# empty
-TOOLS_PATH.automake-1.4=	${LOCALBASE}/bin/automake-1.4
+TOOLS_PATH.automake-1.4=	${TOOLBASE}/bin/automake-1.4
 TOOLS_ALIASES.automake-1.4=	automake
 .  endif
 .endif
diff --git a/mk/tools/digest.mk b/mk/tools/digest.mk
index 1318f0403dff..096162875fdb 100644
--- a/mk/tools/digest.mk
+++ b/mk/tools/digest.mk
@@ -66,7 +66,7 @@ _TOOLS_USE_PKGSRC.digest=	yes
 .    if !empty(_TOOLS_USE_PKGSRC.digest:M[yY][eE][sS])
 TOOLS_DEPENDS.digest?=	digest>=${DIGEST_REQD}:../../pkgtools/digest
 TOOLS_CREATE+=		digest
-TOOLS_PATH.digest=	${LOCALBASE}/bin/digest
+TOOLS_PATH.digest=	${TOOLBASE}/bin/digest
 .    endif
 .  endif
 .endif
diff --git a/mk/tools/gettext.mk b/mk/tools/gettext.mk
index 6abfaaf4ca11..79cd34a4c95b 100644
--- a/mk/tools/gettext.mk
+++ b/mk/tools/gettext.mk
@@ -109,7 +109,7 @@ MAKEVARS+=	_TOOLS_USE_MSGFMT_SH
 .    if !empty(_TOOLS_USE_PKGSRC.msgfmt:M[yY][eE][sS])
 TOOLS_CREATE+=		msgfmt
 TOOLS_DEPENDS.msgfmt?=	${_TOOLS_DEP.gettext-tools}:../../devel/gettext-tools
-TOOLS_PATH.msgfmt=	${LOCALBASE}/bin/msgfmt
+TOOLS_PATH.msgfmt=	${TOOLBASE}/bin/msgfmt
 .    endif
 
 .    if !empty(_TOOLS_USE_MSGFMT_SH:M[yY][eE][sS])
@@ -138,7 +138,7 @@ MAKEFLAGS+=		TOOLS_IGNORE.${_t_}=
 .    elif !empty(_TOOLS_USE_PKGSRC.${_t_}:M[yY][eE][sS])
 TOOLS_DEPENDS.${_t_}?=	${_TOOLS_DEP.gettext-tools}:../../devel/gettext-tools
 TOOLS_CREATE+=		${_t_}
-TOOLS_PATH.${_t_}=	${LOCALBASE}/bin/${_t_}
+TOOLS_PATH.${_t_}=	${TOOLBASE}/bin/${_t_}
 .    endif
 .  endif
 .endfor
diff --git a/mk/tools/gmake.mk b/mk/tools/gmake.mk
index 4c04d06b9572..809571a13d32 100644
--- a/mk/tools/gmake.mk
+++ b/mk/tools/gmake.mk
@@ -59,7 +59,7 @@ MAKEVARS+=	_TOOLS_USE_PKGSRC.gmake
 
 .if defined(_TOOLS_USE_PKGSRC.gmake) && !empty(_TOOLS_USE_PKGSRC.gmake)
 .  if !empty(_TOOLS_USE_PKGSRC.gmake:M[yY][eE][sS])
-TOOLS_PLATFORM.gmake=	${LOCALBASE}/bin/gmake
+TOOLS_PLATFORM.gmake=	${TOOLBASE}/bin/gmake
 .  endif
 .endif
 
diff --git a/mk/tools/intltool.mk b/mk/tools/intltool.mk
index 745c149241ff..36e7db6f19a9 100644
--- a/mk/tools/intltool.mk
+++ b/mk/tools/intltool.mk
@@ -49,7 +49,7 @@ TOOL_DEPENDS+=		${TOOLS_DEPENDS.intltool}
 .    for _t_ in ${_TOOLS.intltool}
 TOOLS_DEPENDS.${_t_}=	${TOOLS_DEPENDS.intltool}
 TOOLS_CREATE+=		${_t_}
-TOOLS_PATH.${_t_}=	${LOCALBASE}/bin/${_t_}
+TOOLS_PATH.${_t_}=	${TOOLBASE}/bin/${_t_}
 .    endfor
 .  endif
 .elif defined(GNU_CONFIGURE)
diff --git a/mk/tools/perl.mk b/mk/tools/perl.mk
index 9fe5e9a91c0d..1ea9d114859b 100644
--- a/mk/tools/perl.mk
+++ b/mk/tools/perl.mk
@@ -61,7 +61,7 @@ TOOLS_PATH.perl=	${TOOLS_CMD.perl}
 .  if defined(TOOLS_PLATFORM.perl) && !empty(TOOLS_PLATFORM.perl)
 TOOLS_${_TOOLS_VARNAME.perl}?=	${TOOLS_PLATFORM.perl}
 .  else
-TOOLS_${_TOOLS_VARNAME.perl}?=	${LOCALBASE}/bin/perl
+TOOLS_${_TOOLS_VARNAME.perl}?=	${TOOLBASE}/bin/perl
 .  endif
 .  if !defined(${_TOOLS_VARNAME.perl})
 ${_TOOLS_VARNAME.perl}?=	${TOOLS_${_TOOLS_VARNAME.perl}}
diff --git a/mk/tools/replace.mk b/mk/tools/replace.mk
index b52c503cef0b..9859743f86eb 100644
--- a/mk/tools/replace.mk
+++ b/mk/tools/replace.mk
@@ -209,7 +209,7 @@ MAKEFLAGS+=			TOOLS_IGNORE.zstd=
 .  elif !empty(_TOOLS_USE_PKGSRC.zstd:M[yY][eE][sS])
 TOOLS_DEPENDS.zstd?=		zstd>=1.5.0:../../archivers/zstd
 TOOLS_CREATE+=			zstd
-TOOLS_PATH.zstd=		${LOCALBASE}/bin/zstd
+TOOLS_PATH.zstd=		${TOOLBASE}/bin/zstd
 .  endif
 .endif
 
@@ -219,7 +219,7 @@ MAKEFLAGS+=			TOOLS_IGNORE.7za=
 .  elif !empty(_TOOLS_USE_PKGSRC.7za:M[yY][eE][sS])
 TOOLS_DEPENDS.7za?=		p7zip>=9.04:../../archivers/p7zip
 TOOLS_CREATE+=			7za
-TOOLS_PATH.7za=			${LOCALBASE}/bin/7za
+TOOLS_PATH.7za=			${TOOLBASE}/bin/7za
 .  endif
 .endif
 
@@ -229,7 +229,7 @@ MAKEFLAGS+=			TOOLS_IGNORE.awk=
 .  elif !empty(_TOOLS_USE_PKGSRC.awk:M[yY][eE][sS])
 TOOLS_DEPENDS.awk?=		nawk>=20040207:../../lang/nawk
 TOOLS_CREATE+=			awk
-TOOLS_PATH.awk=			${LOCALBASE}/bin/nawk
+TOOLS_PATH.awk=			${TOOLBASE}/bin/nawk
 .  endif
 .endif
 
@@ -239,7 +239,7 @@ MAKEFLAGS+=			TOOLS_IGNORE.bash=
 .  elif !empty(_TOOLS_USE_PKGSRC.bash:M[yY][eE][sS])
 TOOLS_DEPENDS.bash?=		bash-[0-9]*:../../shells/bash
 TOOLS_CREATE+=			bash
-TOOLS_PATH.bash=		${LOCALBASE}/bin/bash
+TOOLS_PATH.bash=		${TOOLBASE}/bin/bash
 .  endif
 .endif
 
@@ -249,7 +249,7 @@ MAKEFLAGS+=			TOOLS_IGNORE.bison=
 .  elif !empty(_TOOLS_USE_PKGSRC.bison:M[yY][eE][sS])
 TOOLS_DEPENDS.bison?=		bison>=1.0:../../devel/bison
 TOOLS_CREATE+=			bison
-TOOLS_PATH.bison=		${LOCALBASE}/bin/bison
+TOOLS_PATH.bison=		${TOOLBASE}/bin/bison
 .  endif
 .endif
 
@@ -259,7 +259,7 @@ MAKEFLAGS+=			TOOLS_IGNORE.bison-yacc=
 .  elif !empty(_TOOLS_USE_PKGSRC.bison-yacc:M[yY][eE][sS])
 TOOLS_DEPENDS.bison-yacc?=	bison>=1.0:../../devel/bison
 TOOLS_CREATE+=			bison-yacc
-TOOLS_PATH.bison-yacc=		${LOCALBASE}/bin/bison
+TOOLS_PATH.bison-yacc=		${TOOLBASE}/bin/bison
 TOOLS_ARGS.bison-yacc=		-y
 .  endif
 TOOLS_CMD.bison-yacc=		${TOOLS_DIR}/bin/yacc
@@ -278,7 +278,7 @@ MAKEFLAGS+=			TOOLS_IGNORE.bsdtar=
 .  elif !empty(_TOOLS_USE_PKGSRC.bsdtar:M[yY][eE][sS])
 TOOLS_DEPENDS.bsdtar?=		bsdtar-[0-9]*:../../archivers/bsdtar
 TOOLS_CREATE+=			bsdtar
-TOOLS_PATH.bsdtar=		${LOCALBASE}/bin/bsdtar
+TOOLS_PATH.bsdtar=		${TOOLBASE}/bin/bsdtar
 .  endif
 .endif
 
@@ -288,7 +288,7 @@ MAKEFLAGS+=			TOOLS_IGNORE.byacc=
 .  elif !empty(_TOOLS_USE_PKGSRC.byacc:M[yY][eE][sS])
 TOOLS_DEPENDS.byacc?=		byacc>=20040328:../../devel/byacc
 TOOLS_CREATE+=			byacc
-TOOLS_PATH.byacc=		${LOCALBASE}/bin/yacc
+TOOLS_PATH.byacc=		${TOOLBASE}/bin/yacc
 TOOLS_CMD.byacc=		${TOOLS_DIR}/bin/yacc
 .  endif
 .endif
@@ -301,7 +301,7 @@ MAKEFLAGS+=			TOOLS_IGNORE.${_t_}=
 .    elif !empty(_TOOLS_USE_PKGSRC.${_t_}:M[yY][eE][sS])
 TOOLS_DEPENDS.${_t_}?=		bzip2>=0.9.0b:../../archivers/bzip2
 TOOLS_CREATE+=			${_t_}
-TOOLS_PATH.${_t_}=		${LOCALBASE}/bin/${_t_}
+TOOLS_PATH.${_t_}=		${TOOLBASE}/bin/${_t_}
 .    endif
 .  endif
 .endfor
@@ -312,7 +312,7 @@ MAKEFLAGS+=			TOOLS_IGNORE.chrpath=
 .  elif !empty(_TOOLS_USE_PKGSRC.chrpath:M[yY][eE][sS])
 TOOLS_DEPENDS.chrpath?=		chrpath>=0.13:../../devel/chrpath
 TOOLS_CREATE+=			chrpath
-TOOLS_PATH.chrpath=		${LOCALBASE}/bin/chrpath
+TOOLS_PATH.chrpath=		${TOOLBASE}/bin/chrpath
 .  endif
 .endif
 
@@ -324,7 +324,7 @@ MAKEFLAGS+=			TOOLS_IGNORE.${_t_}=
 .    elif !empty(_TOOLS_USE_PKGSRC.${_t_}:M[yY][eE][sS])
 TOOLS_DEPENDS.${_t_}?=		cmake>=2.8.1nb1:../../devel/cmake
 TOOLS_CREATE+=			${_t_}
-TOOLS_PATH.${_t_}=		${LOCALBASE}/bin/${_t_}
+TOOLS_PATH.${_t_}=		${TOOLBASE}/bin/${_t_}
 .    endif
 .  endif
 .endfor
@@ -335,7 +335,7 @@ MAKEFLAGS+=			TOOLS_IGNORE.csh=
 .  elif !empty(_TOOLS_USE_PKGSRC.csh:M[yY][eE][sS])
 TOOLS_DEPENDS.csh?=		tcsh-[0-9]*:../../shells/tcsh
 TOOLS_CREATE+=			csh
-TOOLS_PATH.csh=			${LOCALBASE}/bin/tcsh
+TOOLS_PATH.csh=			${TOOLBASE}/bin/tcsh
 .  endif
 .endif
 
@@ -344,7 +344,7 @@ TOOLS_PATH.csh=			${LOCALBASE}/bin/tcsh
 MAKEFLAGS+=			TOOLS_IGNORE.curl=
 .  elif !empty(_TOOLS_USE_PKGSRC.curl:M[yY][eE][sS])
 TOOLS_DEPENDS.curl?=		curl-[0-9]*:../../www/curl
-TOOLS_PATH.curl=		${LOCALBASE}/bin/curl
+TOOLS_PATH.curl=		${TOOLBASE}/bin/curl
 .  endif
 .endif
 
@@ -353,7 +353,7 @@ TOOLS_PATH.curl=		${LOCALBASE}/bin/curl
 MAKEFLAGS+=			TOOLS_IGNORE.fetch=
 .  elif !empty(_TOOLS_USE_PKGSRC.fetch:M[yY][eE][sS])
 TOOLS_DEPENDS.fetch?=		fetch-[0-9]*:../../net/fetch
-TOOLS_PATH.fetch=		${LOCALBASE}/bin/fetch
+TOOLS_PATH.fetch=		${TOOLBASE}/bin/fetch
 .  endif
 .endif
 
@@ -363,7 +363,7 @@ MAKEFLAGS+=			TOOLS_IGNORE.file=
 .  elif !empty(_TOOLS_USE_PKGSRC.file:M[yY][eE][sS])
 TOOLS_DEPENDS.file?=		file>=4.13:../../sysutils/file
 TOOLS_CREATE+=			file
-TOOLS_PATH.file=		${LOCALBASE}/bin/file
+TOOLS_PATH.file=		${TOOLBASE}/bin/file
 .  endif
 .endif
 
@@ -373,7 +373,7 @@ MAKEFLAGS+=			TOOLS_IGNORE.find=
 .  elif !empty(_TOOLS_USE_PKGSRC.find:M[yY][eE][sS])
 TOOLS_DEPENDS.find?=		findutils>=4.1:../../sysutils/findutils
 TOOLS_CREATE+=			find
-TOOLS_PATH.find=		${LOCALBASE}/bin/gfind
+TOOLS_PATH.find=		${TOOLBASE}/bin/gfind
 .  endif
 .endif
 
@@ -388,7 +388,7 @@ _TOOLS_DEPENDS.flex+=		${_dep_}:${BUILDLINK_PKGSRCDIR.flex}
 .    endfor
 TOOLS_DEPENDS.flex?=		${_TOOLS_DEPENDS.flex}
 TOOLS_CREATE+=			flex
-TOOLS_PATH.flex=		${LOCALBASE}/bin/flex
+TOOLS_PATH.flex=		${TOOLBASE}/bin/flex
 .  endif
 TOOLS_ALIASES.flex=		lex
 .endif
@@ -398,7 +398,7 @@ TOOLS_ALIASES.flex=		lex
 MAKEFLAGS+=			TOOLS_IGNORE.ftp=
 .  elif !empty(_TOOLS_USE_PKGSRC.ftp:M[yY][eE][sS])
 TOOLS_DEPENDS.ftp?=		tnftp-[0-9]*:../../net/tnftp
-TOOLS_PATH.ftp=			${LOCALBASE}/bin/ftp
+TOOLS_PATH.ftp=			${TOOLBASE}/bin/ftp
 .  endif
 .endif
 
@@ -408,7 +408,7 @@ MAKEFLAGS+=			TOOLS_IGNORE.gawk=
 .  elif !empty(_TOOLS_USE_PKGSRC.gawk:M[yY][eE][sS])
 TOOLS_DEPENDS.gawk?=		gawk>=3.1.1:../../lang/gawk
 TOOLS_CREATE+=			gawk
-TOOLS_PATH.gawk=		${LOCALBASE}/bin/gawk
+TOOLS_PATH.gawk=		${TOOLBASE}/bin/gawk
 .  endif
 TOOLS_ALIASES.gawk=		awk
 .endif
@@ -417,7 +417,7 @@ TOOLS_ALIASES.gawk=		awk
 .  if !empty(_TOOLS_USE_PKGSRC.gem:M[yY][eE][sS])
 TOOLS_DEPENDS.gem?=		${RUBY_BASE}>=${RUBY_VERSION}:${RUBY_SRCDIR}
 TOOLS_CREATE+=			gem
-TOOLS_PATH.gem=			${LOCALBASE}/bin/gem${RUBY_SUFFIX}
+TOOLS_PATH.gem=			${TOOLBASE}/bin/gem${RUBY_SUFFIX}
 .  endif
 .endif
 
@@ -427,7 +427,7 @@ MAKEFLAGS+=			TOOLS_IGNORE.gm4=
 .  elif !empty(_TOOLS_USE_PKGSRC.gm4:M[yY][eE][sS])
 TOOLS_DEPENDS.gm4?=		m4>=1.4:../../devel/m4
 TOOLS_CREATE+=			gm4
-TOOLS_PATH.gm4=			${LOCALBASE}/bin/gm4
+TOOLS_PATH.gm4=			${TOOLBASE}/bin/gm4
 .  endif
 TOOLS_ALIASES.gm4=		m4
 .endif
@@ -438,7 +438,7 @@ MAKEFLAGS+=			TOOLS_IGNORE.gmake=
 .  elif !empty(_TOOLS_USE_PKGSRC.gmake:M[yY][eE][sS])
 TOOLS_DEPENDS.gmake?=		gmake>=${GMAKE_REQD}:../../devel/gmake
 TOOLS_CREATE+=			gmake
-TOOLS_PATH.gmake=		${LOCALBASE}/bin/gmake
+TOOLS_PATH.gmake=		${TOOLBASE}/bin/gmake
 .  endif
 .endif
 
@@ -448,7 +448,7 @@ MAKEFLAGS+=			TOOLS_IGNORE.gsed=
 .  elif !empty(_TOOLS_USE_PKGSRC.gsed:M[yY][eE][sS])
 TOOLS_DEPENDS.gsed?=		gsed>=3.0.2:../../textproc/gsed
 TOOLS_CREATE+=			gsed
-TOOLS_PATH.gsed=		${LOCALBASE}/bin/gsed
+TOOLS_PATH.gsed=		${TOOLBASE}/bin/gsed
 .  endif
 TOOLS_ALIASES.gsed=		sed
 .endif
@@ -459,7 +459,7 @@ MAKEFLAGS+=			TOOLS_IGNORE.gtar=
 .  elif !empty(_TOOLS_USE_PKGSRC.gtar:M[yY][eE][sS])
 TOOLS_DEPENDS.gtar?=		gtar-base>=1.13.25:../../archivers/gtar-base
 TOOLS_CREATE+=			gtar
-TOOLS_PATH.gtar=		${LOCALBASE}/bin/gtar
+TOOLS_PATH.gtar=		${TOOLBASE}/bin/gtar
 .  endif
 .endif
 
@@ -469,7 +469,7 @@ MAKEFLAGS+=			TOOLS_IGNORE.gunzip=
 .  elif !empty(_TOOLS_USE_PKGSRC.gunzip:M[yY][eE][sS])
 TOOLS_DEPENDS.gunzip?=		{gzip>=1.2.4b,gzip-base>=1.2.4b}:../../archivers/gzip
 TOOLS_CREATE+=			gunzip
-TOOLS_PATH.gunzip=		${LOCALBASE}/bin/gunzip
+TOOLS_PATH.gunzip=		${TOOLBASE}/bin/gunzip
 TOOLS_ARGS.gunzip=		-f
 .  endif
 .endif
@@ -480,7 +480,7 @@ MAKEFLAGS+=			TOOLS_IGNORE.gzcat=
 .  elif !empty(_TOOLS_USE_PKGSRC.gzcat:M[yY][eE][sS])
 TOOLS_DEPENDS.gzcat?=		{gzip>=1.2.4b,gzip-base>=1.2.4b}:../../archivers/gzip
 TOOLS_CREATE+=			gzcat
-TOOLS_PATH.gzcat=		${LOCALBASE}/bin/zcat
+TOOLS_PATH.gzcat=		${TOOLBASE}/bin/zcat
 .  endif
 .endif
 
@@ -490,7 +490,7 @@ MAKEFLAGS+=			TOOLS_IGNORE.gzip=
 .  elif !empty(_TOOLS_USE_PKGSRC.gzip:M[yY][eE][sS])
 TOOLS_DEPENDS.gzip?=		{gzip>=1.2.4b,gzip-base>=1.2.4b}:../../archivers/gzip
 TOOLS_CREATE+=			gzip
-TOOLS_PATH.gzip=		${LOCALBASE}/bin/gzip
+TOOLS_PATH.gzip=		${TOOLBASE}/bin/gzip
 TOOLS_ARGS.gzip=		-nf ${GZIP}
 .  endif
 .endif
@@ -501,7 +501,7 @@ MAKEFLAGS+=			TOOLS_IGNORE.ident=
 .  elif !empty(_TOOLS_USE_PKGSRC.ident:M[yY][eE][sS])
 TOOLS_DEPENDS.ident?=		rcs-[0-9]*:../../devel/rcs
 TOOLS_CREATE+=			ident
-TOOLS_PATH.ident=		${LOCALBASE}/bin/ident
+TOOLS_PATH.ident=		${TOOLBASE}/bin/ident
 .  endif
 .endif
 
@@ -511,7 +511,7 @@ MAKEFLAGS+=			TOOLS_IGNORE.install-info=
 .  elif !empty(_TOOLS_USE_PKGSRC.install-info:M[yY][eE][sS])
 TOOLS_DEPENDS.install-info?=	pkg_install-info-[0-9]*:../../pkgtools/pkg_install-info
 TOOLS_CREATE+=			install-info
-TOOLS_PATH.install-info=	${LOCALBASE}/bin/pkg_install-info
+TOOLS_PATH.install-info=	${TOOLBASE}/bin/pkg_install-info
 .  endif
 .endif
 #
@@ -526,7 +526,7 @@ MAKEFLAGS+=			TOOLS_IGNORE.ksh=
 .  elif !empty(_TOOLS_USE_PKGSRC.ksh:M[yY][eE][sS])
 TOOLS_DEPENDS.ksh?=		pdksh>=5.2.14:../../shells/pdksh
 TOOLS_CREATE+=			ksh
-TOOLS_PATH.ksh=			${LOCALBASE}/bin/pdksh
+TOOLS_PATH.ksh=			${TOOLBASE}/bin/pdksh
 .  endif
 .endif
 
@@ -541,7 +541,7 @@ _TOOLS_DEPENDS.lex+=		${_dep_}:${BUILDLINK_PKGSRCDIR.flex}
 .    endfor
 TOOLS_DEPENDS.lex?=		${_TOOLS_DEPENDS.lex}
 TOOLS_CREATE+=			lex
-TOOLS_PATH.lex=			${LOCALBASE}/bin/flex
+TOOLS_PATH.lex=			${TOOLBASE}/bin/flex
 .  endif
 .endif
 
@@ -551,7 +551,7 @@ MAKEFLAGS+=			TOOLS_IGNORE.lha=
 .  elif !empty(_TOOLS_USE_PKGSRC.lha:M[yY][eE][sS])
 TOOLS_DEPENDS.lha?=		lha>=114.9:../../archivers/lha
 TOOLS_CREATE+=			lha
-TOOLS_PATH.lha=			${LOCALBASE}/bin/lha
+TOOLS_PATH.lha=			${TOOLBASE}/bin/lha
 .  endif
 .endif
 
@@ -561,7 +561,7 @@ MAKEFLAGS+=			TOOLS_IGNORE.lzip=
 .  elif !empty(_TOOLS_USE_PKGSRC.lzip:M[yY][eE][sS])
 TOOLS_DEPENDS.lzip?=		lzip>=1.14:../../archivers/lzip
 TOOLS_CREATE+=			lzip
-TOOLS_PATH.lzip=		${LOCALBASE}/bin/lzip
+TOOLS_PATH.lzip=		${TOOLBASE}/bin/lzip
 .  endif
 .endif
 
@@ -571,7 +571,7 @@ MAKEFLAGS+=			TOOLS_IGNORE.lzcat=
 .  elif !empty(_TOOLS_USE_PKGSRC.lzcat:M[yY][eE][sS])
 TOOLS_DEPENDS.lzcat?=		xz>=4.999.9betanb1:../../archivers/xz
 TOOLS_CREATE+=			lzcat
-TOOLS_PATH.lzcat=		${LOCALBASE}/bin/lzcat
+TOOLS_PATH.lzcat=		${TOOLBASE}/bin/lzcat
 .  endif
 .endif
 
@@ -581,7 +581,7 @@ MAKEFLAGS+=			TOOLS_IGNORE.m4=
 .  elif !empty(_TOOLS_USE_PKGSRC.m4:M[yY][eE][sS])
 TOOLS_DEPENDS.m4?=		m4>=1.4:../../devel/m4
 TOOLS_CREATE+=			m4
-TOOLS_PATH.m4=			${LOCALBASE}/bin/gm4
+TOOLS_PATH.m4=			${TOOLBASE}/bin/gm4
 .  endif
 .endif
 
@@ -591,7 +591,7 @@ MAKEFLAGS+=			TOOLS_IGNORE.mail=
 .  elif !empty(_TOOLS_USE_PKGSRC.mail:M[yY][eE][sS])
 TOOLS_DEPENDS.mail?=		heirloom-mailx-[0-9]*:../../mail/heirloom-mailx
 TOOLS_CREATE+=			mail
-TOOLS_PATH.mail=		${LOCALBASE}/bin/mailx
+TOOLS_PATH.mail=		${TOOLBASE}/bin/mailx
 .  endif
 .endif
 
@@ -601,7 +601,7 @@ MAKEFLAGS+=			TOOLS_IGNORE.makeinfo=
 .  elif !empty(_TOOLS_USE_PKGSRC.makeinfo:M[yY][eE][sS])
 TOOLS_DEPENDS.makeinfo?=	gtexinfo>=${TEXINFO_REQD}:../../devel/gtexinfo
 TOOLS_CREATE+=			makeinfo
-TOOLS_PATH.makeinfo=		${LOCALBASE}/bin/makeinfo
+TOOLS_PATH.makeinfo=		${TOOLBASE}/bin/makeinfo
 .  endif
 .endif
 
@@ -611,7 +611,7 @@ MAKEFLAGS+=			TOOLS_IGNORE.mktemp=
 .  elif !empty(_TOOLS_USE_PKGSRC.mktemp:M[yY][eE][sS])
 TOOLS_DEPENDS.mktemp?=		mktemp>=1.5:../../sysutils/mktemp
 TOOLS_CREATE+=			mktemp
-TOOLS_PATH.mktemp=		${LOCALBASE}/bin/mktemp
+TOOLS_PATH.mktemp=		${TOOLBASE}/bin/mktemp
 .  endif
 .endif
 
@@ -625,7 +625,7 @@ MAKEFLAGS+=			TOOLS_IGNORE.mtree=
 #
 TOOLS_DEPENDS.mtree?=		mtree>=20040722:../../pkgtools/mtree
 TOOLS_CREATE+=			mtree
-TOOLS_PATH.mtree=		${LOCALBASE}/bin/mtree
+TOOLS_PATH.mtree=		${TOOLBASE}/bin/mtree
 .  endif
 .endif
 
@@ -644,7 +644,7 @@ MAKEFLAGS+=			TOOLS_IGNORE.openssl=
 .  elif !empty(_TOOLS_USE_PKGSRC.openssl:M[yY][eE][sS])
 TOOLS_DEPENDS.openssl?=		openssl>=0.9.6:../../security/openssl
 TOOLS_CREATE+=			openssl
-TOOLS_PATH.openssl=		${LOCALBASE}/bin/openssl
+TOOLS_PATH.openssl=		${TOOLBASE}/bin/openssl
 .  endif
 .endif
 
@@ -654,7 +654,7 @@ MAKEFLAGS+=			TOOLS_IGNORE.patch=
 .  elif !empty(_TOOLS_USE_PKGSRC.patch:M[yY][eE][sS])
 TOOLS_DEPENDS.patch?=		nbpatch-[0-9]*:../../devel/nbpatch
 TOOLS_CREATE+=			patch
-TOOLS_PATH.patch=		${LOCALBASE}/bin/nbpatch
+TOOLS_PATH.patch=		${TOOLBASE}/bin/nbpatch
 _PATCH_CAN_BACKUP=		yes
 _PATCH_BACKUP_ARG=		-V simple -z
 .  endif
@@ -666,7 +666,7 @@ MAKEFLAGS+=			TOOLS_IGNORE.pax=
 .  elif !empty(_TOOLS_USE_PKGSRC.pax:M[yY][eE][sS])
 TOOLS_DEPENDS.pax?=		pax>=20040802:../../archivers/pax
 TOOLS_CREATE+=			pax
-TOOLS_PATH.pax=			${LOCALBASE}/bin/${NBPAX_PROGRAM_PREFIX}pax
+TOOLS_PATH.pax=			${TOOLBASE}/bin/${NBPAX_PROGRAM_PREFIX}pax
 .  endif
 .endif
 
@@ -676,7 +676,7 @@ MAKEFLAGS+=			TOOLS_IGNORE.pkg-config=
 .  elif !empty(_TOOLS_USE_PKGSRC.pkg-config:M[yY][eE][sS])
 TOOLS_DEPENDS.pkg-config?=	pkgconf-[0-9]*:../../devel/pkgconf
 TOOLS_CREATE+=			pkg-config
-TOOLS_PATH.pkg-config=		${LOCALBASE}/bin/pkg-config
+TOOLS_PATH.pkg-config=		${TOOLBASE}/bin/pkg-config
 .  else
 AUTORECONF_ARGS+=		-I ${TOOLS_PLATFORM.pkg-config:S/\/bin\/pkg-config//}/share/aclocal
 .  endif
@@ -694,7 +694,7 @@ MAKEFLAGS+=			TOOLS_IGNORE.rpm2pkg=
 .  elif !empty(_TOOLS_USE_PKGSRC.rpm2pkg:M[yY][eE][sS])
 TOOLS_DEPENDS.rpm2pkg?=		rpm2pkg>=3.1.4:../../pkgtools/rpm2pkg
 TOOLS_CREATE+=			rpm2pkg
-TOOLS_PATH.rpm2pkg=		${LOCALBASE}/sbin/rpm2pkg
+TOOLS_PATH.rpm2pkg=		${TOOLBASE}/sbin/rpm2pkg
 .  endif
 .endif
 
@@ -704,7 +704,7 @@ MAKEFLAGS+=			TOOLS_IGNORE.sed=
 .  elif !empty(_TOOLS_USE_PKGSRC.sed:M[yY][eE][sS])
 TOOLS_DEPENDS.sed?=		nbsed>=20040821:../../textproc/nbsed
 TOOLS_CREATE+=			sed
-TOOLS_PATH.sed=			${LOCALBASE}/bin/nbsed
+TOOLS_PATH.sed=			${TOOLBASE}/bin/nbsed
 .  endif
 .endif
 
@@ -714,7 +714,7 @@ MAKEFLAGS+=			TOOLS_IGNORE.sh=
 .  elif !empty(_TOOLS_USE_PKGSRC.sh:M[yY][eE][sS])
 TOOLS_DEPENDS.sh?=		pdksh>=5.2.14:../../shells/pdksh
 TOOLS_CREATE+=			sh
-TOOLS_PATH.sh=			${LOCALBASE}/bin/pdksh
+TOOLS_PATH.sh=			${TOOLBASE}/bin/pdksh
 .  endif
 TOOLS_CMD.sh=			${TOOLS_DIR}/bin/sh
 .endif
@@ -725,7 +725,7 @@ MAKEFLAGS+=			TOOLS_IGNORE.shlock=
 .  elif !empty(_TOOLS_USE_PKGSRC.shlock:M[yY][eE][sS])
 TOOLS_DEPENDS.shlock?=		shlock>=20020114:../../pkgtools/shlock
 TOOLS_CREATE+=			shlock
-TOOLS_PATH.shlock=		${LOCALBASE}/bin/shlock
+TOOLS_PATH.shlock=		${TOOLBASE}/bin/shlock
 .  endif
 .endif
 
@@ -735,7 +735,7 @@ MAKEFLAGS+=			TOOLS_IGNORE.tar=
 .  elif !empty(_TOOLS_USE_PKGSRC.tar:M[yY][eE][sS])
 TOOLS_DEPENDS.tar?=		pax>=20040802:../../archivers/pax
 TOOLS_CREATE+=			tar
-TOOLS_PATH.tar=			${LOCALBASE}/bin/${NBPAX_PROGRAM_PREFIX}tar
+TOOLS_PATH.tar=			${TOOLBASE}/bin/${NBPAX_PROGRAM_PREFIX}tar
 .  endif
 .endif
 
@@ -745,7 +745,7 @@ MAKEFLAGS+=			TOOLS_IGNORE.tclsh=
 .  elif !empty(_TOOLS_USE_PKGSRC.tclsh:M[yY][eE][sS])
 TOOLS_DEPENDS.tclsh?=		tcl>=8.4:../../lang/tcl
 TOOLS_CREATE+=			tclsh
-TOOLS_PATH.tclsh=		${LOCALBASE}/bin/tclsh
+TOOLS_PATH.tclsh=		${TOOLBASE}/bin/tclsh
 .  endif
 .endif
 
@@ -755,7 +755,7 @@ MAKEFLAGS+=			TOOLS_IGNORE.texi2html=
 .  elif !empty(_TOOLS_USE_PKGSRC.texi2html:M[yY][eE][sS])
 TOOLS_DEPENDS.texi2html?=	texi2html>=1.76:../../textproc/texi2html
 TOOLS_CREATE+=			texi2html
-TOOLS_PATH.texi2html=		${LOCALBASE}/bin/texi2html
+TOOLS_PATH.texi2html=		${TOOLBASE}/bin/texi2html
 .  endif
 .endif
 
@@ -765,7 +765,7 @@ MAKEFLAGS+=			TOOLS_IGNORE.ttmkfdir=
 .  elif !empty(_TOOLS_USE_PKGSRC.ttmkfdir:M[yY][eE][sS])
 TOOLS_DEPENDS.ttmkfdir?=	ttmkfdir2>=20021109:../../fonts/ttmkfdir2
 TOOLS_CREATE+=			ttmkfdir
-TOOLS_PATH.ttmkfdir=		${LOCALBASE}/bin/ttmkfdir
+TOOLS_PATH.ttmkfdir=		${TOOLBASE}/bin/ttmkfdir
 .  endif
 .endif
 
@@ -775,7 +775,7 @@ MAKEFLAGS+=			TOOLS_IGNORE.type1inst=
 .  elif !empty(_TOOLS_USE_PKGSRC.type1inst:M[yY][eE][sS])
 TOOLS_DEPENDS.type1inst?=	type1inst>=0.6.1:../../fonts/type1inst
 TOOLS_CREATE+=			type1inst
-TOOLS_PATH.type1inst=		${LOCALBASE}/bin/type1inst
+TOOLS_PATH.type1inst=		${TOOLBASE}/bin/type1inst
 .  endif
 .endif
 
@@ -785,7 +785,7 @@ MAKEFLAGS+=			TOOLS_IGNORE.unrar=
 .  elif !empty(_TOOLS_USE_PKGSRC.unrar:M[yY][eE][sS])
 TOOLS_DEPENDS.unrar?=		unrar>=3.3.4:../../archivers/unrar
 TOOLS_CREATE+=			unrar
-TOOLS_PATH.unrar=		${LOCALBASE}/bin/unrar
+TOOLS_PATH.unrar=		${TOOLBASE}/bin/unrar
 .  endif
 .endif
 
@@ -795,7 +795,7 @@ MAKEFLAGS+=			TOOLS_IGNORE.unzip=
 .  elif !empty(_TOOLS_USE_PKGSRC.unzip:M[yY][eE][sS])
 TOOLS_DEPENDS.unzip?=		unzip-[0-9]*:../../archivers/unzip
 TOOLS_CREATE+=			unzip
-TOOLS_PATH.unzip=		${LOCALBASE}/bin/unzip
+TOOLS_PATH.unzip=		${TOOLBASE}/bin/unzip
 .  endif
 .endif
 
@@ -805,7 +805,7 @@ MAKEFLAGS+=			TOOLS_IGNORE.unzoo=
 .  elif !empty(_TOOLS_USE_PKGSRC.unzoo:M[yY][eE][sS])
 TOOLS_DEPENDS.unzoo?=		unzoo-[0-9]*:../../archivers/unzoo
 TOOLS_CREATE+=			unzoo
-TOOLS_PATH.unzoo=		${LOCALBASE}/bin/unzoo
+TOOLS_PATH.unzoo=		${TOOLBASE}/bin/unzoo
 .  endif
 .endif
 
@@ -814,7 +814,7 @@ TOOLS_PATH.unzoo=		${LOCALBASE}/bin/unzoo
 MAKEFLAGS+=			TOOLS_IGNORE.wget=
 .  elif !empty(_TOOLS_USE_PKGSRC.wget:M[yY][eE][sS])
 TOOLS_DEPENDS.wget?=		wget-[0-9]*:../../net/wget
-TOOLS_PATH.wget=		${LOCALBASE}/bin/wget
+TOOLS_PATH.wget=		${TOOLBASE}/bin/wget
 .  endif
 .endif
 
@@ -824,7 +824,7 @@ MAKEFLAGS+=			TOOLS_IGNORE.wish=
 .  elif !empty(_TOOLS_USE_PKGSRC.wish:M[yY][eE][sS])
 TOOLS_DEPENDS.wish?=		tk>=8.4:../../x11/tk
 TOOLS_CREATE+=			wish
-TOOLS_PATH.wish=		${LOCALBASE}/bin/wish
+TOOLS_PATH.wish=		${TOOLBASE}/bin/wish
 .  endif
 .endif
 
@@ -834,7 +834,7 @@ MAKEFLAGS+=			TOOLS_IGNORE.xargs=
 .  elif !empty(_TOOLS_USE_PKGSRC.xargs:M[yY][eE][sS])
 TOOLS_DEPENDS.xargs?=		findutils>=4.1:../../sysutils/findutils
 TOOLS_CREATE+=			xargs
-TOOLS_PATH.xargs=		${LOCALBASE}/bin/gxargs
+TOOLS_PATH.xargs=		${TOOLBASE}/bin/gxargs
 TOOLS_ARGS.xargs=		-r	# don't run command if stdin is empty
 .  endif
 .endif
@@ -847,7 +847,7 @@ MAKEFLAGS+=			TOOLS_IGNORE.${_t_}=
 .    elif !empty(_TOOLS_USE_PKGSRC.${_t_}:M[yY][eE][sS])
 TOOLS_DEPENDS.${_t_}?=		xz>=4.999.9betanb1:../../archivers/xz
 TOOLS_CREATE+=			${_t_}
-TOOLS_PATH.${_t_}=		${LOCALBASE}/bin/${_t_}
+TOOLS_PATH.${_t_}=		${TOOLBASE}/bin/${_t_}
 .    endif
 .  endif
 .endfor
@@ -858,7 +858,7 @@ MAKEFLAGS+=			TOOLS_IGNORE.yacc=
 .  elif !empty(_TOOLS_USE_PKGSRC.yacc:M[yY][eE][sS])
 TOOLS_DEPENDS.yacc?=		bison>=1.0:../../devel/bison
 TOOLS_CREATE+=			yacc
-TOOLS_PATH.yacc=		${LOCALBASE}/bin/bison
+TOOLS_PATH.yacc=		${TOOLBASE}/bin/bison
 TOOLS_ARGS.yacc=		-y
 #
 # bison/yacc is typically a build tool whose path is not embedded in
@@ -878,7 +878,7 @@ MAKEFLAGS+=			TOOLS_IGNORE.${_t_}=
 .    elif !empty(_TOOLS_USE_PKGSRC.${_t_}:M[yY][eE][sS])
 TOOLS_DEPENDS.${_t_}?=		zip-[0-9]*:../../archivers/zip
 TOOLS_CREATE+=			${_t_}
-TOOLS_PATH.${_t_}=		${LOCALBASE}/bin/${_t_}
+TOOLS_PATH.${_t_}=		${TOOLBASE}/bin/${_t_}
 .    endif
 .  endif
 .endfor
@@ -945,7 +945,7 @@ MAKEFLAGS+=			TOOLS_IGNORE.${_t_}=
 _TOOLS_USE_PKGSRC.perl=		yes
 TOOLS_DEPENDS.${_t_}?=		perl>=${PERL5_REQD}:../../lang/perl5
 TOOLS_CREATE+=			${_t_}
-TOOLS_PATH.${_t_}=		${LOCALBASE}/bin/${_t_}
+TOOLS_PATH.${_t_}=		${TOOLBASE}/bin/${_t_}
 .    endif
 .  endif
 .endfor
@@ -965,7 +965,7 @@ MAKEFLAGS+=		TOOLS_IGNORE.${_t_}=
 .    elif !empty(_TOOLS_USE_PKGSRC.${_t_}:M[yY][eE][sS])
 TOOLS_DEPENDS.${_t_}?=	coreutils>=5.2.1:../../sysutils/coreutils
 TOOLS_CREATE+=		${_t_}
-TOOLS_PATH.${_t_}=	${LOCALBASE}/bin/g${_t_}
+TOOLS_PATH.${_t_}=	${TOOLBASE}/bin/g${_t_}
 .    endif
 .  endif
 .endfor
@@ -979,7 +979,7 @@ MAKEFLAGS+=		TOOLS_IGNORE.[=
 .  elif !empty(_TOOLS_USE_PKGSRC.[:M[yY][eE][sS])
 TOOLS_DEPENDS.[?=	coreutils>=5.2.1:../../sysutils/coreutils
 TOOLS_CREATE+=		[
-TOOLS_PATH.[=		${LOCALBASE}/bin/g[
+TOOLS_PATH.[=		${TOOLBASE}/bin/g[
 .  endif
 .endif
 
@@ -998,8 +998,8 @@ MAKEFLAGS+=		TOOLS_IGNORE.ggrep=
 TOOLS_DEPENDS.ggrep?=	grep>=2.5.1:../../textproc/grep
 .    for _t_ in ${_TOOLS.grep}
 TOOLS_CREATE+=		g${_t_}
-TOOLS_PATH.${_t_}=	${LOCALBASE}/bin/ggrep
-TOOLS_PATH.g${_t_}=	${LOCALBASE}/bin/ggrep
+TOOLS_PATH.${_t_}=	${TOOLBASE}/bin/ggrep
+TOOLS_PATH.g${_t_}=	${TOOLBASE}/bin/ggrep
 .    endfor
 TOOLS_ARGS.egrep=	-E
 TOOLS_ARGS.gegrep=	-E
@@ -1014,7 +1014,7 @@ MAKEFLAGS+=		TOOLS_IGNORE.${_t_}=
 .      elif !empty(_TOOLS_USE_PKGSRC.${_t_}:M[yY][eE][sS])
 TOOLS_DEPENDS.${_t_}?=	grep>=2.5.1:../../textproc/grep
 TOOLS_CREATE+=		${_t_}
-TOOLS_PATH.${_t_}=	${LOCALBASE}/bin/g${_t_}
+TOOLS_PATH.${_t_}=	${TOOLBASE}/bin/g${_t_}
 .      endif
 .    endif
 .  endfor
@@ -1035,7 +1035,7 @@ MAKEFLAGS+=		TOOLS_IGNORE.${_t_}=
 .    elif !empty(_TOOLS_USE_PKGSRC.${_t_}:M[yY][eE][sS])
 TOOLS_DEPENDS.${_t_}?=	mandoc>=1.12.0nb3:../../textproc/mandoc
 TOOLS_CREATE+=		${_t_}
-TOOLS_PATH.${_t_}=	${LOCALBASE}/bin/mandoc
+TOOLS_PATH.${_t_}=	${TOOLBASE}/bin/mandoc
 .    endif
 .  endif
 .endfor
@@ -1060,10 +1060,10 @@ _TOOLS_USE_PKGSRC.${_t_}= yes
 TOOLS_DEPENDS.${_t_}?=	groff>=1.19.2nb3:../../textproc/groff
 TOOLS_CREATE+=		${_t_}
 .        if "${_t_}" != "groff"
-TOOLS_PATH.${_t_}=	${LOCALBASE}/bin/g${_t_}
+TOOLS_PATH.${_t_}=	${TOOLBASE}/bin/g${_t_}
 TOOLS_ALIASES.${_t_}=	g${_t_}
 .        else
-TOOLS_PATH.${_t_}=	${LOCALBASE}/bin/${_t_}
+TOOLS_PATH.${_t_}=	${TOOLBASE}/bin/${_t_}
 .        endif
 .      endif
 .    endif
@@ -1078,7 +1078,7 @@ MAKEFLAGS+=		TOOLS_IGNORE.gsoelim=
 .  elif !empty(_TOOLS_USE_PKGSRC.gsoelim:M[yY][eE][sS])
 TOOLS_DEPENDS.gsoelim?=	groff>=1.19nb4:../../textproc/groff
 TOOLS_CREATE+=		gsoelim
-TOOLS_PATH.gsoelim=	${LOCALBASE}/bin/gsoelim
+TOOLS_PATH.gsoelim=	${TOOLBASE}/bin/gsoelim
 .  endif
 TOOLS_ALIASES.gsoelim=	soelim
 .endif
@@ -1097,7 +1097,7 @@ MAKEFLAGS+=		TOOLS_IGNORE.${_t_}=
 .    elif !empty(_TOOLS_USE_PKGSRC.${_t_}:M[yY][eE][sS])
 TOOLS_DEPENDS.${_t_}?=	diffutils>=2.8.1:../../devel/diffutils
 TOOLS_CREATE+=		${_t_}
-TOOLS_PATH.${_t_}=	${LOCALBASE}/bin/g${_t_}
+TOOLS_PATH.${_t_}=	${TOOLBASE}/bin/g${_t_}
 .    endif
 .  endif
 .endfor
@@ -1130,7 +1130,7 @@ MAKEFLAGS+=		TOOLS_IGNORE.${_t_}=
 .    elif !empty(_TOOLS_USE_PKGSRC.${_t_}:M[yY][eE][sS])
 TOOLS_DEPENDS.${_t_}?=	${TOOLS_DEPENDS.ghostscript}
 TOOLS_CREATE+=		${_t_}
-TOOLS_PATH.${_t_}=	${LOCALBASE}/bin/${_t_}
+TOOLS_PATH.${_t_}=	${TOOLBASE}/bin/${_t_}
 .    endif
 .  endif
 .endfor
@@ -1148,7 +1148,7 @@ TOOLS_CREATE+=			iceauth
 TOOLS_PATH.iceauth=	${X11BASE}/bin/iceauth
 .    else
 TOOLS_DEPENDS.iceauth?=		iceauth-[0-9]*:../../x11/iceauth
-TOOLS_PATH.iceauth=		${LOCALBASE}/bin/iceauth
+TOOLS_PATH.iceauth=		${TOOLBASE}/bin/iceauth
 .    endif
 .  endif
 .endif
@@ -1162,7 +1162,7 @@ TOOLS_CREATE+=			mkfontdir
 TOOLS_PATH.mkfontdir=	${X11BASE}/bin/mkfontdir
 .    else
 TOOLS_DEPENDS.mkfontdir?=	mkfontscale>=1.2:../../fonts/mkfontscale
-TOOLS_PATH.mkfontdir=		${LOCALBASE}/bin/mkfontdir
+TOOLS_PATH.mkfontdir=		${TOOLBASE}/bin/mkfontdir
 .    endif
 .  endif
 .endif
@@ -1176,7 +1176,7 @@ TOOLS_CREATE+=			mkfontscale
 TOOLS_PATH.mkfontscale=	${X11BASE}/bin/mkfontscale
 .    else
 TOOLS_DEPENDS.mkfontscale?=	mkfontscale-[0-9]*:../../fonts/mkfontscale
-TOOLS_PATH.mkfontscale=		${LOCALBASE}/bin/mkfontscale
+TOOLS_PATH.mkfontscale=		${TOOLBASE}/bin/mkfontscale
 .    endif
 .  endif
 .endif
@@ -1190,7 +1190,7 @@ TOOLS_CREATE+=			bdftopcf
 TOOLS_PATH.bdftopcf=	${X11BASE}/bin/bdftopcf
 .    else
 TOOLS_DEPENDS.bdftopcf?=	bdftopcf-[0-9]*:../../fonts/bdftopcf
-TOOLS_PATH.bdftopcf=		${LOCALBASE}/bin/bdftopcf
+TOOLS_PATH.bdftopcf=		${TOOLBASE}/bin/bdftopcf
 .    endif
 .  endif
 .endif
@@ -1204,7 +1204,7 @@ TOOLS_CREATE+=			ucs2any
 TOOLS_PATH.ucs2any=	${X11BASE}/bin/ucs2any
 .    else
 TOOLS_DEPENDS.ucs2any?=		font-util-[0-9]*:../../fonts/font-util
-TOOLS_PATH.ucs2any=		${LOCALBASE}/bin/ucs2any
+TOOLS_PATH.ucs2any=		${TOOLBASE}/bin/ucs2any
 .    endif
 .  endif
 .endif
@@ -1218,7 +1218,7 @@ TOOLS_CREATE+=			bdftruncate
 TOOLS_PATH.bdftruncate=	${X11BASE}/bin/bdftruncate
 .    else
 TOOLS_DEPENDS.bdftruncate?=	font-util-[0-9]*:../../fonts/font-util
-TOOLS_PATH.bdftruncate=		${LOCALBASE}/bin/bdftruncate
+TOOLS_PATH.bdftruncate=		${TOOLBASE}/bin/bdftruncate
 .    endif
 .  endif
 .endif
@@ -1232,7 +1232,7 @@ TOOLS_CREATE+=			xauth
 TOOLS_PATH.xauth=	${X11BASE}/bin/xauth
 .    else
 TOOLS_DEPENDS.xauth?=		xauth-[0-9]*:../../x11/xauth
-TOOLS_PATH.xauth=		${LOCALBASE}/bin/xauth
+TOOLS_PATH.xauth=		${TOOLBASE}/bin/xauth
 .    endif
 .  endif
 .endif
@@ -1246,7 +1246,7 @@ TOOLS_CREATE+=			xinit
 TOOLS_PATH.xinit=	${X11BASE}/bin/xinit
 .    else
 TOOLS_DEPENDS.xinit?=		xinit-[0-9]*:../../x11/xinit
-TOOLS_PATH.xinit=		${LOCALBASE}/bin/xinit
+TOOLS_PATH.xinit=		${TOOLBASE}/bin/xinit
 .    endif
 .  endif
 .endif
@@ -1260,7 +1260,7 @@ TOOLS_CREATE+=			xmessage
 TOOLS_PATH.xmessage=	${X11BASE}/bin/xmessage
 .    else
 TOOLS_DEPENDS.xmessage?=		xmessage-[0-9]*:../../x11/xmessage
-TOOLS_PATH.xmessage=		${LOCALBASE}/bin/xmessage
+TOOLS_PATH.xmessage=		${TOOLBASE}/bin/xmessage
 .    endif
 .  endif
 .endif
@@ -1277,7 +1277,7 @@ _TOOLS.x11-imake=	imake mkdirhier xmkmf
       !empty(_TOOLS_USE_PKGSRC.${_t_}:M[yY][eE][sS])
 TOOLS_CREATE+=		${_t_}
 TOOLS_DEPENDS.${_t_}?=	imake-[0-9]*:../../devel/imake
-TOOLS_PATH.${_t_}=	${LOCALBASE}/bin/${_t_}
+TOOLS_PATH.${_t_}=	${TOOLBASE}/bin/${_t_}
 .  endif
 .endfor
 
@@ -1286,7 +1286,7 @@ TOOLS_PATH.${_t_}=	${LOCALBASE}/bin/${_t_}
 TOOLS_CREATE+=		makedepend
 .  if ${X11_TYPE:U} == modular
 TOOLS_DEPENDS.makedepend?=	makedepend-[0-9]*:../../devel/makedepend
-TOOLS_PATH.makedepend=	${LOCALBASE}/bin/makedepend
+TOOLS_PATH.makedepend=	${TOOLBASE}/bin/makedepend
 .  else
 TOOLS_PATH.makedepend=	${X11BASE}/bin/makedepend
 .  endif
diff --git a/mk/tools/tools.AIX.mk b/mk/tools/tools.AIX.mk
index d358456f02aa..fb4608405895 100644
--- a/mk/tools/tools.AIX.mk
+++ b/mk/tools/tools.AIX.mk
@@ -68,4 +68,4 @@ TOOLS_PLATFORM.wc?=		/usr/bin/wc
 TOOLS_PLATFORM.xargs?=		/usr/bin/xargs
 
 # Special bootstrap script:
-TOOLS_PLATFORM.strip?=		${LOCALBASE}/bin/strip
+TOOLS_PLATFORM.strip?=		${TOOLBASE}/bin/strip
diff --git a/mk/tools/tools.UnixWare.mk b/mk/tools/tools.UnixWare.mk
index d59bd916823e..98fd17f40c16 100644
--- a/mk/tools/tools.UnixWare.mk
+++ b/mk/tools/tools.UnixWare.mk
@@ -54,4 +54,4 @@ TOOLS_PLATFORM.wc?=		/usr/bin/wc
 TOOLS_PLATFORM.xargs?=		/usr/bin/xargs
 
 # Special bootstrap script
-TOOLS_PLATFORM.mkdir?=		${LOCALBASE}/sbin/mkdir-sh -p
+TOOLS_PLATFORM.mkdir?=		${TOOLBASE}/sbin/mkdir-sh -p
diff --git a/textproc/xmlcatmgr/Makefile b/textproc/xmlcatmgr/Makefile
index 22de2cb47af5..efb2a1e0a6a4 100644
--- a/textproc/xmlcatmgr/Makefile
+++ b/textproc/xmlcatmgr/Makefile
@@ -31,7 +31,7 @@ INSTALLATION_DIRS+=	share/examples/xmlcatmgr
 XMLCATMGR=	${WRKSRC}/xmlcatmgr
 .else
 TOOL_DEPENDS+=	${PKGNAME}:../../textproc/xmlcatmgr
-XMLCATMGR=	${PREFIX}/bin/xmlcatmgr
+XMLCATMGR=	${TOOLBASE}/bin/xmlcatmgr
 .endif
 
 post-build:


Home | Main Index | Thread Index | Old Index