|
1 | 1 | const std = @import("std");
|
2 |
| -const Builder = std.build.Builder; |
3 | 2 |
|
4 |
| -const linkPcre = @import("vendor/koino/vendor/libpcre/build.zig").linkPcre; |
| 3 | +pub fn build(b: *std.Build) void { |
| 4 | + const optimize = b.standardOptimizeOption(.{}); |
| 5 | + const target = b.standardTargetOptions(.{}); |
| 6 | + const exe = b.addExecutable(.{ |
| 7 | + .name = "zmd", |
| 8 | + .root_source_file = b.path("src/main.zig"), |
| 9 | + .target = target, |
| 10 | + .optimize = optimize, |
| 11 | + }); |
5 | 12 |
|
6 |
| -const pkgs = struct { |
7 |
| - const koino = std.build.Pkg{ |
8 |
| - .name = "koino", |
9 |
| - .source = std.build.FileSource{ .path = "vendor/koino/src/koino.zig" }, |
10 |
| - .dependencies = &[_]std.build.Pkg{ |
11 |
| - std.build.Pkg{ .name = "libpcre", .source = std.build.FileSource{ .path = "vendor/koino/vendor/libpcre/src/main.zig" } }, |
12 |
| - std.build.Pkg{ .name = "htmlentities", .source = std.build.FileSource{ .path = "vendor/koino/vendor/htmlentities/src/main.zig" } }, |
13 |
| - std.build.Pkg{ .name = "clap", .source = std.build.FileSource{ .path = "vendor/koino/vendor/zig-clap/clap.zig" } }, |
14 |
| - std.build.Pkg{ .name = "zunicode", .source = std.build.FileSource{ .path = "vendor/koino/vendor/zunicode/src/zunicode.zig" } }, |
15 |
| - }, |
16 |
| - }; |
17 |
| -}; |
| 13 | + const koino_pkg = b.dependency("koino", .{ .optimize = optimize, .target = target }); |
| 14 | + exe.root_module.addImport("koino", koino_pkg.module("koino")); |
18 | 15 |
|
19 |
| -pub fn build(b: *Builder) void { |
20 |
| - const mode = b.standardReleaseOptions(); |
21 |
| - const exe = b.addExecutable("zmd", "src/main.zig"); |
22 |
| - |
23 |
| - exe.addPackage(pkgs.koino); |
24 |
| - try linkPcre(exe); |
25 |
| - |
26 |
| - exe.setBuildMode(mode); |
27 |
| - exe.install(); |
28 |
| - |
29 |
| - const run_cmd = exe.run(); |
30 |
| - run_cmd.step.dependOn(b.getInstallStep()); |
31 |
| - |
32 |
| - const run_step = b.step("run", "Run the app"); |
33 |
| - run_step.dependOn(&run_cmd.step); |
| 16 | + b.installArtifact(exe); |
34 | 17 | }
|
0 commit comments