Commit graph

6 commits

Author SHA1 Message Date
riastradh
602ea42ad2 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.
2023-06-27 10:27:20 +00:00
riastradh
b2d0803cf1 doc/HOWTO-dev-crosscompile: Handle undefined USE_CROSS_COMPILE.
bsd.prefs.mk doesn't guarantee it is defined.  Fixes mistake in
previous.
2023-06-10 01:58:20 +00:00
riastradh
4375a024cc doc/HOWTO-dev-crosscompile: Modernize conditionals. 2023-06-09 23:54:10 +00:00
riastradh
28866afd8b Add some more notes on cross-compilation for developers. 2013-05-11 20:24:01 +00:00
riastradh
fd0a490387 Add $NetBSD$ tags to HOWTO-use-crosscompile & HOWTO-dev-crosscompile. 2013-05-11 20:15:10 +00:00
riastradh
31391265c5 Add some notes on how to use and develop cross-compiled packages.
ok agc
2013-05-10 00:03:46 +00:00