mcde: tradcpp predefines the target OS (dtlogin Xservers)
tradcpp runs on the build host but preprocesses dtlogin/config/*.src for the target. config.h used the compiler's OS, so a Linux->NetBSD cross build preprocessed the __linux__ branch of Xservers.src (tested before __NetBSD__) and installed /usr/pkg/dt/config/Xservers with '/usr/bin/X :0' and Xfailsafe with XDIR=/usr/bin; dtlogin had no server to start. configure.ac now derives MCDE_TRADCPP_CPPFLAGS from host_os and tradcpp takes CONFIG_OS_IDENT for CONFIG_OS. Measured 2026-11-15 (config.log build_os=linux-gnu host_os=netbsd) and by hand: tradcpp with -DCONFIG_OS_IDENT=__NetBSD__ emits ':0 Local local@console /usr/X11R7/bin/X :0', without it '/usr/bin/X :0'.
This commit is contained in:
1 parent
d17ad7a219
commit
7f80d71c74
3 files changed
+45
-1
No files matched your search
@@ -122,12 +122,14 @@ supports_pam=no
|
||||
case "${host_os}" in
|
||||
linux*)
|
||||
build_linux=yes
|
||||
mcde_config_os_ident=__linux__
|
||||
SOURCE_CPP_DEFINES="${SOURCE_CPP_DEFINES} -D_POSIX_SOURCE \
|
||||
-D_DEFAULT_SOURCE -D_BSD_SOURCE -D_SVID_SOURCE"
|
||||
supports_pam=yes
|
||||
;;
|
||||
freebsd*)
|
||||
build_freebsd=yes
|
||||
mcde_config_os_ident=__FreeBSD__
|
||||
bsd=yes
|
||||
# fbsd needs the iconv plug to avoid conflict with libiconv
|
||||
# and libc implementations. We prefer the libc impl.
|
||||
@@ -135,18 +137,22 @@ case "${host_os}" in
|
||||
;;
|
||||
openbsd*)
|
||||
build_openbsd=yes
|
||||
mcde_config_os_ident=__OpenBSD__
|
||||
bsd=yes
|
||||
;;
|
||||
netbsd*)
|
||||
build_netbsd=yes
|
||||
mcde_config_os_ident=__NetBSD__
|
||||
bsd=yes
|
||||
supports_pam=yes
|
||||
;;
|
||||
solaris*|sun*)
|
||||
build_solaris=yes
|
||||
mcde_config_os_ident=__sun
|
||||
;;
|
||||
aix*)
|
||||
build_aix=yes
|
||||
mcde_config_os_ident=_AIX
|
||||
;;
|
||||
esac
|
||||
|
||||
@@ -158,6 +164,25 @@ AM_CONDITIONAL([NETBSD], [test "$build_netbsd" = "yes"])
|
||||
AM_CONDITIONAL([SOLARIS], [test "$build_solaris" = "yes"])
|
||||
AM_CONDITIONAL([AIX], [test "$build_aix" = "yes"])
|
||||
|
||||
dnl tradcpp (util/tradcpp) is a build tool: it runs on the machine that builds
|
||||
dnl MCDE, but the files it preprocesses (programs/dtlogin/config/*.src and the
|
||||
dnl other .src templates) are for the TARGET. Left to itself its config.h names
|
||||
dnl the OS it was compiled on, so a cross build from Linux for NetBSD
|
||||
dnl preprocessed the Linux branch -- and Xservers.src tests __linux__ before
|
||||
dnl __NetBSD__: the installed dt/config/Xservers said "Local local_uid@tty1 root
|
||||
dnl /usr/bin/X :0", a server NetBSD does not have, so dtlogin found nothing to
|
||||
dnl start (measured 2026-11-15 in
|
||||
dnl build/pkgsrc-work/wm/mcde/work.NetBSD-11.99.9-x86_64: build_os linux-gnu,
|
||||
dnl host_os netbsd, config.log:4216/4226). The value is the macro NAME,
|
||||
dnl unquoted -- config.h stringifies it; a quoted one would have to survive the
|
||||
dnl shell, make and the compiler. No value (an OS this case does not know)
|
||||
dnl keeps config.h's own detection.
|
||||
MCDE_TRADCPP_CPPFLAGS=
|
||||
if test -n "$mcde_config_os_ident" ; then
|
||||
MCDE_TRADCPP_CPPFLAGS="-DCONFIG_OS_IDENT=$mcde_config_os_ident"
|
||||
fi
|
||||
AC_SUBST([MCDE_TRADCPP_CPPFLAGS])
|
||||
|
||||
dnl set CSRG_BASED define for the BSD's.
|
||||
if test "$bsd" = "yes"
|
||||
then
|
||||
|
||||
@@ -20,7 +20,10 @@ tradcpp_SOURCES = array.c directive.c files.c macro.h output.h \
|
||||
# build/logs/userland-2026-11-14k.log:7697). The whole program is a build
|
||||
# tool, so replace the generated variables for this sub-make only; the top
|
||||
# Makefile.am forwards them through AM_MAKEFLAGS.
|
||||
# $(MCDE_TRADCPP_CPPFLAGS) comes from configure.ac: it says which OS's macro
|
||||
# this build tool predefines -- the TARGET's, not the build host's (config.h
|
||||
# explains what went wrong without it).
|
||||
CC = $(CC_FOR_BUILD)
|
||||
CPPFLAGS = $(CPPFLAGS_FOR_BUILD)
|
||||
CPPFLAGS = $(CPPFLAGS_FOR_BUILD) $(MCDE_TRADCPP_CPPFLAGS)
|
||||
CFLAGS = $(CFLAGS_FOR_BUILD)
|
||||
LDFLAGS = $(LDFLAGS_FOR_BUILD)
|
||||
@@ -49,6 +49,22 @@
|
||||
* Operating system
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_OS_IDENT
|
||||
/*
|
||||
* MCDE: CONFIG_OS_IDENT is the macro name of the TARGET's OS, given by
|
||||
* configure from host_os (-DCONFIG_OS_IDENT=__NetBSD__). tradcpp runs on the
|
||||
* build host, but the files it preprocesses are for the target; taking this
|
||||
* machine's own OS made a Linux->NetBSD cross build preprocess the Linux
|
||||
* branch of programs/dtlogin/config/Xservers.src (it tests __linux__ before
|
||||
* __NetBSD__), so dtlogin's Xservers named /usr/bin/X, which NetBSD does not
|
||||
* have, and no display was started (measured 2026-11-15). The name arrives
|
||||
* unquoted, so stringify it.
|
||||
*/
|
||||
#define MCDE_OS_STRING_(x) #x
|
||||
#define MCDE_OS_STRING(x) MCDE_OS_STRING_(x)
|
||||
#define CONFIG_OS MCDE_OS_STRING(CONFIG_OS_IDENT)
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_OS
|
||||
#if defined(__NetBSD__)
|
||||
#define CONFIG_OS "__NetBSD__"
|
||||
|
||||
Reference in new issue
Block a user