1const std = @import("std");23const Scanner = @import("wayland").Scanner;45pub fn build(b: *std.Build) void {6 const target = b.standardTargetOptions(.{});7 const optimize = b.standardOptimizeOption(.{});8 const pie = b.option(bool, "pie", "Build a position-independent executable") orelse false;910 const scanner = Scanner.create(b, .{});1112 scanner.addSystemProtocol("stable/xdg-shell/xdg-shell.xml");13 scanner.addSystemProtocol("stable/viewporter/viewporter.xml");14 scanner.addSystemProtocol("staging/single-pixel-buffer/single-pixel-buffer-v1.xml");15 scanner.addCustomProtocol(b.path("protocol/wlr-layer-shell-unstable-v1.xml"));16 scanner.addCustomProtocol(b.path("protocol/river-status-unstable-v1.xml"));17 scanner.addCustomProtocol(b.path("protocol/river-control-unstable-v1.xml"));1819 scanner.generate("wl_compositor", 4);20 scanner.generate("wl_subcompositor", 1);21 scanner.generate("wl_shm", 1);22 scanner.generate("wl_output", 3);23 scanner.generate("wl_seat", 5);24 scanner.generate("wp_single_pixel_buffer_manager_v1", 1);25 scanner.generate("wp_viewporter", 1);26 scanner.generate("zwlr_layer_shell_v1", 1);27 scanner.generate("zriver_status_manager_v1", 2);28 scanner.generate("zriver_control_v1", 1);2930 const wayland = b.createModule(.{ .root_source_file = scanner.result });31 const pixman = b.dependency("pixman", .{}).module("pixman");32 const fcft = b.dependency("fcft", .{}).module("fcft");3334 const time = b.addTranslateC(.{35 .root_source_file = b.addWriteFiles().add("z_time.h",36 \\#include <time.h>37 ),38 .target = target,39 .optimize = optimize,40 });4142 const exe = b.addExecutable(.{43 .name = "creek",44 .root_module = b.createModule(.{45 .root_source_file = b.path("src/main.zig"),46 .target = target,47 .optimize = optimize,48 .link_libc = true,49 }),50 });51 exe.pie = pie;5253 exe.root_module.addImport("wayland", wayland);54 exe.root_module.linkSystemLibrary("wayland-client", .{});5556 exe.root_module.addImport("pixman", pixman);57 exe.root_module.linkSystemLibrary("pixman-1", .{});5859 exe.root_module.addImport("fcft", fcft);60 exe.root_module.linkSystemLibrary("fcft", .{});6162 exe.root_module.addImport("time", time.createModule());6364 b.installArtifact(exe);6566 const run = b.addRunArtifact(exe);67 run.step.dependOn(b.getInstallStep());68 run.addPassthruArgs();6970 const run_step = b.step("run", "Run creek");71 run_step.dependOn(&run.step);72}