305 lines
16 KiB
Plaintext
305 lines
16 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
|
|
|
|
# The archives are part of the repository: distfiles/ at the top of the tree,
|
|
# the Makronix-only set of them (tools/makronix-distfiles.sh, AGENTS.md).
|
|
# Work directories are build output and stay under build/ so a package build
|
|
# never dirties pkgsrc/. The fallbacks -- a shared distfiles/ beside the
|
|
# tree, else build/distfiles where `makronix-distfiles.sh fetch' puts them --
|
|
# are for a tree that does not carry the archives.
|
|
.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.
|
|
#
|
|
# Only where the host has no X of its own. On Makronix the override doubled
|
|
# the sysroot: x11-links includes the file list of an X package only when
|
|
# USE_BUILTIN is yes, and the builtin checks put _CROSS_DESTDIR in front of
|
|
# X11BASE again (destdir/destdir/usr/X11R7) -- libX11, libXrender, xorgproto
|
|
# came out "not builtin", their files were not linked, and x11/libXft stopped
|
|
# with "Package 'x11' not found" (measured 2026-11-20 on makronix-build).
|
|
# There /usr/X11R7 is the native X the comment above means, and the links point
|
|
# where the target has the files.
|
|
.if ${PKGPATH} == "pkgtools/x11-links" && !exists(/usr/X11R7/include/X11/X.h)
|
|
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
|
|
|
|
# The tools the build host RUNS (autoreconf/libtoolize, flex, bison, the docbook
|
|
# tools) are built into the bootstrap prefix by tools/userland.sh host_tools().
|
|
# They have to be found by name: on NetBSD the bootstrap's bin was not on the
|
|
# path of the target build and autoreconf stopped with "Can't exec libtoolize"
|
|
# (measured 2026-11-20, wm/mcde on makronix-build). One place names them.
|
|
HOST_TOOLS_BIN= ${MAKRONIX_TOP}/build/pkg/bin
|
|
PREPEND_PATH+= ${HOST_TOOLS_BIN}
|
|
|
|
# The X of the build HOST, for the tools that are built and run here (makestrs,
|
|
# wml, wmldbcreate, autoreconf helpers). PREFIX is the target's /usr/pkg, so it
|
|
# cannot answer this. A host with its own X (Makronix) uses it; a Linux host
|
|
# has none and uses the stub tree the bootstrap's X packages put under PREFIX.
|
|
# Recipes name these two variables and ask nothing about the host themselves.
|
|
.if exists(/usr/X11R7/include/X11/Xos.h)
|
|
HOST_X11BASE= /usr/X11R7
|
|
HOST_X11_LIBS= /usr/X11R7/lib/libXt.a /usr/X11R7/lib/libX11.a \
|
|
/usr/X11R7/lib/libSM.a /usr/X11R7/lib/libICE.a
|
|
HOST_FL_A= /usr/lib/libfl.a
|
|
.else
|
|
HOST_X11BASE= ${PREFIX}
|
|
HOST_X11_LIBS= ${MAKRONIX_TOP}/build/pkg/lib/libXt.a \
|
|
${MAKRONIX_TOP}/build/pkg/lib/libX11.a \
|
|
${MAKRONIX_TOP}/build/pkg/lib/libSM.a \
|
|
${MAKRONIX_TOP}/build/pkg/lib/libICE.a
|
|
HOST_FL_A= ${MAKRONIX_TOP}/build/pkg/lib/libfl.a
|
|
.endif
|
|
|
|
# Flags for programs the build host runs (makestrs, wml, tradcpp, ...). gcc on
|
|
# NetBSD links PIE by default and pkgsrc asks for -pie, so a host object built
|
|
# without -fPIE stops the link ("relocation R_X86_64_32 ... can not be used
|
|
# when making a PIE object", tradcpp in wm/mcde, measured 2026-11-20). The
|
|
# dialect is the fork's 1990s C, not the host compiler's C23 default.
|
|
HOST_BUILD_CFLAGS= -O2 -std=gnu17 -fPIE
|
|
|
|
# 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
|
|
# /usr/pkg/lib before the base X: a library pkgsrc builds because the base's is
|
|
# too old must be the one a package links. Measured 2026-11-20 on
|
|
# makronix-build: the base freetype is 2.10.4, pkgsrc wants >=2.13 and builds
|
|
# libfreetype.so.6, but fontconfig was linked against the base's
|
|
# libfreetype.so.19 through -L=/usr/X11R7/lib, and the next link stopped with
|
|
# "libfreetype.so.19, needed by libfontconfig.so.1.17.0, not found". Where
|
|
# pkgsrc builds nothing, /usr/pkg/lib has nothing and the base is found as
|
|
# before. rpath-link lets the linker follow NEEDED entries inside the sysroot.
|
|
LDFLAGS+= -L=/usr/pkg/lib
|
|
LDFLAGS+= -L=${X11BASE}/lib
|
|
# The cross libtool writes every .la dependency as "=$libdir/name"
|
|
# (cross-libtool-base, ltmain: newdependency_libs " ${lt_sysroot:+=}$libdir/
|
|
# $name"), so one taken from the buildlink tree ends up in the installed .la as
|
|
# "=<work>/.buildlink/lib/libpng16.la". pkgsrc's unwrap rule maps the
|
|
# buildlink tree back to LOCALBASE only without the "=", the path stayed, and
|
|
# the next package stopped with "libtool: error: '.../.buildlink/lib/
|
|
# libpng16.la' is not a valid libtool archive" (libfreetype.la, libgcrypt.la;
|
|
# measured 2026-11-20 on makronix-build). The same rule for the "=" form; the
|
|
# wrappers compare it as a prefix of the whole entry (cwrappers
|
|
# fixup-libtool.c).
|
|
_CWRAPPERS_UNWRAP+= =${BUILDLINK_DIR}:=${CROSS_LOCALBASE}
|
|
LDFLAGS+= -Wl,-rpath-link,${CROSS_DESTDIR}/usr/pkg/lib
|
|
LDFLAGS+= -Wl,-rpath-link,${CROSS_DESTDIR}/usr/X11R7/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
|