summaryrefslogtreecommitdiff
path: root/build.zig
diff options
context:
space:
mode:
Diffstat (limited to 'build.zig')
-rw-r--r--build.zig21
1 files changed, 18 insertions, 3 deletions
diff --git a/build.zig b/build.zig
index be9c929..41b9104 100644
--- a/build.zig
+++ b/build.zig
@@ -1,8 +1,23 @@
const std = @import("std");
pub fn build(b: *std.Build) void {
+ // Taken before the return only because pardes and sketchbook still
+ // pass `.target` and `.optimize`, which the exports ignore: undeclared,
+ // each configure of theirs would log "invalid option" for target, cpu
+ // and optimize with a stack trace (not fatal). Move both below the
+ // return once they pass nothing.
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
- const module = b.addModule("cloud9", .{
+ // What a package that depends on cloud9 gets: the library and 9proc,
+ // with no target or optimize of their own (they take their importer's).
+ const cloud9 = b.addModule("cloud9", .{ .root_source_file = b.path("src/root.zig") });
+ _ = b.addModule("9proc", .{
+ .root_source_file = b.path("9proc/src/root.zig"),
+ .imports = &.{.{ .name = "cloud9", .module = cloud9 }},
+ });
+ // The rest is cloud9's own (tests, programs, and the fragments with
+ // the `jj` and `date` 9proc spawns), so a consumer's configure stops here.
+ if (!b.isRoot()) return;
+ const module = b.createModule(.{
.root_source_file = b.path("src/root.zig"),
.target = target,
.optimize = optimize,
@@ -159,7 +174,7 @@ pub fn build(b: *std.Build) void {
// add a directory, a fragment, a toggle here, and the path to
// build.zig.zon.
//
- // -D9proc=[bool] library module (any target) + freestanding check;
+ // -D9proc=[bool] library tests + freestanding check;
// demo server and Linux suites when the target is Linux
// -D9ns=[bool] the FUSE mount CLI (Linux only)
//
@@ -167,7 +182,7 @@ pub fn build(b: *std.Build) void {
// programs are installed by the plain `zig build` next to 9web
// and cloud9-probe.
const is_linux = target.result.os.tag == .linux;
- const want_9proc = b.option(bool, "9proc", "Build the 9proc library module and demo (default: target is Linux)") orelse is_linux;
+ const want_9proc = b.option(bool, "9proc", "Build 9proc's tests, freestanding check and demo (default: target is Linux)") orelse is_linux;
const want_9ns = b.option(bool, "9ns", "Build the 9ns FUSE mount CLI (default: target is Linux; Linux only)") orelse is_linux;
const want_9agents = b.option(bool, "9agents", "Build the coding-agents fs daemon (default: target is Linux; Linux only)") orelse is_linux;
if (want_9ns and !is_linux) {