{"id":13710176,"url":"https://github.com/mitchellh/zig-libxml2","last_synced_at":"2025-10-30T05:04:51.023Z","repository":{"id":42083996,"uuid":"447363973","full_name":"mitchellh/zig-libxml2","owner":"mitchellh","description":"libxml2 built using Zig build system","archived":false,"fork":false,"pushed_at":"2023-08-02T21:39:07.000Z","size":57,"stargazers_count":82,"open_issues_count":1,"forks_count":11,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-04-10T05:59:27.190Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Zig","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mitchellh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2022-01-12T20:38:39.000Z","updated_at":"2025-02-01T08:27:45.000Z","dependencies_parsed_at":"2024-04-17T10:53:15.616Z","dependency_job_id":"f2e8a12e-68b1-4a6d-8577-41aa26b5a2e0","html_url":"https://github.com/mitchellh/zig-libxml2","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mitchellh%2Fzig-libxml2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mitchellh%2Fzig-libxml2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mitchellh%2Fzig-libxml2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mitchellh%2Fzig-libxml2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mitchellh","download_url":"https://codeload.github.com/mitchellh/zig-libxml2/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249109329,"owners_count":21214130,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-02T23:00:52.732Z","updated_at":"2025-10-30T05:04:51.010Z","avatar_url":"https://github.com/mitchellh.png","language":"Zig","readme":"# libxml2 Built with Zig\n\nThis repository contains Zig code for building libxml2 using Zig.\nThis allows other projects that use the Zig build system to easily\nconsume this library, cross-compile it, etc.\n\n**Why?** Using the Zig build system makes it much easier to cross-compile\na library, even if you aren't using the Zig programming language. See\n[Maintain it with Zig](https://kristoff.it/blog/maintain-it-with-zig/)\nfor some more information.\n\nThis library currently hardcodes the libxml2 version (latest as of writing\nthis but unlikely to remain that way for long). In the future, I'd like to\nallow users to pass in a custom libxml2 directory, and it'd be really cool to\nsetup some sort of Github Action to check for new versions and try to pull\nit in. Maybe one day.\n\n## Usage\n\nWhile we all eagerly await the [Zig Package Manager](https://github.com/ziglang/zig/issues/943),\nthe recommended way to use this is via git submodules or just embedding\nthis into your repository.\n\n```zig\nconst libxml2 = @import(\"path/to/libxml2.zig\");\n\npub fn build(b: *std.build.Builder) !void {\n    // ...\n\n    const lib = try libxml2.create(b, target, mode, .{\n        // These are the minimal options to NOT depend on any other libraries.\n        // If you ave these libraries, just set these to true.\n        .iconv = false,\n        .lzma = false,\n        .zlib = false,\n    });\n\n    const exe = b.addExecutable(\"my-program\", \"src/main.zig\");\n    lib.link(exe);\n}\n```\n\nThis package does not provide any Zig-native APIs to access the underlying\nC library. This is by design, the focus of this repository is only to enable\nbuilding the underlying library using the Zig build system. Therefore, to\nuse the library, import the headers and use the C API:\n\n```zig\nconst c = @cImport({\n    @cInclude(\"libxml/xmlreader.h\");\n});\n\n// ... do stuff with `c`\n```\n\n### Other Dependencies\n\nSome features require other libraries. In the example above, we disabled\nthose features. For example, if you set `.zlib = true`, then zlib must\nbe available.\n\nIn this scenario, you can find and use a zlib build such as\n[zig-zlib](https://github.com/mattnite/zig-zlib) as normal. When that\nlibrary is also added to the project, it adds its include paths and\nlinking information to the build, so libxml2 can be built with zlib support.\n","funding_links":[],"categories":["Libraries","Zig","Language Essentials"],"sub_categories":["File Format Processing"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmitchellh%2Fzig-libxml2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmitchellh%2Fzig-libxml2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmitchellh%2Fzig-libxml2/lists"}