libxml2

CI

libxml2

This is libxml2, packaged for Zig.

Installation

First, update your build.zig.zon:

# Initialize a `zig build` project if you haven't already
zig init
zig fetch --save git+https://github.com/allyourcodebase/libxml2.git#2.15.1-2

You can then import libxml2 in your build.zig with:

const libxml2_dependency = b.dependency("libxml2", .{
    .target = target,
    .optimize = optimize,

    // libxml2 will try to link to iconv on macOS by default which will
    // fail when cross-compiling. You may disable iconv support for or
    // link against GNU libiconv which is licensed under LGPL.

    // disable iconv support on all targets
    // .iconv = false,

    // disable iconv support when compiling to macOS
    // .iconv = !target.result.os.tag.isDarwin(),

    // disable iconv support when cross-compiling to macOS
    // .iconv = !(target.query.isNativeOs() and target.result.os.tag.isDarwin()),

    // Use GNU libiconv on macOS which is licensed under LGPL.
    // .@"iconv-impl" = @as(?enum{libc, libiconv, win_iconv}, if (target.result.os.tag.isDarwin()) .libiconv else null),
});
your_exe.linkLibrary(libxml2_dependency.artifact("xml"));