From b41be1885a512ce1faa375b1fbe596f21e25aa35 Mon Sep 17 00:00:00 2001 From: lotherk Date: Mon, 16 Nov 2026 15:06:08 +0000 Subject: [PATCH] MCDE: the dthelp parser generators build for the host (t0230, block 1) Inventory of build/logs/mcde-allerrors-2026-11-14.log (the last docs-enabled cross build): 826 error lines, 774 of them Error 127 (a target binary run on the build host). The tools that were not found: instant 654 calls, dtcodegen 44, tt_type_comp 18, dtdocbook2infolib 14; 50 Error 1 come from the parser's missing context.h (the generators had not run), 2 from XDONE. instant is the SGML converter for both help volumes and man pages, so it is the next block. This block is the dthelp parser's own generators: pass1, canon1 and pass2 run "build" and "eltdef" while the parser is compiled, and they must run on the build host. Each of their directories now compiles for the host (CC, CPPFLAGS, CFLAGS, LDFLAGS from the *_FOR_BUILD values AM_MAKEFLAGS forwards, the same pattern as util/tradcpp and dtinfo/tools/misc), and links a new libutil_host.a built in util/ with CC_FOR_BUILD from the same sources as the target libutil.a (context/fclndir had that already; libutil.a stays target for the installed parser programs). Measured: make -C build/mcde-linux/programs/dthelp/parser clean, then make mcde-linux MCDE_DIRS="programs/dthelp/parser": exit=0, 0 Error lines; the log shows "ar cru libutil_host.a", "./build < .../hptag.dtd", "./eltdef ../helptag/help.if"; BDONE and EDONE are written; file(1) says pass1/build/build, pass1/eltdef/eltdef, pass2/build/build and pass2/eltdef/eltdef are x86-64 Linux ELF; the generated Makefile carries "CC = $(CC_FOR_BUILD)" after the configured CC. Still open for t0230: instant, dtdocbook2infolib and the pass1/2 parser (dthelp_htag2, run by dtdocbook2sdl) as host tools, then turn docs on in tools/pkgsrc-cross.mk.conf; man pages follow instant; dtappbuilder's dtcodegen and tt_type_comp are their own blocks. --- programs/dthelp/parser/canon1/build/Makefile.am | 13 +++++++++++-- .../dthelp/parser/canon1/eltdef/Makefile.am | 13 +++++++++++-- programs/dthelp/parser/canon1/util/Makefile.am | 17 +++++++++++++++-- programs/dthelp/parser/pass1/build/Makefile.am | 13 +++++++++++-- programs/dthelp/parser/pass1/eltdef/Makefile.am | 13 +++++++++++-- programs/dthelp/parser/pass1/util/Makefile.am | 17 +++++++++++++++-- programs/dthelp/parser/pass2/build/Makefile.am | 13 +++++++++++-- programs/dthelp/parser/pass2/eltdef/Makefile.am | 13 +++++++++++-- programs/dthelp/parser/pass2/util/Makefile.am | 17 +++++++++++++++-- 9 files changed, 111 insertions(+), 18 deletions(-) diff --git a/programs/dthelp/parser/canon1/build/Makefile.am b/programs/dthelp/parser/canon1/build/Makefile.am index 7b169c3b..a7474c51 100644 --- a/programs/dthelp/parser/canon1/build/Makefile.am +++ b/programs/dthelp/parser/canon1/build/Makefile.am @@ -4,6 +4,14 @@ MAINTAINERCLEANFILES = Makefile.in noinst_PROGRAMS = build +# build runs while the parser is built: it must run on the build host, so +# the whole sub-make compiles for the host (the same as util/tradcpp; the +# values come from AM_MAKEFLAGS in the top Makefile.am). t0230 +CC = $(CC_FOR_BUILD) +CPPFLAGS = $(CPPFLAGS_FOR_BUILD) +CFLAGS = $(CFLAGS_FOR_BUILD) +LDFLAGS = $(LDFLAGS_FOR_BUILD) + HELPTAG = .. HELPTAGSRC = $(HELPTAG)/helptag HELPPARSERSRC = $(HELPTAG)/parser @@ -13,9 +21,10 @@ HELPUTILSRC = $(HELPTAG)/util HELPBUILDSRC = $(HELPTAG)/build HELPUTILLIB = $(HELPTAG)/util/libutil.a -build_CFLAGS = -I$(HELPUTILSRC) +build_CFLAGS = $(CFLAGS_FOR_BUILD) -I$(HELPUTILSRC) -build_LDADD = ../util/libutil.a +build_LDADD = $(HELPUTILSRC)/libutil_host.a +build_DEPENDENCIES = $(HELPUTILSRC)/libutil_host.a build_SOURCES = build.c buildutl.c eltree.c except.c fsa.c out.c param.c \ scan.c sref.c tree.c diff --git a/programs/dthelp/parser/canon1/eltdef/Makefile.am b/programs/dthelp/parser/canon1/eltdef/Makefile.am index 315309c9..1cb0f498 100644 --- a/programs/dthelp/parser/canon1/eltdef/Makefile.am +++ b/programs/dthelp/parser/canon1/eltdef/Makefile.am @@ -4,6 +4,14 @@ MAINTAINERCLEANFILES = Makefile.in noinst_PROGRAMS = eltdef +# eltdef runs while the parser is built: it must run on the build host, so +# the whole sub-make compiles for the host (the same as util/tradcpp; the +# values come from AM_MAKEFLAGS in the top Makefile.am). t0230 +CC = $(CC_FOR_BUILD) +CPPFLAGS = $(CPPFLAGS_FOR_BUILD) +CFLAGS = $(CFLAGS_FOR_BUILD) +LDFLAGS = $(LDFLAGS_FOR_BUILD) + HELPTAG = .. HELPTAGSRC = $(HELPTAG)/helptag HELPPARSERSRC = $(HELPTAG)/parser @@ -15,9 +23,10 @@ HELPUTILLIB = $(HELPTAG)/util/libutil.a HELPIFFILE = $(HELPTAGSRC)/help.if HELPTSSFILE = $(HELPTAGSRC)/htag.tss -eltdef_LDADD = $(HELPUTILLIB) +eltdef_LDADD = $(HELPUTILSRC)/libutil_host.a +eltdef_DEPENDENCIES = $(HELPUTILSRC)/libutil_host.a -eltdef_CFLAGS = -I$(HELPUTILSRC) -I$(HELPBUILDSRC) +eltdef_CFLAGS = $(CFLAGS_FOR_BUILD) -I$(HELPUTILSRC) -I$(HELPBUILDSRC) eltdef_SOURCES = eltdef.c eltutil.c entity.c scan.c diff --git a/programs/dthelp/parser/canon1/util/Makefile.am b/programs/dthelp/parser/canon1/util/Makefile.am index 44043e9e..961b3e0e 100644 --- a/programs/dthelp/parser/canon1/util/Makefile.am +++ b/programs/dthelp/parser/canon1/util/Makefile.am @@ -10,9 +10,9 @@ noinst_LIBRARIES = libutil.a # Makefile.am) compiles them with the sources of libutil. HOSTUTIL_C = $(filter %.c,$(libutil_a_SOURCES)) EXTRA_DIST = context.c -CLEANFILES = context fclndir +CLEANFILES = context fclndir hostobj libutil_host.a -all-local: context fclndir +all-local: context fclndir libutil_host.a context: context.c $(HOSTUTIL_C) $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(CPPFLAGS_FOR_BUILD) -I. -I$(srcdir) -o $@ $(srcdir)/context.c $(addprefix $(srcdir)/,$(HOSTUTIL_C)) $(LDFLAGS_FOR_BUILD) @@ -20,6 +20,19 @@ context: context.c $(HOSTUTIL_C) fclndir: context cp context fclndir +# the same sources for the build host: the parser generators (build, +# eltdef) link this archive, and its objects must be the host's (t0230) +libutil_host.a: $(HOSTUTIL_C) + $(RM) -rf hostobj $@ + mkdir -p hostobj + for f in $(HOSTUTIL_C); do \ + $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(CPPFLAGS_FOR_BUILD) \ + -I. -I$(srcdir) -c $(srcdir)/$$f -o hostobj/`basename $$f .c`.o \ + || exit 1; \ + done + $(AR_FOR_BUILD) cru $@ hostobj/*.o + $(RANLIB_FOR_BUILD) $@ + libutil_a_SOURCES = allwhite.c inctest.c letter.c triedump.c \ triepdmp.c trieplk.c trierset.c upcmp8.c upstrcmp.c wchar.c \ conutil.c error.c exit.c itoa.c malloc.c openchk.c \ diff --git a/programs/dthelp/parser/pass1/build/Makefile.am b/programs/dthelp/parser/pass1/build/Makefile.am index 4804ecde..4b2dae10 100644 --- a/programs/dthelp/parser/pass1/build/Makefile.am +++ b/programs/dthelp/parser/pass1/build/Makefile.am @@ -2,6 +2,14 @@ MAINTAINERCLEANFILES = Makefile.in noinst_PROGRAMS = build +# build runs while the parser is built: it must run on the build host, so +# the whole sub-make compiles for the host (the same as util/tradcpp; the +# values come from AM_MAKEFLAGS in the top Makefile.am). t0230 +CC = $(CC_FOR_BUILD) +CPPFLAGS = $(CPPFLAGS_FOR_BUILD) +CFLAGS = $(CFLAGS_FOR_BUILD) +LDFLAGS = $(LDFLAGS_FOR_BUILD) + .NOTPARALLEL: HELPTAG = .. @@ -13,9 +21,10 @@ HELPUTILSRC = $(HELPTAG)/util HELPBUILDSRC = $(HELPTAG)/build HELPUTILLIB = $(HELPTAG)/util/libutil.a -build_CFLAGS = -I$(HELPUTILSRC) +build_CFLAGS = $(CFLAGS_FOR_BUILD) -I$(HELPUTILSRC) -build_LDADD = ../util/libutil.a +build_LDADD = $(HELPUTILSRC)/libutil_host.a +build_DEPENDENCIES = $(HELPUTILSRC)/libutil_host.a build_SOURCES = build.c buildutl.c eltree.c except.c fsa.c out.c param.c \ scan.c sref.c tree.c diff --git a/programs/dthelp/parser/pass1/eltdef/Makefile.am b/programs/dthelp/parser/pass1/eltdef/Makefile.am index 9d045324..fdd444ab 100644 --- a/programs/dthelp/parser/pass1/eltdef/Makefile.am +++ b/programs/dthelp/parser/pass1/eltdef/Makefile.am @@ -2,6 +2,14 @@ MAINTAINERCLEANFILES = Makefile.in noinst_PROGRAMS = eltdef +# eltdef runs while the parser is built: it must run on the build host, so +# the whole sub-make compiles for the host (the same as util/tradcpp; the +# values come from AM_MAKEFLAGS in the top Makefile.am). t0230 +CC = $(CC_FOR_BUILD) +CPPFLAGS = $(CPPFLAGS_FOR_BUILD) +CFLAGS = $(CFLAGS_FOR_BUILD) +LDFLAGS = $(LDFLAGS_FOR_BUILD) + HELPTAG = .. HELPTAGSRC = $(HELPTAG)/helptag HELPPARSERSRC = $(HELPTAG)/parser @@ -13,9 +21,10 @@ HELPUTILLIB = $(HELPTAG)/util/libutil.a HELPIFFILE = $(HELPTAGSRC)/help.if HELPTSSFILE = $(HELPTAGSRC)/htag.tss -eltdef_LDADD = $(HELPUTILLIB) +eltdef_LDADD = $(HELPUTILSRC)/libutil_host.a +eltdef_DEPENDENCIES = $(HELPUTILSRC)/libutil_host.a -eltdef_CFLAGS = -I$(HELPUTILSRC) -I$(HELPBUILDSRC) +eltdef_CFLAGS = $(CFLAGS_FOR_BUILD) -I$(HELPUTILSRC) -I$(HELPBUILDSRC) eltdef_SOURCES = eltdef.c eltutil.c entity.c scan.c diff --git a/programs/dthelp/parser/pass1/util/Makefile.am b/programs/dthelp/parser/pass1/util/Makefile.am index 44043e9e..961b3e0e 100644 --- a/programs/dthelp/parser/pass1/util/Makefile.am +++ b/programs/dthelp/parser/pass1/util/Makefile.am @@ -10,9 +10,9 @@ noinst_LIBRARIES = libutil.a # Makefile.am) compiles them with the sources of libutil. HOSTUTIL_C = $(filter %.c,$(libutil_a_SOURCES)) EXTRA_DIST = context.c -CLEANFILES = context fclndir +CLEANFILES = context fclndir hostobj libutil_host.a -all-local: context fclndir +all-local: context fclndir libutil_host.a context: context.c $(HOSTUTIL_C) $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(CPPFLAGS_FOR_BUILD) -I. -I$(srcdir) -o $@ $(srcdir)/context.c $(addprefix $(srcdir)/,$(HOSTUTIL_C)) $(LDFLAGS_FOR_BUILD) @@ -20,6 +20,19 @@ context: context.c $(HOSTUTIL_C) fclndir: context cp context fclndir +# the same sources for the build host: the parser generators (build, +# eltdef) link this archive, and its objects must be the host's (t0230) +libutil_host.a: $(HOSTUTIL_C) + $(RM) -rf hostobj $@ + mkdir -p hostobj + for f in $(HOSTUTIL_C); do \ + $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(CPPFLAGS_FOR_BUILD) \ + -I. -I$(srcdir) -c $(srcdir)/$$f -o hostobj/`basename $$f .c`.o \ + || exit 1; \ + done + $(AR_FOR_BUILD) cru $@ hostobj/*.o + $(RANLIB_FOR_BUILD) $@ + libutil_a_SOURCES = allwhite.c inctest.c letter.c triedump.c \ triepdmp.c trieplk.c trierset.c upcmp8.c upstrcmp.c wchar.c \ conutil.c error.c exit.c itoa.c malloc.c openchk.c \ diff --git a/programs/dthelp/parser/pass2/build/Makefile.am b/programs/dthelp/parser/pass2/build/Makefile.am index c2fc5e0b..ebab4a2e 100644 --- a/programs/dthelp/parser/pass2/build/Makefile.am +++ b/programs/dthelp/parser/pass2/build/Makefile.am @@ -4,6 +4,14 @@ MAINTAINERCLEANFILES = Makefile.in noinst_PROGRAMS = build +# build runs while the parser is built: it must run on the build host, so +# the whole sub-make compiles for the host (the same as util/tradcpp; the +# values come from AM_MAKEFLAGS in the top Makefile.am). t0230 +CC = $(CC_FOR_BUILD) +CPPFLAGS = $(CPPFLAGS_FOR_BUILD) +CFLAGS = $(CFLAGS_FOR_BUILD) +LDFLAGS = $(LDFLAGS_FOR_BUILD) + HTAG2 = .. HTAG2SRC = $(HTAG2)/htag2 SDLPARSERSRC = $(HTAG2)/parser @@ -14,9 +22,10 @@ SDLBUILDSRC = $(HTAG2)/build SDLUTILLIB = $(HTAG2)/util/libutil.a SDLIFFILE = $(HTAG2SRC)/help.if -build_CFLAGS = -I$(SDLUTILSRC) +build_CFLAGS = $(CFLAGS_FOR_BUILD) -I$(SDLUTILSRC) -build_LDADD = ../util/libutil.a +build_LDADD = $(SDLUTILSRC)/libutil_host.a +build_DEPENDENCIES = $(SDLUTILSRC)/libutil_host.a build_SOURCES = build.c buildutl.c eltree.c except.c fsa.c out.c param.c \ scan.c sref.c tree.c diff --git a/programs/dthelp/parser/pass2/eltdef/Makefile.am b/programs/dthelp/parser/pass2/eltdef/Makefile.am index 0e79910a..86f87ebd 100644 --- a/programs/dthelp/parser/pass2/eltdef/Makefile.am +++ b/programs/dthelp/parser/pass2/eltdef/Makefile.am @@ -4,6 +4,14 @@ MAINTAINERCLEANFILES = Makefile.in noinst_PROGRAMS = eltdef +# eltdef runs while the parser is built: it must run on the build host, so +# the whole sub-make compiles for the host (the same as util/tradcpp; the +# values come from AM_MAKEFLAGS in the top Makefile.am). t0230 +CC = $(CC_FOR_BUILD) +CPPFLAGS = $(CPPFLAGS_FOR_BUILD) +CFLAGS = $(CFLAGS_FOR_BUILD) +LDFLAGS = $(LDFLAGS_FOR_BUILD) + HTAG2 = .. HTAG2SRC = $(HTAG2)/htag2 SDLPARSERSRC = $(HTAG2)/parser @@ -14,9 +22,10 @@ SDLBUILDSRC = $(HTAG2)/build SDLUTILLIB = $(HTAG2)/util/libutil.a SDLIFFILE = $(HTAG2SRC)/sdl.if -eltdef_LDADD = $(SDLUTILLIB) +eltdef_LDADD = $(SDLUTILSRC)/libutil_host.a +eltdef_DEPENDENCIES = $(SDLUTILSRC)/libutil_host.a -eltdef_CFLAGS = -I$(SDLUTILSRC) -I$(SDLBUILDSRC) +eltdef_CFLAGS = $(CFLAGS_FOR_BUILD) -I$(SDLUTILSRC) -I$(SDLBUILDSRC) eltdef_SOURCES = eltdef.c eltutil.c entity.c scan.c diff --git a/programs/dthelp/parser/pass2/util/Makefile.am b/programs/dthelp/parser/pass2/util/Makefile.am index 1d8e1f07..a4f494e9 100644 --- a/programs/dthelp/parser/pass2/util/Makefile.am +++ b/programs/dthelp/parser/pass2/util/Makefile.am @@ -12,9 +12,9 @@ noinst_LIBRARIES = libutil.a # Makefile.am) compiles them with the sources of libutil. HOSTUTIL_C = $(filter %.c,$(libutil_a_SOURCES)) EXTRA_DIST = context.c -CLEANFILES = context fclndir +CLEANFILES = context fclndir hostobj libutil_host.a -all-local: context fclndir +all-local: context fclndir libutil_host.a context: context.c $(HOSTUTIL_C) $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(CPPFLAGS_FOR_BUILD) -I. -I$(srcdir) -o $@ $(srcdir)/context.c $(addprefix $(srcdir)/,$(HOSTUTIL_C)) $(LDFLAGS_FOR_BUILD) @@ -22,6 +22,19 @@ context: context.c $(HOSTUTIL_C) fclndir: context cp context fclndir +# the same sources for the build host: the parser generators (build, +# eltdef) link this archive, and its objects must be the host's (t0230) +libutil_host.a: $(HOSTUTIL_C) + $(RM) -rf hostobj $@ + mkdir -p hostobj + for f in $(HOSTUTIL_C); do \ + $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(CPPFLAGS_FOR_BUILD) \ + -I. -I$(srcdir) -c $(srcdir)/$$f -o hostobj/`basename $$f .c`.o \ + || exit 1; \ + done + $(AR_FOR_BUILD) cru $@ hostobj/*.o + $(RANLIB_FOR_BUILD) $@ + libutil_a_SOURCES = allwhite.c inctest.c letter.c triedump.c \ triepdmp.c trieplk.c trierset.c upcmp8.c upstrcmp.c wchar.c \ conutil.c error.c exit.c itoa.c malloc.c openchk.c \