Files
makronix/tools/pkgsrc-cross.mk.conf
T
lotherk bfb8f1a32e source set: one tree, usr/src, the whole repository
The source medium carried six sets: NetBSD's src, gnusrc, syssrc and
sharesrc at /usr/src, xsrc at /usr/xsrc and msrc at /usr/msrc.  Makronix is
one tree, so there is one set now: src.tgz, unpacked to /usr/src, with the
repository as it is -- src/, xsrc/, ext/, pkgsrc/, mobile/, www/, docs/,
tools/, the root files, PINS, packages.list, distfiles.lst and distfiles/
(only the archives of the Makronix packages).

- makesrctars -m packs the staged tree as usr/src and skips the split sets.
  It keeps the modes and the links of the repository (pkgsrc and tools run
  their scripts directly); build.sh gets the directory as MAKROSRCDIR.
- tools/srctree-stage.sh replaces tools/msrc-stage.sh.  It copies git's file
  list of the root repository and of pkgsrc (tracked files plus the untracked
  Makronix recipes: AGENTS.md, wm/mcde, x11/mcde-motif,
  filesystems/afpfs-ng), stages the distfiles, and puts the pkgsrc patch
  names that ustar cannot store into pkgsrc-longnames.cpio.
- makesrctars removes source sets of the old layout from
  RELEASEDIR/source/sets before it writes, so no stale gnusrc/msrc/xsrc can
  travel on a medium.

Measured: tools/srctree-stage.sh -> 462655 entries, 11 GB, 214 names in
pkgsrc-longnames.cpio; make sourcesets verified distfiles.lst (2010 archives,
0 missing, 0 wrong hash) and wrote RELEASEDIR/source/sets/src.tgz
(build/logs/sourcesets-2026-11-15.log).

The installer side is not in this commit: it is being changed in the same
tree by the sysinst profile work (tasksd t0260) -- one SET_SRC, the long-name
extraction from /usr/src/pkgsrc, the messages and sysinst.8.
docs/OFFLINE-BUILD.md, docs/BUILD-VM.md, docs/LICENSES.md and GOAL.md
describe the one tree.
2026-11-15 21:45:20 +00:00

240 lines
13 KiB
Plaintext

