summaryrefslogtreecommitdiff
path: root/build.zig
diff options
context:
space:
mode:
Diffstat (limited to 'build.zig')
-rw-r--r--build.zig77
1 files changed, 13 insertions, 64 deletions
diff --git a/build.zig b/build.zig
index 096779a9..a7049ad3 100644
--- a/build.zig
+++ b/build.zig
@@ -25,7 +25,7 @@ const deps_text = blk: {
break :blk text;
};
-pub const Platform = enum { tui, gui, web, macos, esp32p4 };
+pub const Platform = enum { tui, gui, web, macos };
const PerfBuild = struct {
compiler: []const u8,
@@ -70,7 +70,7 @@ const gui_shaders = [_][]const u8{
};
pub fn build(b: *std.Build) void {
- const requested_platform = b.option(Platform, "platform", "which shell to build (tui, gui, web, macos, esp32p4); absent builds the tui cli and the SDL gui together");
+ const requested_platform = b.option(Platform, "platform", "which shell to build (tui, gui, web, macos); absent builds the tui cli and the SDL gui together");
const platform = requested_platform orelse .tui;
const also_gui = requested_platform == null;
// A bare `zig build` also copies the binaries into ~/.local/bin. Zig
@@ -81,21 +81,13 @@ pub fn build(b: *std.Build) void {
else
null;
const home_install = home_bin != null;
- const esp32p4_target: std.Target.Query = .{
- .cpu_arch = .riscv32,
- .os_tag = .freestanding,
- .abi = .none,
- .cpu_model = .{ .explicit = &std.Target.riscv.cpu.generic_rv32 },
- .cpu_features_add = riscvFeatures(&.{ .m, .a, .f, .c, .zicsr, .zifencei }),
- };
- const requested_target = b.standardTargetOptions(.{
+ const target = b.standardTargetOptions(.{
.default_target = switch (platform) {
.macos => if (builtin.os.tag.isDarwin()) .{
.cpu_arch = builtin.target.cpu.arch,
.os_tag = .macos,
.os_version_min = .{ .semver = macos_min_version },
} else .{},
- .esp32p4 => esp32p4_target,
.tui, .gui, .web => .{
.cpu_arch = .x86_64,
.os_tag = .linux,
@@ -104,7 +96,6 @@ pub fn build(b: *std.Build) void {
},
},
});
- const target = if (platform == .esp32p4) b.resolveTargetQuery(esp32p4_target) else requested_target;
const requested_optimize = b.standardOptimizeOption(.{});
const static = b.option(bool, "static", "statically link") orelse false;
const dump_path = b.option([]const u8, "dump", "a Dump (a .dump file) embedded into the web shell (-Dplatform=web)");
@@ -115,21 +106,12 @@ pub fn build(b: *std.Build) void {
else
&.{};
const is_web = platform == .web;
- const is_esp32p4 = platform == .esp32p4;
- const freestanding_core = is_web or is_esp32p4;
- const enable_mupdf = b.option(bool, "mupdf", "native PDF rendering with MuPDF (AGPL/commercial; native default on, web/esp32p4 off; -Dmupdf=false disables)") orelse !freestanding_core;
+ const freestanding_core = is_web;
+ const enable_mupdf = b.option(bool, "mupdf", "native PDF rendering with MuPDF (AGPL/commercial; native default on, web off; -Dmupdf=false disables)") orelse !freestanding_core;
const enable_jpx = b.option(bool, "jpx", "JPEG 2000 in PDFs, for scanned documents (default on; -Djpx=false drops openjpeg)") orelse true;
- // Off on the board too: the sources are ~1.8 MB, more than the whole
- // 1.5 MiB app partition, and with them the image does not link.
- const embed_sources = b.option(bool, "embed-sources", "serve the editor's own sources under /src of its 9P tree (default off; the esp32p4 image has no room for them)") orelse false;
+ const embed_sources = b.option(bool, "embed-sources", "serve the editor's own sources under /src of its 9P tree (default off)") orelse false;
const is_web_target = target.result.cpu.arch == .wasm32 and target.result.os.tag == .freestanding;
- const is_esp32p4_target = target.result.cpu.arch == .riscv32 and target.result.os.tag == .freestanding;
- const optimize = if (is_web)
- .small
- else if (is_esp32p4_target and requested_optimize == .debug)
- .fast
- else
- requested_optimize;
+ const optimize = if (is_web) .small else requested_optimize;
const test_build = b.step("test-build", "compile unit-test programs without running them");
const doc_typ_opts = b.addOptions();
doc_typ_opts.addOptionPathUntracked("dir", b.path("docs/typ"));
@@ -182,7 +164,7 @@ pub fn build(b: *std.Build) void {
}),
});
const c_optimize: std.lang.Optimize = if (optimize == .debug) .fast else optimize;
- const default_grammars: TreeSitterGrammars = if (is_web) .zig else if (is_esp32p4) .disabled else .full;
+ const default_grammars: TreeSitterGrammars = if (is_web) .zig else .full;
const requested_grammars = b.option(TreeSitterGrammars, "tree-sitter", "tree-sitter grammar set: disabled, zig, minimal (c/c++/zig), full");
const tree_sitter_grammars = requested_grammars orelse default_grammars;
const tracy = b.option([]const u8, "tracy", "enable Tracy profiling; supply the path to a Tracy source checkout");
@@ -221,13 +203,6 @@ pub fn build(b: *std.Build) void {
if (!is_web and (is_web_target or target.result.os.tag == .emscripten)) return failBuild(b, web_step, "wasm browser targets require -Dplatform=web");
if (platform == .web and dump_path == null) return failBuild(b, web_step, "-Dplatform=web requires -Ddump=<file.dump> (the browser has no ptys; state replays from an embedded dump)");
if (enable_mupdf and is_web) return failBuild(b, web_step, "-Dmupdf=true is supported only by the native tui/Kitty and gui/SDL backends");
- // The board's target is pinned (`target` above), so what is asked of
- // -Dtarget is checked, not what was resolved: another arch is refused,
- // not silently built for the board anyway.
- const requested_board = requested_target.result.cpu.arch == .riscv32 and requested_target.result.os.tag == .freestanding;
- if (is_esp32p4 and !requested_board) return failBuild(b, web_step, "-Dplatform=esp32p4 requires -Dtarget=riscv32-freestanding (ESP32-P4 firmware)");
- if (enable_mupdf and is_esp32p4) return failBuild(b, web_step, "-Dmupdf=true is supported only by the native tui/Kitty and gui/SDL backends");
- if (is_esp32p4 and requested_grammars != null and requested_grammars.? != .disabled) return failBuild(b, web_step, "-Dplatform=esp32p4 has no tree-sitter: the grammars' parse tables are megabytes and the flash partition is 1.5 MiB (-Dtree-sitter=disabled)");
// build-time IO: slurps the grammars' highlights.scm queries, and reads
// vendor/themes to find the theme sources
@@ -243,7 +218,6 @@ pub fn build(b: *std.Build) void {
.root_source_file = b.path(switch (platform) {
.web => "src/web.zig",
.macos => "src/macos.zig",
- .esp32p4 => "src/esp32p4.zig",
.tui, .gui => "src/main.zig",
}),
.link_libc = !freestanding_core,
@@ -320,9 +294,7 @@ pub fn build(b: *std.Build) void {
if (target.result.os.tag == .freebsd or target.result.os.tag == .netbsd or target.result.os.tag == .openbsd)
root_mod.linkSystemLibrary("util", .{});
- const esp32p4_cols = b.option(u16, "esp32p4-cols", "the board's grid width in cells (-Dplatform=esp32p4 only)") orelse 56;
- const esp32p4_rows = b.option(u16, "esp32p4-rows", "the board's grid height in cells (-Dplatform=esp32p4 only)") orelse 14;
- const theme_animation = b.option(bool, "theme-animation", "animate chrome colors across a theme change (default: off for esp32p4)");
+ const theme_animation = b.option(bool, "theme-animation", "animate chrome colors across a theme change (default: on)") orelse true;
// The macOS shell carries the workspace tag row's commands in its native
// menu bar; the row itself goes away. `-Dworkspace-tag=true` puts it back.
const workspace_tag = b.option(bool, "workspace-tag", "draw the workspace tag row (default: on except on macOS, whose menu bar carries its commands)");
@@ -340,8 +312,6 @@ pub fn build(b: *std.Build) void {
.tree_sitter_grammars = tree_sitter_grammars,
.tracy = tracy != null,
.mupdf = enable_mupdf,
- .esp32p4_cols = esp32p4_cols,
- .esp32p4_rows = esp32p4_rows,
.theme_animation = theme_animation,
.workspace_tag = workspace_tag,
.prebuilt_shaders = prebuilt_shaders,
@@ -826,7 +796,7 @@ pub fn build(b: *std.Build) void {
var ghostty_vt_for_snap: ?*std.Build.Module = null;
const ghostty_simd = !freestanding_core and (!target.result.os.tag.isDarwin() or b.graph.host.result.os.tag.isDarwin());
const ghostty_optimize: std.lang.Optimize = if (optimize == .debug) .safe else optimize;
- const ghostty_dep = if (is_esp32p4) null else b.lazyDependency("ghostty", .{ .target = target, .optimize = ghostty_optimize, .simd = ghostty_simd, .@"app-runtime" = .none, .@"emit-xcframework" = false });
+ const ghostty_dep = b.lazyDependency("ghostty", .{ .target = target, .optimize = ghostty_optimize, .simd = ghostty_simd, .@"app-runtime" = .none, .@"emit-xcframework" = false });
if (ghostty_dep) |dep| {
const ghostty_vt = dep.module("ghostty-vt");
ghostty_vt_for_snap = ghostty_vt;
@@ -1075,11 +1045,6 @@ pub fn build(b: *std.Build) void {
run_web_harness.step.dependOn(web_step);
b.step("web-harness", "run the dependency-free JS/WASM DOM harness").dependOn(&run_web_harness.step);
b.getInstallStep().dependOn(web_step);
- } else if (is_esp32p4) {
- const obj = b.addObject(.{ .name = "pardes-esp32p4", .root_module = root_mod });
- b.getInstallStep().dependOn(&b.addInstallFile(obj.getEmittedBin(), "pardes-esp32p4.o").step);
-
- web_step.dependOn(&b.addFail("web needs -Dplatform=web -Dtarget=wasm32-freestanding -Ddump=<file.dump>").step);
} else if (platform == .macos) {
const header = b.addTranslateC(.{
.root_source_file = b.path("src/macos/pardes.h"),
@@ -1472,7 +1437,7 @@ pub fn build(b: *std.Build) void {
.mupdf = enable_mupdf,
.jpx = enable_mupdf and enable_jpx,
.tracy = tracy != null,
- .theme_animation = theme_animation orelse (platform != .esp32p4),
+ .theme_animation = theme_animation,
.terminal_simd = ghostty_simd,
.prebuilt_shaders = platform == .gui and prebuilt_shaders,
});
@@ -1726,8 +1691,6 @@ pub fn build(b: *std.Build) void {
for ([_]struct { path: []const u8, libc: bool, optimize: ?std.builtin.OptimizeMode = null }{
.{ .path = "test/history.zig", .libc = false },
.{ .path = "src/9p.zig", .libc = false },
- .{ .path = "src/esp32p4_gpio.zig", .libc = false },
- .{ .path = "src/esp32p4/input_rescue.zig", .libc = false },
.{ .path = "src/fonts.zig", .libc = true },
.{ .path = "src/c_heap.zig", .libc = false },
// Its lookup goes wrong only where the optimizer folds it.
@@ -1958,11 +1921,7 @@ const ShellConfig = struct {
tree_sitter_grammars: TreeSitterGrammars,
tracy: bool,
mupdf: bool,
- esp32p4_cols: u16,
- esp32p4_rows: u16,
- /// null = "the platform's own default", resolved per shell below, because
- /// the default is off for the board and on everywhere else.
- theme_animation: ?bool,
+ theme_animation: bool,
/// null = "the platform's own default": the macOS shell hands the row to
/// its native menu bar, every other shell keeps the acme topbar.
workspace_tag: ?bool,
@@ -1980,10 +1939,8 @@ fn shellOptions(b: *std.Build, cfg: ShellConfig, platform: Platform) *std.Build.
o.addOption(bool, "syntax_full_grammars", cfg.tree_sitter_grammars == .full);
o.addOption(bool, "enable_tracy", cfg.tracy);
o.addOption(bool, "mupdf", cfg.mupdf);
- o.addOption(u16, "esp32p4_cols", cfg.esp32p4_cols);
- o.addOption(u16, "esp32p4_rows", cfg.esp32p4_rows);
o.addOption(bool, "workspace_tag", cfg.workspace_tag orelse (platform != .macos));
- o.addOption(bool, "theme_animation", cfg.theme_animation orelse (platform != .esp32p4));
+ o.addOption(bool, "theme_animation", cfg.theme_animation);
o.addOption(bool, "embed_sources", cfg.embed_sources);
o.addOption([]const u8, "version", display_version);
// ...and the commit it was built from, when there is one and the build
@@ -2085,11 +2042,3 @@ fn wireCore(m: *std.Build.Module, d: struct {
if (d.uucode) |x| m.addImport("uucode", x);
if (d.wuffs) |x| m.addImport("wuffs", x);
}
-
-/// The CPU feature set for the ESP32-P4 firmware target, as a `Cpu.Feature.Set`. Spelled as a
-/// helper because `cpu_features_add` wants a set and there is no literal syntax for one.
-fn riscvFeatures(comptime features: []const std.Target.riscv.Feature) std.Target.Cpu.Feature.Set {
- var set = std.Target.Cpu.Feature.Set.empty;
- for (features) |f| set.addFeature(@backingInt(f));
- return set;
-}