{"id":22543128,"url":"https://github.com/cryptocode/stitch","last_synced_at":"2025-04-09T22:53:29.467Z","repository":{"id":181706690,"uuid":"619236962","full_name":"cryptocode/stitch","owner":"cryptocode","description":"Append resources to your executables","archived":false,"fork":false,"pushed_at":"2025-03-04T11:13:38.000Z","size":35,"stargazers_count":10,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-09T22:53:23.889Z","etag":null,"topics":["zig","zig-library","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/cryptocode.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":"2023-03-26T17:04:23.000Z","updated_at":"2025-03-04T11:13:41.000Z","dependencies_parsed_at":"2024-03-21T13:29:02.477Z","dependency_job_id":"0fbd98ea-0329-440d-a4b2-5a77a4380259","html_url":"https://github.com/cryptocode/stitch","commit_stats":null,"previous_names":["cryptocode/stitch"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cryptocode%2Fstitch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cryptocode%2Fstitch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cryptocode%2Fstitch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cryptocode%2Fstitch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cryptocode","download_url":"https://codeload.github.com/cryptocode/stitch/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248125634,"owners_count":21051766,"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":["zig","zig-library","zig-package"],"created_at":"2024-12-07T13:14:23.843Z","updated_at":"2025-04-09T22:53:29.458Z","avatar_url":"https://github.com/cryptocode.png","language":"Zig","readme":"\u003cimg align=\"right\" height=\"120\" src=\"https://user-images.githubusercontent.com/34946442/232327201-294224c2-8502-423b-b2cb-663ca88ccfc1.png\"\u003e\n\n\u003cimg src=\"https://user-images.githubusercontent.com/34946442/230613201-60de5adc-6304-4f18-84d9-d36bb46fdc1f.svg\" width=\"24\" height=\"24\"\u003e\u0026nbsp;\n\u003cimg src=\"https://user-images.githubusercontent.com/34946442/230613198-ca5c938a-613b-412f-8d97-8ce8f19aeb1f.svg\" width=\"24\" height=\"24\"\u003e\u0026nbsp;\n\u003cimg src=\"https://user-images.githubusercontent.com/34946442/230613203-858cb471-2859-4e6e-8ef9-61b03c36c085.svg\" width=\"24\" height=\"24\"\u003e\n\nStitch is a tool and library for Zig and C for adding and retrieving resources to and from executables.\n\nWhy not just use `@embedFile` / `#embed`? Stitch serves a different purpose, namely to let build systems, and *users* of your software, create self-contained executables.\n\nFor example, instead of requiring users to install an interpreter and execute `mylisp fib.lisp`, they can simply run `./fib` or `fib.exe`\n\nResoures can be anything, such as scripts, images, text, templates config files and other executables.\n\n## Some use cases\n* Self extracting tools, like an installer\n* Create executables for scripts written in your interpreted programming language\n* Include a sample config file, which is extracted on first run. The user can then edit this.\n* An image in your own format that's able to display itself when executed\n\n## Building the project\nTo build with Zig 0.13, use the `zig-\u003cversion\u003e` tag/release.\nTo build with Zig 0.14 or master, use the main branch (last tested with Zig version `0.14.0-dev.3470+711b0fef5`)\n\n`zig build` will put a `bin` and `lib` directory in your output folder (e.g. zig-out)\n\n* bin/stitch is a standalone tool for attaching resources to executables. This can also be done programmatically using the library\n* lib/libstitch is a library for reading attached resources from the current executable, and for adding resources to executables (like the standalone tool)\n\n## Using the tool\n\nThis example adds two scripts to a Lisp interpreter that supports, through the stitch library, reading embedded scripts:\n\n```bash\nstitch ./mylisp std.lisp fib.lisp --output fib\n\n./fib 8\n21\n```\n\nResources can be named explicitly\n\n```bash\nstitch ./mylisp std=std.lisp fibonacci=fib.lisp --output fib\n```\n\nIf a name is not given, the filename (without path) is used. The stitch library supports finding resources by name or index.\n\nThe `--output` flag is optional. By default, resources are added to the original executable (first argument)\n## Stitching programmatically\nLet's say you want your interpreted programming language to support producing binaries.\n\nAn easy way to do this is to create an interpreter executable that reads scripts attached to itself using stitch.\n\nYou can provide interpreter binaries for all the OS'es you wanna support, or have the Zig build file do this if your user is building the interpreter.\n\nIn the example below, a Lisp interpreter uses the stitch library to support creating self-contained executables:\n\n```bash\n./mylisp --create-exe sql-client.lisp --output sql-client\n```\nThe resulting binary can now be executed:\n\n```\n./sql-client\n```\n\nYou can make the `mylisp` binary understand stitch attachments and then make a copy of it and stitch it with the scripts. Alternatively, you can have separate interpreter binaries specifically for reading stitched scripts.\n## Using the library from C\n\nInclude the `stitch.h` header and link to the library. Here's an example, using the included C test program:\n\n```bash\nzig build-exe c-api/test/c-test.c -Lzig-out/lib -lstitch -Ic-api/include\n./c-test\n```\n\n## Binary layout\n\nThe binary layout specification can be used by other tools that wants to parse files produced by Stitch, without using the Stitch library.\n\n[Specification](spec/README.md)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcryptocode%2Fstitch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcryptocode%2Fstitch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcryptocode%2Fstitch/lists"}