pkgsrc/mk
riastradh a1abd9761c mk: Cross-eyed hacks to support cross-libtool.
For a long time, when cross-building, say from native=amd64 to
target=powerpc, it was necessary to:

1. cross-build a _powerpc_ package called cross-libtool-base-powerpc,
   and then

2. install the powerpc package _natively_ with `pkg_add -m x86_64' to
   override the architecture check that normally forbids this kind of
   shenanigans,

in order to cross-build anything that uses libtool as a tool.

This is partly because libtool doesn't follow the normal GNU
convention of `./configure --build=<native platform> --host=<platform
package will run on> --target=<platform package is configured to
operate on>' -- in this example, build=amd64, host=amd64,
target=powerpc.

Instead, libtool expects to be cross-built itself, even if it's going
to run as a tool.  It's not as bonkers as it sounds at first: libtool
is just a shell script, and it caches various information about the
(cross-building!) toolchain it is built with so it can use that
information later when it is run as a tool itself to cross-compile
other software.

To make this work, we need to create the toolchain wrappers for
libtool _as if_ we were cross-building even if we are building a
native package.  So mk/tools uses a new flag TOOLS_USE_CROSS_COMPILE
instead of USE_CROSS_COMPILE, and libtool internally sets
MACHINE_ARCH=${TARGET_ARCH} (in the example above, powerpc) to make
it look like we're cross-building.  The new TOOLS_CROSS_DESTDIR is an
alias for the (defaulted) CROSS_DESTDIR, which must now be set
unconditionally in mk.conf in order for libtool to know where the
cross-destdir will be; _CROSS_DESTDIR remains empty when building any
native packages (including the native cross-libtool package).

