Something went wrong. Try again.
A rainbow login banner drawn in a real font and shown with the kitty graphics protocol, written in Zig.
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475// SPDX-FileCopyrightText: © 2026 Jeffrey C. Ollie <jeff@ocjtech.us>// SPDX-License-Identifier: MIT
const std = @import("std");
/// build.zig.zon is the one place the version is written.const version: []const u8 = @import("build.zig.zon").version;
pub fn build(b: *std.Build) void { const target = b.standardTargetOptions(.{}); const optimize = b.standardOptimizeOption(.{});
// The font libraries are built optimized even in a Debug build: reading // fontconfig's cached patterns takes seconds in Debug and a fraction of // one optimized, and a login banner that makes the shell wait for it is // not one anybody keeps. const font_optimize: @TypeOf(optimize) = if (optimize == .debug) .safe else optimize;
// Everything is taken through the shaper, so that the renderer, the // fontconfig port, z2d and z2dimg are the very packages the shaper was // built against, and each is one module rather than two that disagree // about their own types. const shaper = b.dependency("font_shaper", .{ .target = target, .optimize = font_optimize }); const renderer = shaper.builder.dependency("font_renderer", .{ .target = target, .optimize = font_optimize }); const font_config = shaper.builder.dependency("font_config", .{ .target = target, .optimize = font_optimize }); const font = renderer.builder.dependency("font", .{ .target = target, .optimize = font_optimize }); const z2d = renderer.builder.dependency("z2d", .{ .target = target, .optimize = font_optimize }); const z2dimg = renderer.builder.dependency("z2dimg", .{ .target = target, .optimize = font_optimize });
const build_options = b.addOptions(); build_options.addOption([]const u8, "version", version);
const mod = b.createModule(.{ .root_source_file = b.path("src/main.zig"), .target = target, .optimize = optimize, .imports = &.{ .{ .name = "font", .module = font.module("font") }, .{ .name = "font_config", .module = font_config.module("font_config") }, .{ .name = "font_renderer", .module = renderer.module("font_renderer") }, .{ .name = "font_loader", .module = renderer.module("font_loader") }, .{ .name = "font_shaper_text", .module = shaper.module("font_shaper_text") }, .{ .name = "z2d", .module = z2d.module("z2d") }, .{ .name = "z2dimg", .module = z2dimg.module("z2dimg") }, .{ .name = "build_options", .module = build_options.createModule() }, }, });
const exe = b.addExecutable(.{ .name = "zigurine", .root_module = mod, }); b.installArtifact(exe);
const run = b.addRunArtifact(exe); run.step.dependOn(b.getInstallStep()); run.addPassthruArgs(); const run_step = b.step("run", "Run zigurine"); run_step.dependOn(&run.step);
const tests = b.addTest(.{ .name = "zigurine-test", .root_module = mod, // The self-hosted backend emits neither coverage instrumentation nor // debug information kcov can read; LLVM does both. .use_llvm = true, }); const test_step = b.step("test", "Run the unit tests"); test_step.dependOn(&b.addRunArtifact(tests).step);
const check_step = b.step("check", "Compile everything without running it"); check_step.dependOn(&exe.step); check_step.dependOn(&tests.step);}