manibuilder: Use `test_build.sh'

Use `test_build.sh' to test builds with both Make and Meson, and to
compare the results. To succeed, the $(MESONARGS) have to mimic the
behavior of `CONFIG_EVERYTHING=yes'.

In the long run, we might want to use the version shipped with mani-
builder instead of the tested flashprog version. Otherwise, we won't
be able to test older revisions of flashprog with newer manibuilder.

Change-Id: Ife327e2f3e2fa9acbbfd1fa51ec0aa3c3f2489b8
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.sourcearcade.org/c/flashprog/+/144
diff --git a/util/manibuilder/Makefile b/util/manibuilder/Makefile
index fe5cdcf..f779356 100644
--- a/util/manibuilder/Makefile
+++ b/util/manibuilder/Makefile
@@ -5,6 +5,8 @@
 CC := ccache cc
 MAKECMD := make
 MAKEARGS := CONFIG_EVERYTHING=yes
+MESONCMD := meson
+MESONARGS := -D programmer=all -D classic_cli_print_wiki=enabled --auto-features enabled
 
 spc :=
 spc := $(spc) $(spc)
@@ -62,11 +64,11 @@
 		--name mani_$(call ident,$*) mani/$* \
 		"git fetch $(TEST_REMOTE) $(TEST_REVISION) && \
 		 git checkout FETCH_HEAD && \
-		 export $(ENV_VARS) && \
-		 $(MAKECMD) clean && $(MAKECMD) -j$${CPUS:-1} CC='$(CC)' \
-		 $(if $(STRIP),STRIP='$(STRIP)') \
-		 $(if $(LIBS_BASE),LIBS_BASE='$(LIBS_BASE)') \
-		 $(MAKEARGS)" \
+		 export CC='$(CC)' STRIP='$(STRIP)' LIBS_BASE='$(LIBS_BASE)' && \
+		 export MAKECMD='$(MAKECMD)' MAKEARGS='$(subst ',\\\",$(MAKEARGS))' && \
+		 export MESONCMD='$(MESONCMD)' MESONARGS='$(subst ',\\\",$(MESONARGS))' && \
+		 export CPUS=$${CPUS:-1} $(ENV_VARS) && \
+		 ./test_build.sh" \
 		$(if $(QUIET_TEST),>/dev/null 2>&1) \
 			|| { RET=$$?; echo $*: $${RET}; exit $${RET}; }
 
diff --git a/util/manibuilder/Makefile.env b/util/manibuilder/Makefile.env
index 6448b1b..7264bb5 100644
--- a/util/manibuilder/Makefile.env
+++ b/util/manibuilder/Makefile.env
@@ -2,11 +2,13 @@
 $(ALMALINUX_TAGS) $(filter centos\:%, $(MULTIARCH_TAGS)): CC=cc
 
 # DJGPP is very special
+djgpp\:6.1.0: ENV_VARS=CROSS_COMPILE=i586-pc-msdosdjgpp-
 djgpp\:6.1.0: CC=ccache i586-pc-msdosdjgpp-gcc
 djgpp\:6.1.0: STRIP=i586-pc-msdosdjgpp-strip
 djgpp\:6.1.0: LIBS_BASE=../
 djgpp\:6.1.0: MAKEARGS+=HAS_LIBPCI=yes CONFIG_LIBPCI_LDFLAGS=-lpci
 djgpp\:6.1.0: MAKEARGS+=strip
+djgpp\:6.1.0: MESONCMD=
 
 # Compiler doesn't like simplified initializers, e.g. `= { 0 };`
 $(filter centos\:%, $(MULTIARCH_TAGS)): MAKEARGS+=WARNERROR=no
@@ -33,3 +35,12 @@
 	$(filter alpine\:% centos\:% %-xenial %-stretch, $(MULTIARCH_TAGS)) \
 
 $(NO_LIBJAYLINK_TAGS): MAKEARGS+=CONFIG_JLINK_SPI=no
+
+# No compatible Meson
+NO_MESON_TAGS := \
+	$(filter anita\:7.%, $(ANITA_TAGS)) \
+	$(filter centos\:% %-bionic %-xenial %-buster %-stretch, $(MULTIARCH_TAGS)) \
+	$(foreach v, 24 25 29 30 31, $(filter fedora\:$(v)-%, $(MULTIARCH_TAGS))) \
+	$(foreach v, 3.6 3.7 3.8 3.9 3.10 3.11, $(filter alpine\:%-v$(v), $(MULTIARCH_TAGS))) \
+
+$(NO_MESON_TAGS): MESONCMD=