fix zig fetch command in README (#130)

* fix zig fetch command in README

All URLs within build.zig.zon files must point to archives that never
change.  However, the zig fetch command in the README.md adds a URL
that points to the `devel` git branch whose content changes whenever
the `devel` branch is updated.

I've updated the README a url that zig will resolve to a SHA before it
writes it to the zon file.

* Update template scripts

---------

Co-authored-by: Not-Nik <nik.wipper@gmx.de>
This commit is contained in:
Jonathan Marler 2024-11-25 06:19:38 -07:00 committed by GitHub
parent ff775330c7
commit 94570c4b60
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 5 additions and 13 deletions

View File

@ -64,7 +64,7 @@ want to run an example, say `basic_window` run `zig build basic_window`
Download and add raylib-zig as a dependency by running the following command in your project root: Download and add raylib-zig as a dependency by running the following command in your project root:
``` ```
zig fetch --save https://github.com/Not-Nik/raylib-zig/archive/devel.tar.gz zig fetch --save git+https://github.com/Not-Nik/raylib-zig#devel
``` ```
Then add raylib-zig as a dependency and import its modules and artifact in your `build.zig`: Then add raylib-zig as a dependency and import its modules and artifact in your `build.zig`:

View File

@ -61,22 +61,18 @@ pub fn build(b: *std.Build) !void {
New-Item -Name "build.zig" -ItemType "file" -Value $BUILD_DOT_ZIG -Force New-Item -Name "build.zig" -ItemType "file" -Value $BUILD_DOT_ZIG -Force
$HASH = $(zig fetch https://github.com/Not-Nik/raylib-zig/archive/devel.tar.gz)
$ZON_FILE = @" $ZON_FILE = @"
.{ .{
.name = "$PROJECT_NAME", .name = "$PROJECT_NAME",
.version = "0.0.1", .version = "0.0.1",
.dependencies = .{ .dependencies = .{
.@"raylib-zig" = .{
.url = "https://github.com/Not-Nik/raylib-zig/archive/devel.tar.gz",
.hash = "$HASH",
},
}, },
.paths = .{""}, .paths = .{""},
} }
"@ "@
zig fetch --save git+https://github.com/Not-Nik/raylib-zig#devel
New-Item -Name "build.zig.zon" -ItemType "file" -Value $ZON_FILE -Force New-Item -Name "build.zig.zon" -ItemType "file" -Value $ZON_FILE -Force
New-Item -Name "src" -ItemType "directory" New-Item -Name "src" -ItemType "directory"

View File

@ -57,20 +57,16 @@ pub fn build(b: *std.Build) !void {
b.installArtifact(exe); b.installArtifact(exe);
}' >> build.zig }' >> build.zig
HASH=$(zig fetch https://github.com/Not-Nik/raylib-zig/archive/devel.tar.gz)
echo '.{ echo '.{
.name = "'$PROJECT_NAME'", .name = "'$PROJECT_NAME'",
.version = "0.0.1", .version = "0.0.1",
.dependencies = .{ .dependencies = .{
.@"raylib-zig" = .{
.url = "https://github.com/Not-Nik/raylib-zig/archive/devel.tar.gz",
.hash = "'$HASH'",
},
}, },
.paths = .{""}, .paths = .{""},
}' >> build.zig.zon }' >> build.zig.zon
zig fetch --save git+https://github.com/Not-Nik/raylib-zig#devel
mkdir src mkdir src
mkdir resources mkdir resources
touch resources/placeholder.txt touch resources/placeholder.txt