{"id":15721848,"url":"https://github.com/ppebb/cosmo-gtk-template","last_synced_at":"2025-03-31T10:30:47.814Z","repository":{"id":245394476,"uuid":"818052740","full_name":"ppebb/cosmo-gtk-template","owner":"ppebb","description":"A build-once run-anywhere GTK program. ","archived":false,"fork":false,"pushed_at":"2024-07-10T19:57:58.000Z","size":4070,"stargazers_count":22,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-10-25T09:12:26.527Z","etag":null,"topics":["cosmopolitan","gdk","glib2","gobject","gsk","gtk4"],"latest_commit_sha":null,"homepage":"","language":"Lua","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/ppebb.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}},"created_at":"2024-06-21T02:13:45.000Z","updated_at":"2024-10-03T15:49:12.000Z","dependencies_parsed_at":"2024-06-28T06:28:30.969Z","dependency_job_id":"1c0e45e3-6932-4adb-bf2f-3d5c49ac3b69","html_url":"https://github.com/ppebb/cosmo-gtk-template","commit_stats":null,"previous_names":["ppebb/cosmo-gtk-template"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ppebb%2Fcosmo-gtk-template","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ppebb%2Fcosmo-gtk-template/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ppebb%2Fcosmo-gtk-template/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ppebb%2Fcosmo-gtk-template/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ppebb","download_url":"https://codeload.github.com/ppebb/cosmo-gtk-template/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":222655264,"owners_count":17017998,"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":["cosmopolitan","gdk","glib2","gobject","gsk","gtk4"],"created_at":"2024-10-03T22:01:51.121Z","updated_at":"2025-03-31T10:30:47.794Z","avatar_url":"https://github.com/ppebb.png","language":"Lua","funding_links":[],"categories":[],"sub_categories":[],"readme":"# cosmo-gtk-template - Maximal GTK sample for Cosmopolitan\n\nThis repository has been superceded by a general purpose tool, [cosmo-stub-generator](https://github.com/ppebb/cosmo-stub-generator). Use it instead.\n\nThis repository contains a full[^1] stub for GTK (and GSK, GDK), GLib, GIO, GObject, GModule, and GIRepository\n\n## Using the Stubs\nThe stub contains two folders, one for GLib and one for GTK located in the `stubs` folder. The necessary headers to build are not present, so run `scripts/copy_headers.sh` to copy the requisite headers into the `stubs` folder.\n\nSimply copy the `stubs` folder into your project and import `glib_stub.h` or `gtk_stub.h`.\n\nIf you use Clangd, a script to generate `compile_flags.txt`, `gen_compile_flags.sh`, is present. Run it with the path to cosmopolitan (should contain an include folder). The generated compile_flags.txt should be *mostly* functional.\n\n## Generating the Stub\n`generate.lua` in the scripts directory of this repository was used to generate the stub. If you can manage to make it work you can generate them yourself too. This requires lua \u003e= 5.2 (for use of the goto keyword) and [luafilesystem](https://github.com/lunarmodules/luafilesystem).\n\nThe only real configurable option is `set_guard_function_calls` in `scripts/generate.lua`. By changing the value in the function call to true, it will generate every function call with a null check, printing a message to stderr if it is null This does not prevent a segfault, it just makes debugging a little bit easier. Do not use this option for a release binary as it nearly doubles the size of the compiled binary.\n\nAs a warning, generating the stub will print a little under 50000 lines to your terminal, you may want to redirect them to a file, especially if something goes wrong.\n\n## Dependencies\nAll of the dependencies of GTK and GLib are required. See the Makefile if you are unsure.\n\nDepending on how you generated the stub, you will need Xlib and wayland-protocol headers.\n\n## References\nThis repository is based off of vkoskiv's [cosmo-sdl-template](https://github.com/vkoskiv/cosmo-sdl-template). The code used to stub GTK and GLib is largely the same.\n\n[^1]: Certain functions making use of variadic arguments do not have an equivalent function which takes a `va_list`. As a result the arguments passed using `...` cannot be forwarded to the stubbed function.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fppebb%2Fcosmo-gtk-template","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fppebb%2Fcosmo-gtk-template","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fppebb%2Fcosmo-gtk-template/lists"}