Files
lotherkandClaude Opus 5.5 4c89941778 Makronix/Linux: src/bin by NetBSD's normal build, libmxlinux from NetBSD's own sources
make src DIR=<dir> (mobile/tools/mxsrc.sh) runs the tooldir's
nbmake-evbarm64 in src/<dir> with MAKECONF=mobile/conf/mk.conf and the
sysroot as DESTDIR, objects in build/tools-obj, "obj" first.

libmxlinux grows into what NetBSD's libc and libutil have and glibc
lacks, from NetBSD's own sources reached over by .PATH: vis/unvis,
strmode, setmode, pwcache, reallocarr, strtoi/strtou (BCS_ONLY), fts (its
<fts.h> in front of glibc's; renamed symbols, so the two never meet),
acl(3) (posix1e), extattr(3), and libutil's efun, parsedate,
raise_default_signal, stat_flags, strpct, snprintb.  Ours only at the
kernel boundary: extattr onto Linux xattr(7) (user. and trusted.), the
__acl_* calls (EOPNOTSUPP; _PC_ACL_* get values glibc answers EINVAL to),
chflags/undelete (EOPNOTSUPP), lchmod (a link has no mode on Linux),
lpathconf, setpassent, the timezone_t API over TZ (mx_tz.c), sys_siglist.
include/ reaches over <fts.h>, <util.h>, <vis.h>, <tzfile.h>,
<sys/acl.h>, <sys/extattr.h>.  stty's mx_termios.h moves here and serves
every program; the old port frame keeps its per-port shims behind
-DMX_PORT_FRAME until they are gone.

libnbcompat is out of the normal build again: its setmode is the host
tools' octal-only stub (src/tools/compat/getmode.c:37), so chmod u+x set
mode 0.  mk.conf: NOGCCERROR (28 warnings left in src/bin),
-Wno-system-headers (glibc's fortify headers), MKRUMP=no.

Found on the way: NetBSD's __used macro deleted a member of glibc's
regex_t (<regex.h>:410 pastes "__used") and of posix_spawnattr_t
(<spawn.h>:47); regex_t shrank from 64 to 56 bytes and expr's regexec
read garbage.  mxlinux.h now includes both headers before mx_cdefs.h.

Measured: 22 of 34 programs of src/bin build
(mobile/build/logs/mxsrc-bin6-2026-11-12.log); the 18 with a port test
pass all of them under qemu-aarch64 -L build/mxsysroot-hotdogb: cat chmod
cp echo expr hostname kill ln ls mkdir mv pwd rm rmdir sleep stty sync
test.  The old frame still builds cat, stty, test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 08:21:44 +00:00

40 lines
1.5 KiB
Makefile

# libmxlinux -- the NetBSD interfaces glibc does not have, for every port
# of mobile/userland (docs/NETBSD-USERLAND.md section 4)
#
# Built like src/tools/compat builds libnbcompat (HOSTLIB, bsd.hostlib.mk),
# with the phone's compiler, by the mx-lib step of ../../Makefile; not
# installed -- mk/mx.prog.mk links it from its object directory and forces
# include/mxlinux.h into every compile.
#
# NetBSD's own sources where they run on glibc unchanged, through .PATH;
# Linux code of ours (mx_*.c) only where the kernel's or glibc's view is
# needed. A new item: its source, its declaration in include/mxlinux.h with
# the NetBSD header line it stands in for, and a line in AGENTS.md.
HOSTLIB= mxlinux
.include <bsd.hostinit.mk>
# libnbcompat's configuration (nbtool_config.h, compat_defs.h): the same
# environment the ports compile in; its library is linked by the ports.
MX_COMPATOBJ= ${MX_DESTDIR:H}/obj/src/tools/compat
NOCOMPATLIB= yes
COMPATLIB_UNINSTALLED=yes
COMPATLIB_NO_LIB=yes
.include "${MX_COMPATOBJ}/defs.mk"
.PATH: ${NETBSDSRCDIR}/lib/libmxlinux \
${NETBSDSRCDIR}/common/lib/libc/stdlib \
${NETBSDSRCDIR}/lib/libc/gen
# ours
SRCS= mx_signame.c mx_fgetwln.c mx_locale.c mx_progname.c
# NetBSD's, unchanged
SRCS+= getopt.c
SRCS+= signalname.c signalnumber.c signalnext.c
SRCS+= humanize_number.c dehumanize_number.c getbsize.c
HOST_CPPFLAGS+= -include nbtool_config.h -I${NETBSDSRCDIR}/lib/libmxlinux -DMX_PORT_FRAME -include mxlinux.h
.include <bsd.hostlib.mk>