{"id":19686464,"url":"https://github.com/ianprime0509/zig-gobject","last_synced_at":"2025-07-25T01:04:31.548Z","repository":{"id":92336112,"uuid":"532101030","full_name":"ianprime0509/zig-gobject","owner":"ianprime0509","description":"GObject bindings for Zig using GObject introspection","archived":false,"fork":false,"pushed_at":"2025-07-23T02:20:23.000Z","size":6826,"stargazers_count":88,"open_issues_count":25,"forks_count":11,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-07-23T04:13:57.018Z","etag":null,"topics":["bindings","gobject","gtk","gui","zig"],"latest_commit_sha":null,"homepage":"http://ianjohnson.dev/zig-gobject/","language":"Zig","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"0bsd","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ianprime0509.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,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2022-09-02T22:59:06.000Z","updated_at":"2025-07-23T04:05:46.000Z","dependencies_parsed_at":"2024-01-05T04:25:51.676Z","dependency_job_id":"fb8487cc-d1a2-4c27-a0e4-3dd06d71eda1","html_url":"https://github.com/ianprime0509/zig-gobject","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/ianprime0509/zig-gobject","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ianprime0509%2Fzig-gobject","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ianprime0509%2Fzig-gobject/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ianprime0509%2Fzig-gobject/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ianprime0509%2Fzig-gobject/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ianprime0509","download_url":"https://codeload.github.com/ianprime0509/zig-gobject/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ianprime0509%2Fzig-gobject/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266935886,"owners_count":24009302,"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","status":"online","status_checked_at":"2025-07-24T02:00:09.469Z","response_time":99,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["bindings","gobject","gtk","gui","zig"],"created_at":"2024-11-11T18:28:40.884Z","updated_at":"2025-07-25T01:04:31.218Z","avatar_url":"https://github.com/ianprime0509.png","language":"Zig","funding_links":[],"categories":[],"sub_categories":[],"readme":"# zig-gobject\n\nBindings for GObject-based libraries (such as GTK) generated using GObject\nintrospection data.\n\n## Usage\n\nTo use the bindings, find the [latest release of this\nproject](https://github.com/ianprime0509/zig-gobject/releases) and add the\ndesired bindings artifact as a dependency in `build.zig.zon`. Then, the exposed\nbindings can be used as modules. For example:\n\n```zig\nconst gobject = b.dependency(\"gobject\", .{});\nexe.root_module.addImport(\"gtk\", gobject.module(\"gtk4\"));\nexe.root_module.addImport(\"adw\", gobject.module(\"adw1\"));\n```\n\nThe binding generator and generated bindings are tested on Zig 0.14.0 and\nmaster, though support for the latest master may temporarily regress when\nbreaking changes are made upstream.\n\n## Companion projects\n\n- [zig-libintl](https://github.com/ianprime0509/zig-libintl) - libintl bindings\n  for Zig, which provide `gettext` functions for internationalization.\n- [Nonograms](https://github.com/ianprime0509/nonograms) - a full application\n  written using these bindings.\n\n## Examples\n\nThere are several examples in the `example` directory, which is itself a\nrunnable project (depending on the `bindings` directory as a dependency). After\ngenerating the bindings, the examples can be run using `zig build run` in the\n`example` directory.\n\n## Development environment\n\nThe bindings generated by this project cover a wide variety of libraries, and it\ncan be annoying and inconvenient to install these libraries on a host system for\ntesting purposes. The best way to get a consistent environment for testing is to\nuse [Flatpak](https://flatpak.org/):\n\n1. Install `flatpak`.\n2. Install the GNOME SDK: `flatpak install org.gnome.Sdk//48`\n\nThe steps above only need to be done once per GNOME SDK version. To enter a\ndevelopment environment:\n\n1. Run `flatpak run --filesystem=home --share=network --share=ipc --socket=fallback-x11 --socket=wayland --device=dri --socket=session-bus org.gnome.Sdk//48`\n   - `--filesystem=home` - makes the user's home directory available within the\n     container\n   - `--share=network` - allows network access (needed to fetch `build.zig.zon`\n     dependencies)\n   - `--share=ipc --socket=fallback-x11 --socket=wayland --device=dri` - allows\n     graphical display through X11 or Wayland\n   - `--socket=session-bus` - allows access to the session bus\n   - For convenience, this command is available as a script in this repository:\n     `flatpak-env.sh`.\n2. Within the spawned shell, you can use the latest master version of Zig\n   downloaded from ziglang.org. Since the downloaded Zig is statically linked,\n   it is usable within the Flatpak environment with no additional setup.\n\n## Running the binding generator\n\nThe binding generator can be invoked using `zig build codegen`, which accepts\nseveral useful options and is described further below, or by building the\n`translate-gir` binary using `zig build` and invoking it directly.\n\n`zig build codegen` requires a set of modules to be used as input. The input\nmodules can be specified using `-Dmodules` to provide an explicit list of root\nmodules for codegen (the codegen process will also discover any necessary\ndependencies): for example, `zig build codegen -Dmodules=Gtk-4.0` will generate\nbindings for GTK 4 and anything else it depends on (Gio, GObject, GLib, and many\nothers).\n\nAlternatively, if a Flatpak development environment is set up (see the section\nabove), a predefined GIR profile can be selected using `-Dgir-profile`, which\nincludes all the modules available in a specific GNOME SDK. The predefined\nprofiles track the latest two GNOME releases.\n\nGIR files are assumed to be located in `/usr/share/gir-1.0` unless this is\noverridden via `-Dgir-files-path`.\n\nThe bindings are generated to the `bindings` directory under the build prefix\n(by default, `zig-out`).\n\n### Fixing broken GIR files\n\nSometimes, there are errors in GIR files which result in incorrect or incomplete\nbindings. The codegen process can handle this via XSLT stylesheets, which are\nnamed after the modules whose GIR files they correct. This project maintains\nstylesheets fixing known GIR issues in `gir-fixes`.\n\nThe XSLT stylesheets are applied using the `xsltproc` program, which is part of\nthe libxslt project. At this time, this is a system command dependency; there is\nno support yet for building xsltproc from source due to\nhttps://github.com/ianprime0509/zig-libxml2/issues/1\n\n### Writing bindings by hand\n\nWhile the binding generator is capable of generating good bindings from GIR\ninput, it is sometimes necessary or desirable to bypass GIR for everything\nexcept build-related metadata (library dependencies, etc.) and write Zig\nbindings by hand. This is the strategy taken for Cairo, using the Cairo bindings\nin `binding-overrides`.\n\nAny manual binding files present in `binding-overrides` will cause codegen of\nbindings to be skipped for the corresponding modules, using the manual bindings\ninstead.\n\n## Running tests\n\n`zig build test` will run the binding generator's tests. If bindings have been\ngenerated, the `test` project directory contains a package depending on them\nwhich runs tests on the generated bindings. The `zig build test` command in the\n`test` project accepts the same `modules` and `gir-profile` options as the\ncodegen command to specify which modules to test (unlike codegen, the `modules`\noption here specifies a complete list of modules to test: there is no discovery\nand testing of dependency modules).\n\n## Further reading\n\n- [Binding strategy](./doc/binding-strategy.md)\n\n## License\n\nThis project is released under the [Zero-Clause BSD\nLicense](https://spdx.org/licenses/0BSD.html). The libraries exposed by the\ngenerated bindings are subject to their own licenses.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fianprime0509%2Fzig-gobject","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fianprime0509%2Fzig-gobject","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fianprime0509%2Fzig-gobject/lists"}