summaryrefslogtreecommitdiff
path: root/build.zig
diff options
context:
space:
mode:
authorGravatar Uko Kokņevičs2023-07-04 02:37:19 +0300
committerGravatar Uko Kokņevičs2023-07-04 02:37:19 +0300
commit99739da0169db308ecad28d99838a0f4574ae792 (patch)
treee32aa2e91cb13be8c63ea68c53dc645c923971f9 /build.zig
parentUpdate for latest zig (diff)
downloadzup-99739da0169db308ecad28d99838a0f4574ae792.tar.gz
zup-99739da0169db308ecad28d99838a0f4574ae792.tar.xz
zup-99739da0169db308ecad28d99838a0f4574ae792.zip
Update for newest zig
Diffstat (limited to 'build.zig')
-rw-r--r--build.zig12
1 files changed, 3 insertions, 9 deletions
diff --git a/build.zig b/build.zig
index 4ff015b..56a5ed3 100644
--- a/build.zig
+++ b/build.zig
@@ -3,21 +3,15 @@ const std = @import("std");
3 3
4const Build = std.Build; 4const Build = std.Build;
5const SemanticVersion = std.SemanticVersion; 5const SemanticVersion = std.SemanticVersion;
6const Version = std.builtin.Version;
7 6
8pub fn build(b: *Build) void { 7pub fn build(b: *Build) void {
9 const target = b.standardTargetOptions(.{}); 8 const target = b.standardTargetOptions(.{});
10 const optimize = b.standardOptimizeOption(.{}); 9 const optimize = b.standardOptimizeOption(.{});
11 10
12 const semanticVersion = getSemanticVersion(b); 11 const version = getVersion(b);
13 const version = Version{
14 .major = @intCast(u32, semanticVersion.major),
15 .minor = @intCast(u32, semanticVersion.minor),
16 .patch = @intCast(u32, semanticVersion.patch),
17 };
18 12
19 const config = b.addOptions(); 13 const config = b.addOptions();
20 config.addOption(SemanticVersion, "version", semanticVersion); 14 config.addOption(SemanticVersion, "version", version);
21 15
22 const exe = b.addExecutable(.{ 16 const exe = b.addExecutable(.{
23 .name = "zup", 17 .name = "zup",
@@ -59,7 +53,7 @@ pub fn build(b: *Build) void {
59 53
60const default_version = SemanticVersion.parse("0.2.1") catch unreachable; 54const default_version = SemanticVersion.parse("0.2.1") catch unreachable;
61 55
62fn getSemanticVersion(b: *Build) SemanticVersion { 56fn getVersion(b: *Build) SemanticVersion {
63 var out_code: u8 = undefined; 57 var out_code: u8 = undefined;
64 const untrimmed = b.execAllowFail( 58 const untrimmed = b.execAllowFail(
65 &.{ "git", "-C", b.build_root.path.?, "describe", "--tags" }, 59 &.{ "git", "-C", b.build_root.path.?, "describe", "--tags" },