| ... | ... | @@ -0,0 +1,80 @@ |
| 1 | # zigmod |
| 2 |  |
| 3 | [](https://github.com/nektro/zigmod/blob/master/LICENSE) |
| 4 | [](https://discord.gg/P6Y4zQC) |
| 5 | [](https://circleci.com/gh/nektro/zigmod) |
| 6 | [](https://github.com/nektro/zigmod/releases/latest) |
| 7 | [](https://goreportcard.com/report/github.com/nektro/zigmod) |
| 8 | [](https://www.codefactor.io/repository/github/nektro/zigmod) |
| 9 | [](https://github.com/nektro/zigmod/releases) |
| 10 | |
| 11 | A package manager for the Zig programming language. |
| 12 | |
| 13 | Zig |
| 14 | - https://ziglang.org/ |
| 15 | - https://github.com/ziglang/zig |
| 16 | - https://github.com/ziglang/zig/wiki/Community |
| 17 | |
| 18 | ## Download |
| 19 | Releases |
| 20 | - https://github.com/nektro/zigmod/releases |
| 21 | |
| 22 | Source |
| 23 | - `git clone https://github.com/nektro/zigmod.git` |
| 24 | - https://github.com/nektro/zigmod/archive/master.zip |
| 25 | |
| 26 | ## Usage |
| 27 | |
| 28 | ### `init` command |
| 29 | ``` |
| 30 | zigmod init [name] [entry_file] |
| 31 | ``` |
| 32 | |
| 33 | - `[name]` defaults to the name of the folder you run the program in. It will also remove `zig-` from the start of the directory name by default if is prefixed by that. |
| 34 | - `[entry_file]` defaults to `src/main.zig` |
| 35 | - This command will create a `zig.mod` file in the root of your project. It is in yaml syntax. |
| 36 | |
| 37 | ### `add` command |
| 38 | ``` |
| 39 | zigmod add <type> <path> |
| 40 | ``` |
| 41 | |
| 42 | - `<type>` is the type of package we're adding. Currently `git` is the only valid type. More to come. |
| 43 | - `<path>` is the URL to the package you'd like to include. |
| 44 | |
| 45 | ### `fetch` command |
| 46 | ``` |
| 47 | zigmod fetch |
| 48 | ``` |
| 49 | |
| 50 | - This command takes no parameters and will generate a `deps.zig` in the root of your project. |
| 51 | - `deps.zig` should not be checked into your source control. |
| 52 | |
| 53 | ### `deps.zig` |
| 54 | ```diff |
| 55 | const Builder = @import("std").build.Builder; |
| 56 | +const deps = @import("./deps.zig"); |
| 57 | |
| 58 | pub fn build(b: *Builder) void { |
| 59 | const target = b.standardTargetOptions(.{}); |
| 60 | |
| 61 | const mode = b.standardReleaseOptions(); |
| 62 | |
| 63 | const exe = b.addExecutable("zigmod", "src/main.zig"); |
| 64 | exe.setTarget(target); |
| 65 | exe.setBuildMode(mode); |
| 66 | + for (deps.packages) |pkg| { |
| 67 | + exe.addPackage(pkg); |
| 68 | + } |
| 69 | for (deps.system_libs) |lib| { |
| 70 | exe.linkSystemLibrary(lib); |
| 71 | } |
| 72 | exe.install(); |
| 73 | ``` |
| 74 | |
| 75 | ## Contact |
| 76 | - hello@nektro.net |
| 77 | - https://twitter.com/nektro |
| 78 | |
| 79 | ## License |
| 80 | MIT |