// SPDX-FileCopyrightText: 2026 Jeffrey C. Ollie // // SPDX-License-Identifier: MIT //! The WOZ reference images, run against the drive. //! //! Its own project for the same reason the corpus is: the disks are other //! people's software, they are fetched rather than committed, and nothing that //! merely builds the library should have to know they exist. Keeping them here //! keeps them out of the library's manifest. //! //! The library comes from the checkout this sits inside, by path, so the two //! are always the same code. const std = @import("std"); pub fn build(b: *std.Build) void { const target = b.standardTargetOptions(.{}); // Booting two dozen disks for a hundred million instructions apiece is // worth optimising, and there is nothing here to step through. // ReleaseFast unless asked otherwise. `standardOptimizeOption`'s preferred // mode is not a default: it applies only when `--release` is passed, and // otherwise the build is Debug -- which this one was, silently, for as // long as it said it preferred ReleaseFast. The runner was five times // slower for it. const optimize = b.option(std.builtin.OptimizeMode, "optimize", "Prioritize performance, safety, or binary size") orelse .ReleaseFast; const zig65 = b.dependency("zig65", .{ .target = target, .optimize = optimize, }); const exe = b.addExecutable(.{ .name = "wozcheck", .root_module = b.createModule(.{ .root_source_file = b.path("src/main.zig"), .target = target, .optimize = optimize, .imports = &.{ .{ .name = "zig65", .module = zig65.module("zig65") }, }, }), }); const step = b.step("run", "Read the WOZ reference images, and boot them if a ROM is given"); if (b.lazyDependency("woz_images", .{})) |images| { const run = b.addRunArtifact(exe); run.stdio = .inherit; // Where the disks are, handed over as an argument rather than compiled // in, so the same binary can be pointed at a copy by hand. run.addArg("--images"); run.addDirectoryArg(images.path("woz test images")); if (b.args) |args| run.addArgs(args); step.dependOn(&run.step); } b.default_step.dependOn(step); }