Finally, we need to make the resulting package be a native package,
with MACHINE_ARCH set to the one that it will be installed on (in the
example above, amd64), so I added an indirection _BUILD_DEFS.${var}
to replace var on its own in the build definitions that get baked
into the package, shown by `pkg_info -B'.  Setting
_BUILD_DEFS.MACHINE_ARCH=${NATIVE_MACHINE_ARCH} ensures that this
mutant hybrid cross-built libtool still produces a native package.

All of this logic is gated on setting USE_CROSS_COMPILE in mk.conf or
LIBTOOL_CROSS_COMPILE in the package makefile, so it should be safe
for non-cross-builds -- when USE_CROSS_COMPILE=no and you're not
building cross-libtool, everything is as before.
2022-04-04 11:23:06 +00:00
..
build bsd.build-vars.mk: describe MAKE_FLAGS in details, rewrite and reformat 2020-09-12 06:51:15 +00:00
buildlink3 buildlink3/find*.mk: fix typos in comments 2022-02-10 18:58:37 +00:00
check mk/check: Do not waste time checking binaries that set EMUL_PLATFORM. 2022-03-07 16:53:08 +00:00
checksum mk: Replace RMD160 as a default distfile hash with BLAKE2s 2021-10-26 09:06:06 +00:00
cmake-Modules/Platform
compiler mk: Cross-eyed hacks to support cross-libtool. 2022-04-04 11:23:06 +00:00
configure mk: Cross-eyed hacks to support cross-libtool. 2022-04-04 11:23:06 +00:00
defaults mk/defaults: document SDL12_TYPE 2022-04-01 10:46:44 +00:00
depends
emulator Add quotes overlooked in previous. 2021-12-18 00:53:33 +00:00
extract Remove leftover debug statement, spotted by wiz@. 2022-01-06 10:30:50 +00:00
features For macOS, getline(3) arrived sometime after 10.6 -- guessing 10.7 like 2022-01-14 14:46:50 +00:00
fetch The non-writability check for DISTDIR is intended to prevent wasting 2021-12-16 14:10:46 +00:00
gnu-config match/pass mipsn64e[lb]. 2022-03-03 03:33:22 +00:00
haskell Wrote a packaging guide for Haskell packages 2022-02-11 05:24:06 +00:00
help help/help.mk: pick up further language-specific variables 2022-01-24 23:16:01 +00:00
init
install mk/install: fix documentation and speed up install-dirs-from-PLIST 2021-08-14 08:38:01 +00:00
misc developer.mk: improve a comment 2021-01-20 01:35:33 +00:00
package
patch
pbulk *: move default database directory from /var/db/pkg to ${PREFIX}/pkgdb 2020-12-02 10:22:39 +00:00
pkgformat mk: Cross-eyed hacks to support cross-libtool. 2022-04-04 11:23:06 +00:00
pkginstall Introduce a new SYSCONFBASE variable (defaults to /etc) 2021-05-30 23:41:05 +00:00
pkgtasks
platform mk/platform: Add a variable for detectic static PIE support. 2022-03-03 07:30:06 +00:00
plist mk: Remove reference to LOWER_OS_VERSION. 2021-11-30 09:39:50 +00:00
repro
scripts mk/scripts/remove_todo: support python 3.10 2022-02-18 18:10:09 +00:00
tools mk: Cross-eyed hacks to support cross-libtool. 2022-04-04 11:23:06 +00:00
wrapper mk: Cross-eyed hacks to support cross-libtool. 2022-04-04 11:23:06 +00:00
alternatives.mk
apache.mk apache.mk: update comment, apache22 is gone, so is the "ap22" prefix 2019-12-28 11:43:58 +00:00
apache.module.mk
atomic64.mk mk/atomic64.mk: CFLAGS is added to CXXFLAGS automatically 2021-12-19 15:12:28 +00:00
bdb.buildlink3.mk mk: Add db18 to Berkeley DB framework 2020-06-29 13:36:50 +00:00
blas.buildlink3.mk mk/blas.bl3, Netlib and OpenBLAS packages, NumPy: C fixup and 64 bits 2021-06-15 04:41:51 +00:00
bsd.fast.prefs.mk
bsd.hacks.mk
bsd.makevars.mk
bsd.options.mk bsd.options.mk: fix typo in comment 2021-06-11 20:21:01 +00:00
bsd.pkg.barrier.mk New target test-env, like build-env and configure-env. 2020-03-23 00:33:48 +00:00
bsd.pkg.clean.mk
bsd.pkg.debug.mk
bsd.pkg.error.mk mk/bsd.pkg.error.mk: fix alignment of the backslashes 2019-09-08 09:15:01 +00:00
bsd.pkg.mk mk: move locking.mk from internal to misc 2020-05-10 06:52:49 +00:00
bsd.pkg.readme.mk mk: use http. 2021-04-09 20:15:16 +00:00
bsd.pkg.subdir.mk mk, doc: remove obsolete bulk-install and bulk-package targets 2020-06-05 17:05:22 +00:00
bsd.pkg.update.mk mk/bsd.pkg.update.mk: fix indentation 2020-01-11 19:30:50 +00:00
bsd.pkg.use.mk mk: When using imake, pass LDFLAGS in the environment as LOCAL_LDFLAGS. 2021-08-28 08:07:39 +00:00
bsd.prefs.mk mk: Cross-eyed hacks to support cross-libtool. 2022-04-04 11:23:06 +00:00
bsd.utils.mk
compiler.mk mk: add c++20 and gnu++20 2021-12-03 07:40:26 +00:00
curses.buildlink3.mk
curses.builtin.mk
cwrappers.mk mk: Cross-eyed hacks to support cross-libtool. 2022-04-04 11:23:06 +00:00
db1.builtin.mk
djbware.mk Run without errors when LICENSE is undefined. 2020-11-19 09:16:38 +00:00
dlopen.buildlink3.mk
dlopen.builtin.mk
endian.mk
fam.buildlink3.mk
fonts.mk mk: Avoid find -iname for compatibility with Solaris 10 2021-11-13 22:21:20 +00:00
fuse.buildlink3.mk Fix FUSE version in fake pkg-config files 2022-01-27 04:27:05 +00:00
haskell.mk mk/haskell.mk: Enable --enable-split-sections 2022-02-26 03:55:37 +00:00
java-env.mk
java-vm.mk mk/java-vm.mk: clean up documentation 2022-03-19 14:10:51 +00:00
jpeg.buildlink3.mk mk/jpeg.buildlink3.mk: document allowed values 2021-03-21 08:02:27 +00:00
krb5.buildlink3.mk
Kyuafile
libusb.buildlink3.mk
license.mk mk/license: make guess-license more user-friendly 2022-01-01 13:55:48 +00:00
linux-pam.builtin.mk mk/linux-pam: replace obsolete _PKG_SILENT with RUN 2020-03-15 23:03:03 +00:00
love.mk
motif.buildlink3.mk
mpi.buildlink3.mk mk/mpi.buildlink3.mk: Add MPI_TYPE=native and diagnostics 2021-05-11 21:30:57 +00:00
mysql.buildlink3.mk mk: Update comment for mysql/mariadb to reflect code change 2021-09-27 15:25:54 +00:00
ocaml.mk default OCAML_USE_OPT_COMPILER to YES on arm64eb. 2022-03-03 03:32:28 +00:00
omf-scrollkeeper.mk
oss.buildlink3.mk mk/oss.buildlink3.mk: Simplify per-OS DEV* conditionals. Add MIDI. 2020-04-11 10:31:14 +00:00
oss.builtin.mk
pam.buildlink3.mk
pax.mk
pf.buildlink3.mk
pgsql.buildlink3.mk postgresql14: added version 14.0 2021-10-08 10:23:43 +00:00
pkg-build-options.mk mk/pkg-build-options: fail immediately if pkgbase is not set 2020-03-15 10:33:42 +00:00
pthread.buildlink3.mk
pthread.builtin.mk
readline.buildlink3.mk
readline.builtin.mk mk: Use .elif instead of .else if 2020-12-17 09:44:24 +00:00
resolv.buildlink3.mk
smf.mk
solaris-pam.builtin.mk
subst.mk subst.mk: Fix mk/scrips/subst-identity.awk for FreeBSD 2021-05-19 14:44:22 +00:00
termcap.buildlink3.mk
termcap.builtin.mk
terminfo.buildlink3.mk
terminfo.builtin.mk
unprivileged.mk
x11.buildlink3.mk
x11.builtin.mk
x11.version.mk
xaw.buildlink3.mk