{"id":26560761,"url":"https://github.com/dasimmet/zig_pkg_tool","last_synced_at":"2025-10-26T23:08:09.727Z","repository":{"id":282779467,"uuid":"887967264","full_name":"dasimmet/zig_pkg_tool","owner":"dasimmet","description":"a command line tool to work with build.zig dependencies and build graphs","archived":false,"fork":false,"pushed_at":"2025-09-18T19:31:06.000Z","size":309,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-18T22:01:41.059Z","etag":null,"topics":["zig","zig-package"],"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/dasimmet.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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-11-13T15:32:46.000Z","updated_at":"2025-09-18T19:31:09.000Z","dependencies_parsed_at":null,"dependency_job_id":"a32d4c90-5f0e-4d13-ab05-62f1bdab0db6","html_url":"https://github.com/dasimmet/zig_pkg_tool","commit_stats":null,"previous_names":["dasimmet/zig_pkg_tool"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/dasimmet/zig_pkg_tool","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dasimmet%2Fzig_pkg_tool","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dasimmet%2Fzig_pkg_tool/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dasimmet%2Fzig_pkg_tool/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dasimmet%2Fzig_pkg_tool/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dasimmet","download_url":"https://codeload.github.com/dasimmet/zig_pkg_tool/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dasimmet%2Fzig_pkg_tool/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":281185454,"owners_count":26457747,"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-10-26T02:00:06.575Z","response_time":61,"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":["zig","zig-package"],"created_at":"2025-03-22T13:29:52.246Z","updated_at":"2025-10-26T23:08:09.722Z","avatar_url":"https://github.com/dasimmet.png","language":"Zig","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Zig Package tool\n\na command line tool to work with `build.zig` dependencies and build graphs.\n\nIt embeds custom build runners to retrieve build graph information,\nused to backup dependencies, output a graphviz `dot` file etc.\n\nThe repo vendors zig's `build-runner.zig` with an inserted hook\nto serialize the `std.Build` struct to `zon` and send it from the subpocess stdout\nback to `zigpkg`.\nThen that information is used to perform operations based on the build graph.\n\nIt is compatible and requires with `zig \u003e= 0.14.0` at runtime, when zig master\nstarts making changes to the build runner the vendored runner needs to be versioned\ninside this tool.\n\n## Usage\n\n```\n\u003e zig build\n\u003e ./zig-out/bin/zigpkg --help\n# or:\n\u003e zig build zigpkg -- --help\nusage: zigpkg \u003csubcommand\u003e [--help]\n\nstores all dependencies of a directory containing build.zig.zon in a .tar.gz archive\n\navailable subcommands:\n  dot     rerun \"zig build\" and output a graphviz \".dot\" file of build steps based on args\n  dotall  rerun \"zig build\" and output a graphviz \".dot\" file of all build steps\n  zon     rerun \"zig build\" with a custom build runner and output the build graph as .zon to stdout\n  json    same as \"zon\" but output json\n  deppkg  more subcommands for creating and working with \"deppkg.tar.gz\" files storing all\n          dependencies required to build a zig package\n\nenvironment variables:\n\n  ZIG: path to the zig compiler to invoke in subprocesses. defaults to \"zig\".\n\n```\n\n## Dependency packages\n\nThe \"deppkg create\" subcommand generates a single archive containing all dependencies\nzig fetches for same arguments you would provide to \"zig build\".\n\nThe file can be verified with the \"deppkg extract\" subcommand, which repacks the\nindividual dependencies into temporary tar archives, loads them back into zigs\npackage cache with \"zig fetch\", and compares the hash generated by zig with the\narchive.\n\nSo when releasing a zig project with dependencies, you can include the deppkg\narchive as a complete source distribution that is buildable even when upstream\ndependencies become unavailable for whatever reason.\n\nBe aware that not all lazy dependencies may be fetched depending on the provided\narguments (and even the \"native target\" if some host build steps switch out dependencies\nbased on it).\nThis means the user is to provide build options that will fetch all dependencies\nhe expects to be in the package.\n\nFor now, this tool does not use the exact same filter logic as zig's filter on the `paths`\nfield of `build.zig.zon`, so it cannot guarantee that the packaged dependencies\nproduce the same hash. In that case the extract command will fail. That could be\navoided by vendoring zig's Manifest parser or making it available in the standard\nlibrary in the future.\nNot applying any filter would be an option too, but other tools\nlike a misconfigured `zls` may write files into the zig package cache and add\nfiles we dont want too include in the package:\n\n```\nls ~/.cache/zig/p/known_folders-0.0.0-Fy-PJtLDAADGDOwYwMkVydMSTp_aN-nfjCZw6qPQ2ECL/.zig-cache\nh  o  tmp  z\n```\n\n## Graphviz dependency graph\n\nthis executes `zig build` with a custom build runner (including potiential additional arguments),\nto convert the `Build.Step` graph to basic graphviz `dot` code.\nthat can be easily be converted to the svg form.\nFor now, generated dot strings are not escaped and might break.\n\nSince the build graph is dependent on the original invocation of `zig build`,\nintegration into the build system is not easy. It's easier to build `zigpkg`\nmanually, and invoke `zigpkg dot \u003cbuild_root\u003e [zig build ards]` with the same arguments\nas `zig build`.\n\n```bash\n# cli\n./zig-out/bin/zigpkg dot . install | dot -Tsvg \u003e graph.svg\n```\n\n![Build Graph](graph.svg?sanitize=true)\n\n```zig\n// build.zig usage\n// - the disadvantage here is, `dotGraphStep` basically reruns `zig build`,\n//   and passes the extra arguments down, but does not know about the original arguments.\n// - svgGraph is a system \"dot\" command\nconst zig_pkg_tool = @import(\"pkg_tool\");\nconst svggraph = zig_pkg_tool.svgGraph(b, zig_pkg_tool.dotGraphStep(b, \u0026.{\n    \"install\", // extra args zig build, e.g. targets\n    \"dot\",\n    \"test\",\n    \"run\",\n}).captureStdOut());\nb.step(\"dot\", \"install graph.svg\").dependOn(\u0026b.addInstallFile(\n    svggraph,\n    \"graph.svg\",\n).step);\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdasimmet%2Fzig_pkg_tool","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdasimmet%2Fzig_pkg_tool","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdasimmet%2Fzig_pkg_tool/lists"}