Cross-Building and the Source Tree
Makronix is built on NetBSD and on other systems. The same tree,
the same packages and the same release come out; the difference is the
toolchain that build.sh builds first. This chapter is
for the person who works on that build, not for the person who installs
the result.
What the build detects
tools/userland.sh looks at
uname -s. On NetBSD it builds natively with the
host's pkgsrc and installs into the host's /usr/pkg;
on anything else it cross-builds with the toolchain and the sysroot in
build/obj. The packages are the same either way;
tools/pkgsrc-cross.mk.conf is the only
configuration that is specific to the cross case, and
pkgsrc/ is not patched.
The build's paths come from MAKRONIX_TOP.
On a development machine that is the repository root; on an installed
system with the source set it is /usr/src.
The cross workarounds, and why they exist
Four settings in tools/pkgsrc-cross.mk.conf
were each added after a measured failure. They are documented in
docs/CROSS.md in the source set; in short:
fonts/Xft2 runs a C++
probe it does not declare. The cross configuration adds
USE_LANGUAGES+= c c++, which gives it a real
compiler instead of pkgsrc's fail wrapper.
fonts/Xft2 calls
FT_GlyphSlot_Embolden without the header that
declares it after FreeType moved it. The build adds
-include freetype/ftsynth.h. This is a GCC-14
strictness issue, not a cross issue; the native build may need it
too.
pkgtools/x11-links probes
/usr for X headers. In a cross build that is the
host's X, not the target's; the configuration points it at
${CROSS_DESTDIR}/usr/X11R7.
X's configure passes absolute
/usr/X11R7/include and
/usr/X11R7/lib, which do not resolve inside the
sysroot. The build adds the sysroot-relative GCC form
-I=/usr/X11R7/include and
-L=/usr/X11R7/lib.
Each setting has a removal criterion in
docs/CROSS.md: when the package builds without it
in both modes, it goes. A workaround that outlives its cause is a bug
with a comment.
Forks and imported trees
What Makronix changes is a fork in ext/; what
it does not change is imported and left alone. The NetBSD tree is
src/ with its base commit in
src/BASE; the X tree is xsrc/
with xsrc/BASE; upstream for reading is
refs/netbsd and refs/linux.
The import of a fork is one commit of the upstream archive, and every
change after it is a visible diff.
MCDE is the largest fork. Its build for the host is
make mcde-host; its Linux build is
make mcde-linux. The host build is what produces
dtdocbook2infolib and dtinfo for
the documentation and for testing without a target machine; the cross
build for the release is part of make userland.
The rules that keep it buildable
A package that builds only on one host is broken. Fix
the recipe, the configuration in tools/, or the
source in ext/; do not build it in a virtual
machine.
pkgsrc/ and refs/
are not edited. A change is a moved pin, recorded in
PINS, or a package of our own.
tools/ is POSIX shell: no bash,
no Python, no transient units. A tool that only runs on the author's
machine is not a tool.
The set list is generated, not written:
tools/makronix-set.sh reads the installed tree
back and writes src/distrib/sets/lists/makronix/mi.
A file that is installed but not in the list fails
checkflist.
Other platforms
make release ARCH=macppc and the other
architectures use the same tree with a different target. A platform is
supported when its installation has been run to a login prompt; the
measured state is in docs/PLATFORMS.md. Cross
building makes the compiler for that platform; it does not test the
firmware, the drivers or the desktop on it. That is what the hardware
is for.