Browse Source
Clone dbs are caches, not build output: punkshell-owned machine-level store at ~/.punkshell/fossils (independent of personal ~/.fossils, outside deletable _build dirs), read-only seeding from ~/.fossils, -repofolder / PUNK_FOSSIL_STORE override (registered in punk::config for 'help env'), -refresh pulls clones. Verified seed->open->build->smoke from empty store, then migrated + re-verified. Sources wired: tk core-9-0-branch (9.0.2, stale clone pulled current), tklib + tcllib trunk. build_tk/build_tk.zig (0.16 API): tcl9tk90.dll from stock sources per makefile.vc object inventory (+ xlib emulation set), ansi/UNICODE tkMain pair with forced -U ansi guard, CFG_* defines, win/rc/tk.rc with explicit rc include paths, oleaut32 et al; tk library -> lib/tk9.0 with driver-generated tkUuid.h, wish.exe.manifest and pkgIndex.tcl. SMOKE PASS: package require Tk -> 9.0.2, screen queried, widget packed/updated, clean destroy, in the suite-built tclsh90s. Assisted-by: harness=claude; primary-model=claude-fable-5; api-location=anthropic.commaster
9 changed files with 325 additions and 18 deletions
@ -0,0 +1,153 @@ |
|||||||
|
const std = @import("std"); |
||||||
|
|
||||||
|
//G-098: Tk 9.0 windows loadable extension (tcl9tk90.dll) from stock sources, plus the |
||||||
|
//tk script library installed to lib/tk9.0. Object inventory derived from |
||||||
|
//tk/win/makefile.vc TKOBJS + TTK_OBJS (tk 9.0.2 era); tkStubLib/ttkStubLib are the |
||||||
|
//stub-consumer archive objects and deliberately NOT compiled into the dll. |
||||||
|
//tkMain.c is compiled twice like tcl's tclMain (ansi + UNICODE 'tkMain2' per the |
||||||
|
//makefile); the ansi copy gets explicit -UUNICODE/-U_UNICODE so the zig cc driver's |
||||||
|
//windows defaults cannot turn it into a duplicate UNICODE compile (G-096 finding). |
||||||
|
|
||||||
|
const generic_names = [_][]const u8{ |
||||||
|
"tkConsole", "tk3d", "tkArgv", "tkAtom", "tkBind", |
||||||
|
"tkBitmap", "tkBusy", "tkButton", "tkCanvArc", "tkCanvBmap", |
||||||
|
"tkCanvImg", "tkCanvLine", "tkCanvPoly", "tkCanvPs", "tkCanvText", |
||||||
|
"tkCanvUtil", "tkCanvWind", "tkCanvas", "tkClipboard", "tkCmds", |
||||||
|
"tkColor", "tkConfig", "tkCursor", "tkEntry", "tkError", |
||||||
|
"tkEvent", "tkFileFilter", "tkFocus", "tkFont", "tkFrame", |
||||||
|
"tkGC", "tkGeometry", "tkGet", "tkGrab", "tkGrid", |
||||||
|
"tkIcu", "tkImage", "tkImgBmap", "tkImgListFormat", "tkImgGIF", |
||||||
|
"tkImgPNG", "tkImgPPM", "tkImgSVGnano", "tkImgPhoto", "tkImgPhInstance", |
||||||
|
"tkImgUtil", "tkListbox", "tkMacWinMenu", "tkMenu", "tkMenubutton", |
||||||
|
"tkMenuDraw", "tkMessage", "tkPanedWindow", "tkObj", "tkOldConfig", |
||||||
|
"tkOption", "tkPack", "tkPkgConfig", "tkPlace", "tkPointer", |
||||||
|
"tkRectOval", "tkScale", "tkScrollbar", "tkSelect", "tkStyle", |
||||||
|
"tkText", "tkTextBTree", "tkTextDisp", "tkTextImage", "tkTextIndex", |
||||||
|
"tkTextMark", "tkTextTag", "tkTextWind", "tkTrig", "tkUndo", |
||||||
|
"tkUtil", "tkVisual", "tkStubInit", "tkWindow", |
||||||
|
}; |
||||||
|
const unix_names = [_][]const u8{ "tkUnixMenubu", "tkUnixScale" }; |
||||||
|
const xlib_names = [_][]const u8{ "xcolors", "xdraw", "xgc", "ximage", "xutil" }; |
||||||
|
const win_names = [_][]const u8{ |
||||||
|
"tkWin3d", "tkWin32Dll", "tkWinButton", "tkWinClipboard", "tkWinColor", |
||||||
|
"tkWinConfig", "tkWinCursor", "tkWinDialog", "tkWinDraw", "tkWinEmbed", |
||||||
|
"tkWinFont", "tkWinGDI", "tkWinIco", "tkWinImage", "tkWinInit", |
||||||
|
"tkWinKey", "tkWinMenu", "tkWinPixmap", "tkWinPointer", "tkWinRegion", |
||||||
|
"tkWinScrlbr", "tkWinSend", "tkWinSendCom", "tkWinSysTray", "tkWinWindow", |
||||||
|
"tkWinWm", "tkWinX", "stubs", |
||||||
|
"ttkWinMonitor", "ttkWinTheme", "ttkWinXPTheme", |
||||||
|
}; |
||||||
|
const ttk_names = [_][]const u8{ |
||||||
|
"ttkBlink", "ttkButton", |
||||||
|
"ttkCache", "ttkClamTheme", "ttkClassicTheme", "ttkDefaultTheme", "ttkElements", |
||||||
|
"ttkEntry", "ttkFrame", "ttkImage", "ttkInit", "ttkLabel", |
||||||
|
"ttkLayout", "ttkManager", "ttkNotebook", "ttkPanedwindow", "ttkProgress", |
||||||
|
"ttkScale", "ttkScrollbar", "ttkScroll", "ttkSeparator", "ttkSquare", |
||||||
|
"ttkState", "ttkTagSet", "ttkTheme", "ttkTrace", "ttkTrack", |
||||||
|
"ttkTreeview", "ttkWidget", "ttkStubInit", |
||||||
|
}; |
||||||
|
|
||||||
|
pub fn build_tk(comptime tcldir: []const u8, comptime subdir: []const u8, b: *std.Build, target: std.Build.ResolvedTarget, optimize: std.builtin.OptimizeMode, stublib: *std.Build.Step.Compile) !*std.Build.Step.Compile { |
||||||
|
const lib = b.addLibrary(.{ |
||||||
|
.linkage = .dynamic, |
||||||
|
.name = "tcl9tk90", |
||||||
|
.root_module = b.createModule(.{ |
||||||
|
.target = target, |
||||||
|
.optimize = optimize, |
||||||
|
}), |
||||||
|
}); |
||||||
|
lib.mingw_unicode_entry_point = true; //parity with the tclsh exe environment |
||||||
|
|
||||||
|
var flags = std.array_list.Managed([]const u8).init(b.allocator); |
||||||
|
defer flags.deinit(); |
||||||
|
try flags.appendSlice(&.{ |
||||||
|
"-Wall", |
||||||
|
"-O3", |
||||||
|
"-fomit-frame-pointer", |
||||||
|
"-fno-sanitize=undefined", |
||||||
|
"-DBUILD_tk=/**/", |
||||||
|
"-DBUILD_ttk=/**/", |
||||||
|
"-DUSE_TCL_STUBS=1", |
||||||
|
"-DTCL_CFG_OPTIMIZED=1", |
||||||
|
"-DHAVE_NO_SEH=1", |
||||||
|
}); |
||||||
|
//tkPkgConfig.c wants the configure-era CFG_* values (parity with the tcl side's |
||||||
|
//tclPkgConfig handling in build905.zig) |
||||||
|
const prefix = b.install_path; |
||||||
|
const tk_script_dir = b.pathJoin(&.{ prefix, "lib", "tk9.0" }); |
||||||
|
inline for (.{ "RUNTIME", "INSTALL" }) |cls| { |
||||||
|
try flags.append(try std.fmt.allocPrint(b.allocator, "-DCFG_{s}_LIBDIR=\"{s}\"", .{ cls, b.pathJoin(&.{ prefix, "lib" }) })); |
||||||
|
try flags.append(try std.fmt.allocPrint(b.allocator, "-DCFG_{s}_BINDIR=\"{s}\"", .{ cls, b.pathJoin(&.{ prefix, "bin" }) })); |
||||||
|
try flags.append(try std.fmt.allocPrint(b.allocator, "-DCFG_{s}_SCRDIR=\"{s}\"", .{ cls, tk_script_dir })); |
||||||
|
try flags.append(try std.fmt.allocPrint(b.allocator, "-DCFG_{s}_INCDIR=\"{s}\"", .{ cls, b.pathJoin(&.{ prefix, "include" }) })); |
||||||
|
try flags.append(try std.fmt.allocPrint(b.allocator, "-DCFG_{s}_DOCDIR=\"{s}\"", .{ cls, b.pathJoin(&.{ prefix, "man" }) })); |
||||||
|
} |
||||||
|
try flags.append("-DCFG_RUNTIME_DLLFILE=\"tcl9tk90.dll\""); |
||||||
|
|
||||||
|
var sources = std.array_list.Managed([]const u8).init(b.allocator); |
||||||
|
inline for (generic_names) |n| try sources.append(subdir ++ "/generic/" ++ n ++ ".c"); |
||||||
|
inline for (unix_names) |n| try sources.append(subdir ++ "/unix/" ++ n ++ ".c"); |
||||||
|
inline for (xlib_names) |n| try sources.append(subdir ++ "/xlib/" ++ n ++ ".c"); |
||||||
|
inline for (win_names) |n| try sources.append(subdir ++ "/win/" ++ n ++ ".c"); |
||||||
|
inline for (ttk_names) |n| try sources.append(subdir ++ "/generic/ttk/" ++ n ++ ".c"); |
||||||
|
|
||||||
|
lib.root_module.addIncludePath(b.path(subdir ++ "/generic")); |
||||||
|
lib.root_module.addIncludePath(b.path(subdir ++ "/generic/ttk")); |
||||||
|
lib.root_module.addIncludePath(b.path(subdir ++ "/win")); |
||||||
|
lib.root_module.addIncludePath(b.path(subdir ++ "/xlib")); |
||||||
|
lib.root_module.addIncludePath(b.path(subdir ++ "/bitmaps")); |
||||||
|
lib.root_module.addIncludePath(b.path(tcldir ++ "/generic")); |
||||||
|
lib.root_module.addIncludePath(b.path(tcldir ++ "/win")); |
||||||
|
|
||||||
|
lib.root_module.addCSourceFiles(.{ |
||||||
|
.files = sources.items, |
||||||
|
.flags = flags.items, |
||||||
|
}); |
||||||
|
|
||||||
|
//tkMain.c twice - ansi (forced) + UNICODE 'tkMain2' (makefile.vc parity) |
||||||
|
var mainansi_flags = std.array_list.Managed([]const u8).init(b.allocator); |
||||||
|
defer mainansi_flags.deinit(); |
||||||
|
try mainansi_flags.appendSlice(flags.items); |
||||||
|
try mainansi_flags.appendSlice(&.{ "-UUNICODE", "-U_UNICODE" }); |
||||||
|
lib.root_module.addCSourceFile(.{ |
||||||
|
.file = b.path(subdir ++ "/generic/tkMain.c"), |
||||||
|
.flags = mainansi_flags.items, |
||||||
|
}); |
||||||
|
var mainw_flags = std.array_list.Managed([]const u8).init(b.allocator); |
||||||
|
defer mainw_flags.deinit(); |
||||||
|
try mainw_flags.appendSlice(flags.items); |
||||||
|
try mainw_flags.appendSlice(&.{ "-DUNICODE", "-D_UNICODE" }); |
||||||
|
lib.root_module.addCSourceFile(.{ |
||||||
|
.file = b.path(subdir ++ "/generic/tkMain.c"), |
||||||
|
.flags = mainw_flags.items, |
||||||
|
}); |
||||||
|
|
||||||
|
lib.root_module.addWin32ResourceFile(.{ |
||||||
|
.file = b.path(subdir ++ "/win/rc/tk.rc"), |
||||||
|
.include_paths = &.{ |
||||||
|
b.path(subdir ++ "/win"), |
||||||
|
b.path(subdir ++ "/win/rc"), |
||||||
|
b.path(subdir ++ "/generic"), |
||||||
|
b.path(tcldir ++ "/generic"), |
||||||
|
}, |
||||||
|
}); |
||||||
|
|
||||||
|
lib.root_module.linkLibrary(stublib); |
||||||
|
lib.root_module.link_libc = true; |
||||||
|
inline for (.{ "netapi32", "gdi32", "user32", "userenv", "winspool", "shell32", "ole32", "oleaut32", "uuid", "comctl32", "comdlg32", "imm32", "uxtheme", "advapi32" }) |l| { |
||||||
|
lib.root_module.linkSystemLibrary(l, .{}); |
||||||
|
} |
||||||
|
|
||||||
|
b.installArtifact(lib); |
||||||
|
|
||||||
|
//tk script library -> <prefix>/lib/tk9.0 (pkgIndex.tcl is generated by the suite |
||||||
|
//driver post-build, per the makefile.vc install-binaries convention) |
||||||
|
const install_tklib = b.addInstallDirectory(.{ |
||||||
|
.source_dir = b.path(subdir ++ "/library"), |
||||||
|
.install_dir = .prefix, |
||||||
|
.install_subdir = "lib/tk9.0", |
||||||
|
}); |
||||||
|
b.getInstallStep().dependOn(&install_tklib.step); |
||||||
|
|
||||||
|
return lib; |
||||||
|
} |
||||||
@ -1,6 +1,7 @@ |
|||||||
0.2.0 |
0.2.0 |
||||||
#First line must be a semantic version number |
#First line must be a semantic version number |
||||||
#all other lines are ignored. |
#all other lines are ignored. |
||||||
|
#0.2.0 - G-098: registered PUNK_FOSSIL_STORE in the known punk env vars ('help env' surfacing) - overrides the punkshell-owned fossil clone store location used by buildsuites (default ~/.punkshell/fossils, machine-level cache outside deletable _build areas; read-only seeding from ~/.fossils). |
||||||
#0.2.0 - registered PUNK_TEST_UDPTEE in the known punk env vars (runtests UDP watch mode / runx -teelog - see src/tests/AGENTS.md) |
#0.2.0 - registered PUNK_TEST_UDPTEE in the known punk env vars (runtests UDP watch mode / runx -teelog - see src/tests/AGENTS.md) |
||||||
#0.2.0 - converted from manually-versioned config-0.1.tm to standard buildversion tracking (magic 999999.0a1.0 source filename; punk::config was never in src/modules/AGENTS.md's manual-versioning exception list) |
#0.2.0 - converted from manually-versioned config-0.1.tm to standard buildversion tracking (magic 999999.0a1.0 source filename; punk::config was never in src/modules/AGENTS.md's manual-versioning exception list) |
||||||
#0.1 - prior manually-versioned baseline (filename config-0.1.tm, no buildversion.txt) |
#0.1 - prior manually-versioned baseline (filename config-0.1.tm, no buildversion.txt) |
||||||
|
|||||||
Loading…
Reference in new issue