From acc6ab409c101f468a96e29103017db94ccfa423 Mon Sep 17 00:00:00 2001 From: Julian Noble Date: Tue, 21 Jul 2026 02:25:24 +1000 Subject: [PATCH] G-102: build.zig entry shim; deterministic critcl target; zig pin in comptime gate Three deltas surfaced by the PATH-scrubbed clean-checkout demonstration: - build.zig: default-entry re-export of build905.zig's build so the documented plain 'zig build stage|bootstrap' works from the tracked suite dir (the recipe keeps its versioned filename; staged flows still invoke it via --build-file). - critcl_zig.config + recipe: settings move under an EXPLICIT target (win32-x86_64-zig) and the tcllibc step passes -target win32-x86_64-zig. critcl otherwise chooses its build target by probing PATH for compilers - with a gcc visible the config defaults engaged (why G-098's flow worked), but the scrubbed environment fell back to critcl's builtin msvc 'cl' target and all 25 accelerator modules failed with "couldn't execute cl". Verified green in BOTH environments (scrubbed and normal PATH). - build905.zig comptime gate: the stale 0.13-dev minimum becomes the actual suite pin (0.16.0) with a message pointing at punk-getzig and the README (acceptance: the recipe records the zig version it is written against). Assisted-by: harness=claude; primary-model=claude-fable-5; api-location=anthropic.com --- src/buildsuites/suite_tcl90/build.zig | 7 +++ src/buildsuites/suite_tcl90/build905.zig | 22 ++++---- src/buildsuites/suite_tcl90/critcl_zig.config | 55 +++++++++++-------- 3 files changed, 51 insertions(+), 33 deletions(-) create mode 100644 src/buildsuites/suite_tcl90/build.zig diff --git a/src/buildsuites/suite_tcl90/build.zig b/src/buildsuites/suite_tcl90/build.zig new file mode 100644 index 00000000..588b9a34 --- /dev/null +++ b/src/buildsuites/suite_tcl90/build.zig @@ -0,0 +1,7 @@ +//build.zig - default-entry shim so plain 'zig build ' works from this +//directory (the bootstrap-flow invocations in the README). The recipe itself +//lives in build905.zig - a deliberately VERSIONED name (the staged flows invoke +//it explicitly via --build-file, and a future suite may carry more than one +//recipe file). build.zig.zon beside this file serves both entry points. +const recipe = @import("build905.zig"); +pub const build = recipe.build; diff --git a/src/buildsuites/suite_tcl90/build905.zig b/src/buildsuites/suite_tcl90/build905.zig index 1ed63792..ce47d15f 100644 --- a/src/buildsuites/suite_tcl90/build905.zig +++ b/src/buildsuites/suite_tcl90/build905.zig @@ -44,20 +44,17 @@ var static_build: bool = true; //} comptime { - //const required_zig = "0.14.0-dev.300"; - const required_zig = "0.13.0-dev.8"; + //The suite pin (G-102 acceptance: the recipe records the zig version it is + //written against). The recipe is 0.16-API and does not build under 0.14/0.15; + //punk-getzig materializes the pinned toolchain (see README Pinned zig). + const required_zig = "0.16.0"; const current_zig = builtin.zig_version; const min_zig = std.SemanticVersion.parse(required_zig) catch unreachable; if (current_zig.order(min_zig) == .lt) { const error_message = - \\Sorry, it looks like your version of zig is too old. :-( - \\ - \\punk tcl requires development build {} - \\ - \\Please download a development ("master") build from - \\ - \\https://ziglang.org/download/ - \\ + \\This recipe is written against zig {} (see README Pinned zig) and + \\does not build with older zigs. bin/punk-getzig fetches the pinned + \\toolchain; https://ziglang.org/download/ hosts releases. \\ ; @compileError(std.fmt.comptimePrint(error_message, .{min_zig})); @@ -2298,6 +2295,11 @@ pub fn build(b: *std.Build) !void { critcl_run.addFileArg(b.path("../critcl/main.tcl")); critcl_run.addArg("-config"); critcl_run.addFileArg(b.path("critcl_zig.config")); + //pin the build target to the config's explicit section: critcl otherwise + //GUESSES its target by probing PATH for compilers - with a gcc visible the + //config defaults engaged, but a scrubbed environment fell back to critcl's + //builtin msvc 'cl' target and never used the zig cc settings (G-102 finding). + critcl_run.addArgs(&.{ "-target", "win32-x86_64-zig" }); critcl_run.addArg("-cache"); _ = critcl_run.addOutputDirectoryArg("critcl-cache"); critcl_run.addArg("-force"); diff --git a/src/buildsuites/suite_tcl90/critcl_zig.config b/src/buildsuites/suite_tcl90/critcl_zig.config index 12af67b5..e38ce851 100644 --- a/src/buildsuites/suite_tcl90/critcl_zig.config +++ b/src/buildsuites/suite_tcl90/critcl_zig.config @@ -1,25 +1,34 @@ -# suite_tcl90 critcl configuration: zig cc as the C toolchain (G-098). -# Overrides critcl's gcc-style defaults; 'zig' is resolved from PATH - the suite -# driver prepends the pinned bin/tools zig dir for the critcl invocation. -# Target is the native windows-gnu triple (matches the suite's tcl runtime ABI). +# suite_tcl90 critcl configuration: zig cc as the C toolchain (G-098, G-102). +# 'zig' is resolved from PATH - the suite recipe prepends the pinned bin/tools zig +# dir for the critcl invocation. Target is the native windows-gnu triple (matches +# the suite's tcl runtime ABI). +# +# The settings live under an EXPLICIT target, win32-x86_64-zig, and the recipe +# invokes critcl with '-target win32-x86_64-zig': critcl otherwise chooses its +# build target by PROBING the environment for compilers, which made the selection +# depend on what happened to be on PATH (a visible gcc landed on the config +# defaults; a scrubbed environment fell back to critcl's builtin msvc 'cl' +# target and never used these settings - G-102 finding). platform win32-x86_64 -compile zig cc -target x86_64-windows-gnu -c -fPIC -version zig version -link zig cc -target x86_64-windows-gnu -shared -include -I -libinclude -L -object .o -output -o [list $outfile] -optimize -O2 -noassert -DNDEBUG -tclstubs -DUSE_TCL_STUBS -tkstubs -DUSE_TK_STUBS -debug_symbols -g -strip -Wl,-s -link_debug -link_release -embed_manifest -ldoutput -link_preload -sharedlibext .dll + +win32-x86_64-zig platform win32-x86_64 +win32-x86_64-zig compile zig cc -target x86_64-windows-gnu -c -fPIC +win32-x86_64-zig version zig version +win32-x86_64-zig link zig cc -target x86_64-windows-gnu -shared +win32-x86_64-zig include -I +win32-x86_64-zig libinclude -L +win32-x86_64-zig object .o +win32-x86_64-zig output -o [list $outfile] +win32-x86_64-zig optimize -O2 +win32-x86_64-zig noassert -DNDEBUG +win32-x86_64-zig tclstubs -DUSE_TCL_STUBS +win32-x86_64-zig tkstubs -DUSE_TK_STUBS +win32-x86_64-zig debug_symbols -g +win32-x86_64-zig strip -Wl,-s +win32-x86_64-zig link_debug +win32-x86_64-zig link_release +win32-x86_64-zig embed_manifest +win32-x86_64-zig ldoutput +win32-x86_64-zig link_preload +win32-x86_64-zig sharedlibext .dll