mirror of
https://github.com/allyourcodebase/libxml2.git
synced 2026-11-17 01:30:28 +00:00
libxml2 ported to the zig build system
- Zig 100%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| .github/workflows | ||
| .gitattributes | ||
| .gitignore | ||
| build.zig | ||
| build.zig.zon | ||
| LICENSE | ||
| README.md | ||
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.4
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.root_module.linkLibrary(libxml2_dependency.artifact("xml"));