{"id":26895288,"url":"https://github.com/daylinmorgan/forge","last_synced_at":"2025-05-12T19:13:25.445Z","repository":{"id":193362408,"uuid":"688654853","full_name":"daylinmorgan/forge","owner":"daylinmorgan","description":"build nim binaries for all the platforms","archived":false,"fork":false,"pushed_at":"2025-01-26T02:53:12.000Z","size":50,"stargazers_count":12,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-05-12T19:13:19.134Z","etag":null,"topics":["nim","nimble","zig"],"latest_commit_sha":null,"homepage":"","language":"Nim","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/daylinmorgan.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-09-07T20:13:48.000Z","updated_at":"2025-01-31T06:15:34.000Z","dependencies_parsed_at":"2023-09-07T23:09:34.514Z","dependency_job_id":"f11939a7-b96b-4671-a360-5406f57a90e5","html_url":"https://github.com/daylinmorgan/forge","commit_stats":null,"previous_names":["daylinmorgan/forge"],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daylinmorgan%2Fforge","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daylinmorgan%2Fforge/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daylinmorgan%2Fforge/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daylinmorgan%2Fforge/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/daylinmorgan","download_url":"https://codeload.github.com/daylinmorgan/forge/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253805849,"owners_count":21967053,"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":["nim","nimble","zig"],"created_at":"2025-04-01T01:55:10.557Z","updated_at":"2025-05-12T19:13:25.419Z","avatar_url":"https://github.com/daylinmorgan.png","language":"Nim","funding_links":[],"categories":[],"sub_categories":[],"readme":"# forge\n\n[![nimble][nimble-shield]][nimpkgs-link]\n\nA basic toolchain to forge (cross-compile) your multi-platform `nim` binaries.\n\n## Why?\n\n`Nim` is a great language and the code is as portable as any other code written in C.\nBut who wants to manage C toolchains or CI/CD DSL's to cross-compile your code into easily sharable native executable binaries\n\n## Installation\n\nIn order to use `forge` you must first install [`zig`](https://ziglang.org/) as all compilation\nis done using a thin wrapper around `zig cc`.\n\n\u003e [!NOTE]\n\u003e Future versions may use an automated/isolated `zig` installation.\n\n```sh\nnimble install https://github.com/daylinmorgan/forge\n```\n\n## Usage\n\n`Forge` provide two key methods to compile your `nim` source `forge cc` and `forge release`.\n\n\n### `forge cc`\n\nTo compile a single binary for a platform you can use `forge cc`.\n\nExample:\n\n```sh\nforge cc --target x86_64-linux-musl -- -d:release src/forge.nim -o:forge\n```\n\n### `forge release`\n\nThis command is useful for generating many compiled binaries like you may be accustomed to seeing from `go` or `rust` cli's.\n`Forge release` will make attempts to infer many values based on the assumption that it's\nlikely run from the root directory of a `nim` project with a `\u003cproject\u003e.nimble`\n\nYou can either specify all commands on the CLI or use a config file.\n\nExample:\n\n```sh\nforge release --target,=x86_64-linux-musl,x86_64-macos-none --bin src/forge.nim\n```\n\nResult:\n```\ndist\n├── forge-v2023.1001-x86_64-linux-musl\n│   └── forge\n└── forge-v2023.1001-x86_64-macos-none\n    └── forge\n```\n\nThe output directories used for each binary are determined\nby a format string: `${name}-v${version}-${target}`.\nYou can modify this with additional info at runtime like using\ndate instead of version string: `--format \"\\${name}-$(date +'%Y%M%d')-\\${target}\"`.\n\nYou can also create a config file by default at `./.forge.cfg` that controls the behavior of `forge release`:\n\n```dosini\n# flags are specified at the top level\nnimble # key without value for booleans\nformat = \"${name}-${target}\"\noutdir = forge-dist\n\n# use sections to list targets/bins with optional args\n[target]\nx86_64-linux-musl = \"--debugInfo:on\"\nx86_64-linux-gnu\n\n[bin]\nsrc/forge\nsrc/forgecc = \"--opt:size\" # use a custom flag for this binary\n```\n\nExample:\n```sh\nforge release --verbose --dryrun\n```\n\nOutput:\n```\nforge release -V --dryrun\nforge || config =\n| nimble  true\n| outdir  forge-dist\n| format  ${name}-${target}\n| version 2023.1001\n| targets:\n|   x86_64-linux-musl|--debugInfo:on\n|   x86_64-linux-gnu\n| bins:\n|   src/forge\n|   src/forgecc|--opt:size\nforge || dry run...see below for commands\nforge || compiling 2 binaries for 2 targets\nnimble c --cpu:amd64 --os:Linux --cc:clang --clang.exe='forgecc' --clang.linkerexe='forgecc' --passC:'-target x86_64-linux-musl' --passL:'-target x86_64-linux-musl' -d:release --outdir:'dist/forge-x86_64-linux-musl' --debugInfo:on src/forge\nnimble c --cpu:amd64 --os:Linux --cc:clang --clang.exe='forgecc' --clang.linkerexe='forgecc' --passC:'-target x86_64-linux-musl' --passL:'-target x86_64-linux-musl' -d:release --outdir:'dist/forge-x86_64-linux-musl' --debugInfo:on --opt:size src/forgecc\nnimble c --cpu:amd64 --os:Linux --cc:clang --clang.exe='forgecc' --clang.linkerexe='forgecc' --passC:'-target x86_64-linux-gnu' --passL:'-target x86_64-linux-gnu' -d:release --outdir:'dist/forge-x86_64-linux-gnu' src/forge\nnimble c --cpu:amd64 --os:Linux --cc:clang --clang.exe='forgecc' --clang.linkerexe='forgecc' --passC:'-target x86_64-linux-gnu' --passL:'-target x86_64-linux-gnu' -d:release --outdir:'dist/forge-x86_64-linux-gnu' --opt:size src/forgecc\n\n```\n\n## Acknowledgements\n\nThanks to [Andrew Kelley](https://github.com/andrewrk) and the many `zig` [contributors](https://github.com/ziglang/zig/graphs/contributors).\n\n\n\u003c!-- shields/links --\u003e\n\n[nimble-shield]: https://img.shields.io/github/v/tag/daylinmorgan/forge?filter=v*\u0026logo=Nim\u0026label=nimble\u0026labelColor=black\u0026color=%23f3d400\n[nimpkgs-link]: https://nimpkgs.dayl.in/#/pkg/forge","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdaylinmorgan%2Fforge","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdaylinmorgan%2Fforge","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdaylinmorgan%2Fforge/lists"}