Zig 0.13.0 released

moving fast! :heart:

https://ziglang.org/download/0.13.0/release-notes.html

13 Likes

Plans to upgrade to 0.12 before the next release comes out, shattered :rofl:

9 Likes

Jokes aside, I really appreciate this smaller release: dealing with language/stdlib changes and potential fallout from LLVM upgrade at the same time would be horrifying.

It’s very helpful both that the two failure modes are separated into two releases, and that there are just more releases, so there’s more incrementality to upgrades.

1 Like

The only breaking change I’ve noticed so far is std.Build.LazyPath. I have to add the following to my build file to support both 0.13.0 and 0.12.0:

fn lazyPath(b: *std.Build, path: []const u8) std.Build.LazyPath {
    if (@hasField(std.Build.LazyPath, "src_path")) {
        // 0.13.0
        return .{ .src_path = .{ .owner = b, .sub_path = path } };
    } else {
        // 0.12.0
        return .{ .path = path };
    }
}
1 Like

The intended fix is

b.path(path)

It was a 0.12.0 change but wasn’t breaking in 0.12.0:

https://ziglang.org/download/0.12.0/release-notes.html#introduce-bpath-deprecate-LazyPathrelative

6 Likes

there is also
std.ChildProcess (0.12.0) to std.process.Child(0.13.0)

Ah, there’s a built-in function. Nice. Thanks for the heads up.

1 Like

pretty substantial API change: std.Progress (release note). Related: Zig's New CLI Progress Bar Explained

I was able to convert build paths and ComptimeStringMap in one project. In my other project, I
…I’m just dumb. Seeing how other projects do it was more than obvious :sweat_smile:

Summary

don’t know how to change the Step.Compile.addIncludePath Does anyone know how I replace the addIncludPath? Build.zig below in second/third to last lines:

pub fn build(b: *std.Build) void {
    const target = b.standardTargetOptions(.{});
    const optimize = b.standardOptimizeOption(.{});
    const project_level = b.addOptions();

    // enable clib cross-compilation
    const lib = b.addStaticLibrary(.{
        .name = "pkcs1verify",
        .target = target,
        .optimize = optimize,
    });

    const libroot = "./deps/mbedtls/library/";
    const cflags = [_][]const u8{
        "-Ideps/config",
        "-DMBEDTLS_CONFIG_FILE=\"pkcs1verify_config.h\"",
        "-std=c99",
        "-Wall",
        "-Wextra",
        "-Wwrite-strings",
        "-Wpointer-arith",
        "-Wimplicit-fallthrough",
        "-Wshadow",
        "-Wvla",
        "-Wformat=2",
        "-Wno-format-nonliteral",
        "-Wmissing-declarations",
        "-Wmissing-prototypes",
        "-Wdocumentation",
        "-Wno-documentation-deprecated-sync",
        "-Wunreachable-code",
    };
    // subset from mbedtls_config.h for pkcs1v15 verify only
    lib.defineCMacro("MBEDTLS_ENTROPY_C", "1");
// .....list of C macros abbreviated for length

    const sources = [_][]const u8{
        libroot ++ "entropy.c",
    };
// .....concatenated list of C source files abbreviated for length

    lib.addCSourceFiles(.{.files=&sources, .flags=&cflags});
    lib.linkLibC();
    lib.addIncludePath(.{ .path = "./deps/mbedtls/include" });

    lib.addIncludePath(.{ .path = libroot });

    b.installArtifact(lib);

I was in the middle of upgrading zig from 0.11.0 to 0.12.0 for Tuple today when I found out 0.13.0 was just released…lol! Went ahead and skipped 0.12.0 :slight_smile:

1 Like

Note that std.process.Child also works in 0.12.0.

3 Likes

At just 415 commits, that was… the Spanish Inquisition :grin:

I just noticed a bunch of issues on 32-bit Windows. If you need to support that platform, better stick with 0.12.0. I guess somewhere on this planet there’re still people are using Windows XP :stuck_out_tongue:

1 Like