Splux Linux

source-based Linux using SPS

SPS · log · files · refs · tags · releases · people · languages · GitHub · commit

b669103


Put GNU m4 on the live PATH so autoconf can configure.

Date
Commitb66910330926bfed076c560f5ee8fa86cdfa51ea
GitHubmirror

Parents

Stat

 bin/mkpkg           |  7 +++++--
 lib/mkiso/seed-bins |  1 +
 man/mkiso.1         |  1 +
 tests/test_build.sh | 30 ++++++++++++++++++++++++++++++
 tests/test_mkiso.sh |  4 ++++
 5 files changed, 41 insertions(+), 2 deletions(-)

Diff

diff --git a/bin/mkpkg b/bin/mkpkg
index 0171c8f..73455ae 100755
--- a/bin/mkpkg
+++ b/bin/mkpkg
@@ -771,12 +771,15 @@ if [ -n "$build_root" ]; then
 	fi
 	say "using build root $build_root"
 elif [ -n "$wrapper_bin" ]; then
-	run_env="PATH=$wrapper_bin:$PATH"
+	run_env="PATH=$wrapper_bin:${SPS_ROOT%/}/usr/bin:$PATH"
 else
 	run_env=
 fi
 
 # Live setup builds into SPS_ROOT (a mounted disk) with the live compiler.
+# Autoconf's configure looks up GNU m4 on PATH. m4 is a runtime depend, so
+# sget installs it into the target before autoconf builds; that bin dir
+# must be on PATH. The live disc also seeds /usr/bin/m4.
 # The live disc copies host /usr/include (so ALSA headers exist) but not
 # host libasound. gcc must search packages pkin already unpacked into the
 # target, not only live /usr. Exporting LDFLAGS is not enough: autoconf
@@ -916,7 +919,7 @@ run_phase()
 			SYSROOT=$build_root
 			export PATH SYSROOT
 		elif [ -n "$wrapper_bin" ]; then
-			PATH=$wrapper_bin:$PATH
+			PATH=$wrapper_bin:${SPS_ROOT%/}/usr/bin:$PATH
 			export PATH
 		fi
 		sh -eu "$phase_file"
diff --git a/lib/mkiso/seed-bins b/lib/mkiso/seed-bins
index 41d7747..80693e9 100644
--- a/lib/mkiso/seed-bins
+++ b/lib/mkiso/seed-bins
@@ -27,6 +27,7 @@
 /usr/bin/python3
 /usr/bin/python3.12
 /usr/bin/perl
+/usr/bin/m4
 /usr/bin/pod2man
 /usr/bin/pod2text
 /usr/bin/pod2html
diff --git a/man/mkiso.1 b/man/mkiso.1
index e6b7240..f50de4e 100644
--- a/man/mkiso.1
+++ b/man/mkiso.1
@@ -41,6 +41,7 @@ writes the live root only, for tests and inspection.
 Host compiler tools can be copied into the image so
 .B setup
 can build packages from the bundled recipes. The seed includes gcc,
+GNU m4 (autoconf's configure refuses a disc without it),
 the Python stdlib, Meson as
 .B meson.py
 next to
diff --git a/tests/test_build.sh b/tests/test_build.sh
index a3c3cb8..0009fe4 100755
--- a/tests/test_build.sh
+++ b/tests/test_build.sh
@@ -318,4 +318,34 @@ EOF
 		fail "runtime probe binary was not staged"
 fi
 
+# Autoconf configure requires GNU m4 on PATH. sget installs m4 into
+# SPS_ROOT first; mkpkg must search that /usr/bin ahead of the live disc.
+mkdir -p "$tmp/root/usr/bin" "$tmp/m4-recipe" "$tmp/m4-out"
+printf '%s\n' '#!/bin/sh' 'exit 0' >"$tmp/root/usr/bin/m4"
+chmod 755 "$tmp/root/usr/bin/m4"
+cat >"$tmp/m4-recipe/recipe" <<'EOF'
+name        target-m4-path-probe
+version     1.0
+release     1
+arch        any
+description Confirms SPS_ROOT/usr/bin is on PATH so autoconf can find m4
+configure   command -v m4 >"$WORK/m4"
+configure   printf '%s\n' "$PATH" >"$WORK/path"
+configure   m4 >/dev/null
+install     mkdir -p "$PKG/usr/share/target-m4-path-probe"
+install     cp "$WORK/m4" "$WORK/path" "$PKG/usr/share/target-m4-path-probe/"
+EOF
+m4_artifact=$(run_mkpkg --no-download --output "$tmp/m4-out" \
+	"$tmp/m4-recipe/recipe") ||
+	fail "target-root m4 PATH probe failed (autoconf needs GNU m4 on PATH)"
+mkdir "$tmp/m4-extract"
+tar -xf "$m4_artifact" -C "$tmp/m4-extract"
+assert_equal "$tmp/root/usr/bin/m4" \
+	"$(cat "$tmp/m4-extract/usr/share/target-m4-path-probe/m4")" \
+	"configure did not find m4 from SPS_ROOT/usr/bin"
+case "$(cat "$tmp/m4-extract/usr/share/target-m4-path-probe/path")" in
+	"$tmp/root/usr/bin:"*|*/run:"$tmp/root/usr/bin:"*) : ;;
+	*) fail "SPS_ROOT/usr/bin was not on PATH ahead of the host" ;;
+esac
+
 printf '%s\n' 'test_build: ok'
diff --git a/tests/test_mkiso.sh b/tests/test_mkiso.sh
index 94851eb..313fa29 100755
--- a/tests/test_mkiso.sh
+++ b/tests/test_mkiso.sh
@@ -278,6 +278,8 @@ then
 fi
 grep -q 'copying file(1) magic database' "$mkiso" ||
 	fail 'seeded ISO must copy file(1) magic for autoconf'
+grep -q /usr/bin/m4 "$project_dir/lib/mkiso/seed-bins" ||
+	fail 'seeded ISO must include GNU m4 for autoconf'
 grep -q /usr/bin/msgfmt "$project_dir/lib/mkiso/seed-bins" ||
 	fail 'seeded ISO must include msgfmt for alsa-utils translations'
 grep -q /usr/bin/xgettext "$project_dir/lib/mkiso/seed-bins" ||
@@ -361,6 +363,8 @@ grep -q OPENSSL_MODULES "$project_dir/bin/mkpkg" ||
 	fail 'mkpkg must point OpenSSL at SPS_ROOT providers during target builds'
 grep -q CONFIG_SITE "$project_dir/bin/mkpkg" ||
 	fail 'mkpkg must export CONFIG_SITE so autoconf sees SPS_ROOT LDFLAGS'
+grep -q 'SPS_ROOT%/}/usr/bin' "$project_dir/bin/mkpkg" ||
+	fail 'mkpkg must put SPS_ROOT/usr/bin on PATH so autoconf finds m4'
 grep -q 'sps_say "unpacking' "$project_dir/bin/pkin" ||
 	fail 'pkin must log unpacking'
 grep -q sps_verbose_say "$project_dir/bin/pkin" ||