# License: CNCL 1.0 (Could Not Care Less), see LICENSE at the top of the tree.
# pkgsrc cross configuration for the Makronix build.
#
# MAKRONIX_TOP is the root of the Makronix tree and must be in the environment
# of every bootstrap and package build (MAKRONIX_TOP=$PWD bmake ...): the paths
# below follow it, so the same file serves the development tree and the tree
# the source set unpacks to (/usr/src). Before 2026-11-06 they were
# absolute paths of the development machine.
#
# Used as a mk-fragment (bootstrap --mk-fragment), so it ends up in the
# bootstrap's mk.conf and every package build reads it. The toolchain and the
# sysroot come from this tree's own build.sh output, so package contents are
# built FOR the target and never for the host.
#
# TOOLDIR ${TOP}/build/obj/tooldir.<host> (cross gcc/ld/ar/strip)
# CROSS_DESTDIR ${TOP}/build/obj/destdir.<machine> (the target sysroot)
#
# Values are taken from what build.sh produced (build/obj/params: MACHINE=amd64,
# MACHINE_ARCH=x86_64, DISTRIBVER=11.99.9), not guessed.
#
# pkg_install, in two pieces -- the distinction is not cosmetic:
#
# * build side: pkgsrc's cross mode registers packages with the *native*
# pkg_add (mk/pkgformat/pkg/pkgformat-vars.mk: PKG_ADD is
# ${NATIVE_PKG_ADD_CMD}), pointed at ${CROSS_DESTDIR} with -p. That binary
# is built by pkgsrc's own bootstrap from pkgsrc/pkgtools/pkg_install/files,
# not taken from the host's package manager; this host has no NetBSD pkg
# tools and none are installed from the distribution.
# * target side: no pkgsrc pkg_install. pkgtools/pkg_install cannot be
# cross-built -- its libnbcompat dependency runs configure test programs
# ("cannot run test program while cross compiling") -- and it would only
# duplicate the one in base. Makronix's pkg_add/pkg_info come from the
# distribution itself (src/usr.sbin/pkg_install, built by build.sh and
# shipped in the base set).
#
# pkgsrc's doc/HOWTO-use-crosscompile says "XXX This currently works only for
# NetBSD" about the *host*; the mechanism it describes (TOOLDIR + CROSS_DESTDIR
# + the cross toolchain from build.sh) does not depend on the host's OS, and
# this tree's build.sh already builds that toolchain on Linux.
USE_CROSS_COMPILE?= yes
TOOLDIR!= ls -d ${MAKRONIX_TOP}/build/obj/tooldir.* 2>/dev/null | head -1
CROSS_DESTDIR= ${MAKRONIX_TOP}/build/obj/destdir.amd64
# Every variable in CROSSVARS must be present or bsd.prefs.mk stops with
# "USE_CROSS_COMPILE=yes but missing cross variable settings".
CROSS_MACHINE_ARCH= x86_64
CROSS_OPSYS= NetBSD
CROSS_OS_VERSION= 11.99.9
# bsd.prefs.mk computes OPSYS_VERSION as printf "%02d%02d%02d" of
# major/minor/patch: 11.99.9 -> 119909.
CROSS_OPSYS_VERSION= 119909
CROSS_LOWER_OPSYS= netbsd
CROSS_LOWER_OPSYS_VERSUFFIX=
CROSS_LOWER_VARIANT_VERSION=
CROSS_LOWER_VENDOR=
CROSS_LOWER_OS_VARIANT=
CROSS_OBJECT_FMT= ELF
CROSS_LOCALBASE= /usr/pkg
CROSS_SYSCONFBASE= /etc
CROSS_VARBASE= /var
# X is in the base again (xsrc/, build.sh -x; Konrad, 2026-11-13): pkgsrc uses
# the X of the sysroot, /usr/X11R7, as on every NetBSD -- and the NetBSD
# project's binary packages, built the same way, install.
X11_TYPE= native
# "Native" means the target base, not the build host. bootstrap(8) on a Linux
# host writes PREFER_PKGSRC=yes (its comment: Debian's other package managers
# leak in), which is a statement about the host and wrong here: Makronix ships
# curses, zlib, expat, freetype and fontconfig in its own base sets, and a
# second copy under /usr/pkg would be a duplicate, not a dependency. The X
# libraries are not in the base any more (no xsrc): they come from pkgsrc under
# /usr/pkg like everything else. Packages whose base version is too old for
# BUILDLINK_API_DEPENDS still fall back to pkgsrc on their own.
PREFER_PKGSRC=
PREFER_NATIVE= yes
# Archives live outside the repository (AGENTS.md); work directories are build
# output and stay under build/ so a package build never dirties pkgsrc/.
# The archives: the Makronix-only set of them (tools/makronix-distfiles.sh) --
# distfiles/ at the top of the tree when the source set was unpacked, else the
# shared distfiles/ beside the tree (AGENTS.md: archives live outside), else
# build/distfiles where `makronix-distfiles.sh fetch' puts them.
.if exists(${MAKRONIX_TOP}/distfiles)
DISTDIR= ${MAKRONIX_TOP}/distfiles
.elif exists(${MAKRONIX_TOP}/../distfiles)
DISTDIR= ${MAKRONIX_TOP}/../distfiles
.else
DISTDIR= ${MAKRONIX_TOP}/build/distfiles
.endif
WRKOBJDIR= ${MAKRONIX_TOP}/build/pkgsrc-work
PACKAGES= ${MAKRONIX_TOP}/build/packages
# Build as the invoking user; there is nothing to gain from setuid here and
# everything to lose when a cross build runs as root by accident.
UNPRIVILEGED= yes
# TOOLS THAT WOULD RUN ON THE TARGET are refused for a build host that is not
# NetBSD (mk/tools/replace.mk, check in mk/misc/can-be-built-here.mk). Those
# tools only see TARGET paths and never run here, so the check is skipped --
# the documented switch ("When defined, the checks in this file are skipped").
NO_SKIP= yes
# Every licence is acceptable (the user's decision, 2026-11-11): pkgsrc's own
# switch, "You can bypass this check by setting SKIP_LICENSE_CHECK=yes"
# (mk/license.mk:285).
SKIP_LICENSE_CHECK= yes
# The compiler of the build host: pkgsrc's NATIVE_CC (devel/gmp: CONFIGURE_ENV+=
# CC_FOR_BUILD=${NATIVE_CC}) is empty in a cross build here, and gmp's configure
# needs one that runs on this host (it probes "cc", which is the cross wrapper).
NATIVE_CC= /usr/bin/gcc
# fonts/Xft2 (libXft 2.1.7, an old X.Org configure) runs AC_PROG_CXX although it
# is a C package and does not list c++ in USE_LANGUAGES. For every language a
# package does not ask for, pkgsrc puts its fail-wrapper into the compiler path
# (mk/compiler.mk:380), so the probe dies -- "whether we are using the GNU C++
# compiler... no", then "C++ preprocessor \"cpp\" fails sanity check" and
# configure stops (build/logs/userland-2026-11-13r.log:1521, the failing call
# with PKGSRC-WARNING in Xft2's config.log:314-318). Declaring the language is
# what the wrapper asks for; the recipe is pkgsrc's, which this tree does not
# patch, so the setting is here. PKGPATH is defined when this file is read
# (measured with a temporary mk.conf: show-var VARNAME=USE_LANGUAGES -> c++).
# c stays in the list: USE_LANGUAGES is empty in that recipe, so this is the
# only place the language list is set, and without c pkgsrc wraps cc too -- the
# C preprocessor probe then fails the same way (userland-2026-11-13s.log:88).
.if ${PKGPATH} == "fonts/Xft2"
USE_LANGUAGES+= c c++
# libXft 2.1.7 calls FT_GlyphSlot_Embolden (xftglyphs.c:177) without a
# declaration in scope: freetype dropped FT_SYNTHESIS_H from ft2build.h, and
# configure finds the symbol in the library instead of the header
# (config.log:1033 ac_cv_func_FT_GlyphSlot_Embolden=yes). GCC 14 makes an
# implicit declaration an error, so the build stops (build/logs/
# xft2-single2-2026-11-13.log:316). The declaration is in
# <freetype/ftsynth.h>; bringing it in is the missing include, not a muted
# diagnostic (measured: the file compiles with -include freetype/ftsynth.h).
CFLAGS+= -include freetype/ftsynth.h
.endif
# cross/cross-libtool-base is the libtool every cross build links with. It
# keeps a dependency library (-lXt) of a shared library only if it finds the
# file in the linker path (deplibs_check_method match_pattern), and without a
# sysroot it looks for -L=/usr/X11R7/lib on this host: there is no X there, so
# libXm.so came out without libXt, libX11, libXext, libXmu ("linker path does
# not have real file for library -lXt", userland-2026-11-14e.log), and
# wm/mcde's configure could not link Motif ("no Motif (libXm) to link with",
# mcde-single-2026-11-14.log). On a NetBSD host /usr/X11R7 exists, which is
# why pkgsrc does not need it there. libtool's own answer for a cross build is
# a sysroot (configure --with-sysroot: "Search for dependent libraries within
# DIR"); then -L=/... is looked up in the sysroot.
.if ${PKGPATH} == "cross/cross-libtool-base"
CONFIGURE_ARGS+= --with-sysroot=${CROSS_DESTDIR}
.endif
# pkgtools/x11-links builds the shadow tree the X packages see: it tests
# ${X11BASE}/<file> and /usr/<file> and links what it finds. In a cross build
# both are this host's paths, so it took Debian's xorgproto headers and never
# produced Xrender.h -- fonts/Xft2 then stopped with "Xrender.h not found"
# although the file is in the sysroot (measured 2026-11-13: the farm in
# build/obj/destdir.amd64/usr/pkg/share/x11-links/include had 52 links, all to
# /usr/include, build/logs/userland-2026-11-13t.log:155). Pointed at the
# sysroot it finds the target's X, as it would on a NetBSD host, where
# /usr/X11R7 *is* the native X.
.if ${PKGPATH} == "pkgtools/x11-links"
X11BASE= ${CROSS_DESTDIR}/usr/X11R7
.endif
# ksh93 (a dependency of wm/mcde) builds through its own bin/package, which runs
# $CC by name; pkgsrc's CC in a cross build is the prefixed cross compiler, and
# that lives in the tooldir, not in the PATH pkgsrc builds for a package: "cc:
# not found -- set CC=C-compiler" (build/logs/userland-2026-11-14c.log:5299).
# The tooldir's bin holds no unprefixed name (measured: every entry starts with
# x86_64--netbsd- or nb), so it cannot shadow a wrapper that comes before it.
PREPEND_PATH+= ${TOOLDIR}/bin
# lang/tcl (a dependency of wm/mcde: dtksh, tclsh) asks uname which system it
# builds for -- the build HOST. On this Linux host configure chose the Linux
# link loader (tcl_cv_sys_version='Linux-7.1.3+deb14-amd64', DL_OBJS=tclLoadDl.o,
# DL_LIBS=-ldl; config.log:2572-2601) and the link then stopped on "-ldl: No such
# file or directory", because the target has dlopen in libc (build/logs/
# userland-2026-11-14f.log:9467). configure honours the variable when it is
# preset (configure:6363), so the target's system is named here.
.if ${PKGPATH} == "lang/tcl"
CONFIGURE_ENV+= tcl_cv_sys_version=NetBSD-11.99.9
.endif
# devel/flex (in the makronix set) uses gnulib, whose configure asks whether
# malloc/realloc work by RUNNING a program; cross-compiling that is unknown, and
# gnulib then assumes them broken and wants its replacements: the build stopped
# with "implicit declaration of function 'rpl_malloc'" in the generated config.h
# (build/logs/userland-2026-11-14g.log:26-386). The answers are known for the
# target, so they are given -- the same two settings the afpfs-ng recipe carries
# (ext/src/afpfs-ng/pkgsrc/Makefile).
.if ${PKGPATH} == "devel/flex"
CONFIGURE_ENV+= ac_cv_func_malloc_0_nonnull=yes
CONFIGURE_ENV+= ac_cv_func_realloc_0_nonnull=yes
# Its gnulib asks the same way about gettext and then calls it without linking
# libintl ("undefined reference to gettext" in stage1flex, build/logs/
# userland-2026-11-14h.log:393-398). The target has no libintl in its base, and
# flex is a tool and a shell-level program whose messages do not need
# translation: built without NLS, as its own option provides.
PKG_OPTIONS.flex= -nls
# stage1flex is a HOST tool that the build RUNS to generate stage1scan.c, but
# it was built and linked for the target: "./stage1flex: No such file or
# directory", ENOENT for the target's ld.elf_so (build/logs/
# userland-2026-11-14i.log:361-363). An absolute host compiler is what
# libtool needs here: a bare "gcc" goes through pkgsrc's cross wrapper.
CONFIGURE_ENV+= CC_FOR_BUILD=${NATIVE_CC}
# gnulib's generated lib/malloc.c declares "void *malloc ();" and calls it
# with an argument. GCC 14 (the target's) still reads that as an unspecified
# argument list; this host's GCC 16 defaults to C23, where "()" is (void), and
# stops with "too many arguments to function 'malloc'". stage1flex's own
# CFLAGS carry the C99 dialect, so only the host objects change.
MAKE_FLAGS+= stage1flex_CFLAGS=-std=gnu99
.endif
# X is the target's base (X11_TYPE=native, X11BASE=/usr/X11R7), and
# mk/x11.buildlink3.mk:31 hands that path to every GNU configure:
# --x-includes=/usr/X11R7/include --x-libraries=/usr/X11R7/lib. This host has no
# /usr/X11R7, and neither --sysroot nor the cwrappers make such an absolute -I
# resolve: the wrapper even rewrites it to the work directory's .x11-buildlink,
# which holds links to the host's X (see pkgtools/x11-links above). The "=" form
# is GCC's sysroot-relative path (-I=/usr/X11R7/include is <sysroot>/usr/X11R7/
# include), and the wrapper passes it through untouched (measured 2026-11-13 in
# a work directory: ./cwrapper/bin/cc -c -I=/usr/X11R7/include compiles).
CPPFLAGS+= -I=${X11BASE}/include
LDFLAGS+= -L=${X11BASE}/lib
# MCDE's documentation (man pages, help volumes, guides) is made by programs the
# build runs itself (instant, dtdocbook2infolib, the dthelp parsers): built for
# the target, they cannot run on a cross build host (Error 127, 687 of 774
# failures in build/logs/mcde-allerrors-2026-11-14.log). The native build has it.
.if ${PKGPATH} == "wm/mcde"
PKG_OPTIONS.cde= -docs -appbuilder
.endif