update to zig 0.13.0
This commit is contained in:
parent
f5a4ba4503
commit
5188d778be
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,3 +1,3 @@
|
|||||||
zig-cache
|
.zig-cache
|
||||||
zig-out
|
zig-out
|
||||||
result
|
result
|
||||||
|
15
README.md
Normal file
15
README.md
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
# Artificer
|
||||||
|
|
||||||
|
## Run the CLI
|
||||||
|
|
||||||
|
```shell
|
||||||
|
zig build run-cli -- <token-file>
|
||||||
|
```
|
||||||
|
|
||||||
|
## Update nix build.zig.zon dependencies
|
||||||
|
|
||||||
|
```shell
|
||||||
|
nix run github:Cloudef/zig2nix#zon2json-lock -- build.zig.zon
|
||||||
|
nix run github:Cloudef/zig2nix#zon2nix -- build.zig.zon > ./deps.nix
|
||||||
|
rm build.zig.zon2json-lock
|
||||||
|
```
|
@ -6,7 +6,7 @@ pub fn EnumStringUtils(TargetEnum: anytype, str_to_tag_mapping: anytype) type {
|
|||||||
@compileLog("Mapping is not exhaustive");
|
@compileLog("Mapping is not exhaustive");
|
||||||
}
|
}
|
||||||
|
|
||||||
const EnumMapping = std.ComptimeStringMap(TargetEnum, str_to_tag_mapping);
|
const EnumMapping = std.StaticStringMap(TargetEnum).initComptime(str_to_tag_mapping);
|
||||||
|
|
||||||
return struct {
|
return struct {
|
||||||
pub fn fromString(str: []const u8) ?TargetEnum {
|
pub fn fromString(str: []const u8) ?TargetEnum {
|
||||||
|
10
build.zig
10
build.zig
@ -65,6 +65,9 @@ pub fn build(b: *std.Build) void {
|
|||||||
|
|
||||||
const run_step = b.step("run-cli", "Run the CLI");
|
const run_step = b.step("run-cli", "Run the CLI");
|
||||||
run_step.dependOn(&run_cmd.step);
|
run_step.dependOn(&run_cmd.step);
|
||||||
|
|
||||||
|
const build_step = b.step("build-cli", "Build the CLI");
|
||||||
|
build_step.dependOn(&b.addInstallArtifact(cli, .{}).step);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
@ -83,15 +86,14 @@ pub fn build(b: *std.Build) void {
|
|||||||
gui.linkLibrary(raylib_dep.artifact("raylib"));
|
gui.linkLibrary(raylib_dep.artifact("raylib"));
|
||||||
gui.root_module.addImport("raylib", raylib_dep.module("raylib"));
|
gui.root_module.addImport("raylib", raylib_dep.module("raylib"));
|
||||||
|
|
||||||
b.installArtifact(gui);
|
|
||||||
|
|
||||||
const run_cmd = b.addRunArtifact(gui);
|
const run_cmd = b.addRunArtifact(gui);
|
||||||
run_cmd.step.dependOn(b.getInstallStep());
|
|
||||||
|
|
||||||
if (b.args) |args| {
|
if (b.args) |args| {
|
||||||
run_cmd.addArgs(args);
|
run_cmd.addArgs(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const build_step = b.step("build-gui", "Build the GUI");
|
||||||
|
build_step.dependOn(&b.addInstallArtifact(gui, .{}).step);
|
||||||
|
|
||||||
const run_step = b.step("run-gui", "Run the GUI");
|
const run_step = b.step("run-gui", "Run the GUI");
|
||||||
run_step.dependOn(&run_cmd.step);
|
run_step.dependOn(&run_cmd.step);
|
||||||
}
|
}
|
||||||
|
@ -1,15 +1,20 @@
|
|||||||
.{
|
.{
|
||||||
.name = "artificer",
|
.name = "artificer",
|
||||||
.version = "0.1.0",
|
.version = "0.1.0",
|
||||||
.minimum_zig_version = "0.12.0",
|
.minimum_zig_version = "0.13.0",
|
||||||
.dependencies = .{
|
.dependencies = .{
|
||||||
.@"raylib-zig" = .{
|
.@"raylib-zig" = .{
|
||||||
.url = "https://github.com/Not-Nik/raylib-zig/archive/43d15b05c2b97cab30103fa2b46cff26e91619ec.tar.gz",
|
.url = "https://github.com/Not-Nik/raylib-zig/archive/43d15b05c2b97cab30103fa2b46cff26e91619ec.tar.gz",
|
||||||
.hash = "12204a223b19043e17b79300413d02f60fc8004c0d9629b8d8072831e352a78bf212"
|
.hash = "12204a223b19043e17b79300413d02f60fc8004c0d9629b8d8072831e352a78bf212"
|
||||||
},
|
},
|
||||||
|
// TODO: Use 's2s' from 'ziglibs' when zig 0.14.0 is released
|
||||||
|
// .s2s = .{
|
||||||
|
// .url = "https://github.com/ziglibs/s2s/archive/b30205d5e9204899fb6d0fdf28d00ed4d18fe9c9.tar.gz",
|
||||||
|
// .hash = "12202c39c98f05041f1052c268132669dbfcda87e4dbb0353cd84a6070924c8ac0e3",
|
||||||
|
// },
|
||||||
.s2s = .{
|
.s2s = .{
|
||||||
.url = "https://github.com/ziglibs/s2s/archive/b30205d5e9204899fb6d0fdf28d00ed4d18fe9c9.tar.gz",
|
.url = "https://github.com/Deecellar/s2s/archive/4314e9bd2a50cbfd497868a66d758464eefe5076.tar.gz",
|
||||||
.hash = "12202c39c98f05041f1052c268132669dbfcda87e4dbb0353cd84a6070924c8ac0e3",
|
.hash = "1220d2cf253817dd18c8486336b68b465e7c98268d3c5449df81736f42d7be0870a8",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
.paths = .{""},
|
.paths = .{""},
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
{ stdenv,
|
{ stdenv,
|
||||||
zig_0_12,
|
zig_0_13,
|
||||||
lib,
|
lib,
|
||||||
|
callPackage,
|
||||||
version ? "git",
|
version ? "git",
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
@ -10,10 +11,12 @@ stdenv.mkDerivation {
|
|||||||
src = lib.cleanSource ./.;
|
src = lib.cleanSource ./.;
|
||||||
|
|
||||||
nativeBuildInputs = [
|
nativeBuildInputs = [
|
||||||
zig_0_12.hook
|
zig_0_13.hook
|
||||||
];
|
];
|
||||||
|
|
||||||
preConfigure = ''
|
preConfigure = ''
|
||||||
zigBuildFlags="-Dtarget=x86_64-linux --release=fast"
|
mkdir -p .cache
|
||||||
|
ln -s ${callPackage ./deps.nix { zig = zig_0_13; }} .cache/p
|
||||||
|
zigBuildFlags="build-cli -Dtarget=x86_64-linux --release=fast --global-cache-dir $(pwd)/.cache"
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
78
deps.nix
Normal file
78
deps.nix
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
# generated by zon2nix (https://github.com/Cloudef/zig2nix)
|
||||||
|
|
||||||
|
{ lib, linkFarm, fetchurl, fetchgit, runCommandLocal, zig, name ? "zig-packages" }:
|
||||||
|
|
||||||
|
with builtins;
|
||||||
|
with lib;
|
||||||
|
|
||||||
|
let
|
||||||
|
unpackZigArtifact = { name, artifact }: runCommandLocal name {
|
||||||
|
nativeBuildInputs = [ zig ];
|
||||||
|
} ''
|
||||||
|
hash="$(zig fetch --global-cache-dir "$TMPDIR" ${artifact})"
|
||||||
|
mv "$TMPDIR/p/$hash" "$out"
|
||||||
|
chmod 755 "$out"
|
||||||
|
'';
|
||||||
|
|
||||||
|
fetchZig = { name, url, hash }: let
|
||||||
|
artifact = fetchurl { inherit url hash; };
|
||||||
|
in unpackZigArtifact { inherit name artifact; };
|
||||||
|
|
||||||
|
fetchGitZig = { name, url, hash }: let
|
||||||
|
parts = splitString "#" url;
|
||||||
|
url_base = elemAt parts 0;
|
||||||
|
url_without_query = elemAt (splitString "?" url_base) 0;
|
||||||
|
rev_base = elemAt parts 1;
|
||||||
|
rev = if match "^[a-fA-F0-9]{40}$" rev_base != null then rev_base else "refs/heads/${rev_base}";
|
||||||
|
in fetchgit {
|
||||||
|
inherit name rev hash;
|
||||||
|
url = url_without_query;
|
||||||
|
deepClone = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
fetchZigArtifact = { name, url, hash }: let
|
||||||
|
parts = splitString "://" url;
|
||||||
|
proto = elemAt parts 0;
|
||||||
|
path = elemAt parts 1;
|
||||||
|
fetcher = {
|
||||||
|
"git+http" = fetchGitZig { inherit name hash; url = "http://${path}"; };
|
||||||
|
"git+https" = fetchGitZig { inherit name hash; url = "https://${path}"; };
|
||||||
|
http = fetchZig { inherit name hash; url = "http://${path}"; };
|
||||||
|
https = fetchZig { inherit name hash; url = "https://${path}"; };
|
||||||
|
file = unpackZigArtifact { inherit name; artifact = /. + path; };
|
||||||
|
};
|
||||||
|
in fetcher.${proto};
|
||||||
|
in linkFarm name [
|
||||||
|
{
|
||||||
|
name = "12204a223b19043e17b79300413d02f60fc8004c0d9629b8d8072831e352a78bf212";
|
||||||
|
path = fetchZigArtifact {
|
||||||
|
name = "raylib-zig";
|
||||||
|
url = "https://github.com/Not-Nik/raylib-zig/archive/43d15b05c2b97cab30103fa2b46cff26e91619ec.tar.gz";
|
||||||
|
hash = "sha256-4SQd50vIK9XWMyuj/ymclmvj39BX4dp6ueFrgaEwRYM=";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
{
|
||||||
|
name = "1220aa75240ee6459499456ef520ab7e8bddffaed8a5055441da457b198fc4e92b26";
|
||||||
|
path = fetchZigArtifact {
|
||||||
|
name = "raylib";
|
||||||
|
url = "https://github.com/raysan5/raylib/archive/5767c4cd059e07355ae5588966d0aee97038a86b.tar.gz";
|
||||||
|
hash = "sha256-ijvgBlAfUD71p07Zg/oMzZnneQ95RoiaJXIkNlB26oc=";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
{
|
||||||
|
name = "122002d98ca255ec706ef8e5497b3723d6c6e163511761d116dac3aee87747d46cf1";
|
||||||
|
path = fetchZigArtifact {
|
||||||
|
name = "raygui";
|
||||||
|
url = "https://github.com/raysan5/raygui/archive/4b3d94f5df6a5a2aa86286350f7e20c0ca35f516.tar.gz";
|
||||||
|
hash = "sha256-AjU+fyonXnGTG8ZBMb10ScB3G6iI97eiL9N3anm+r1Q=";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
{
|
||||||
|
name = "1220d2cf253817dd18c8486336b68b465e7c98268d3c5449df81736f42d7be0870a8";
|
||||||
|
path = fetchZigArtifact {
|
||||||
|
name = "s2s";
|
||||||
|
url = "https://github.com/Deecellar/s2s/archive/4314e9bd2a50cbfd497868a66d758464eefe5076.tar.gz";
|
||||||
|
hash = "sha256-3d4O2roswVE62i2PMdik7fea5Rdc0ogDtcHUx9VUiM4=";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
]
|
8
flake.lock
generated
8
flake.lock
generated
@ -2,16 +2,16 @@
|
|||||||
"nodes": {
|
"nodes": {
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1722869614,
|
"lastModified": 1728492678,
|
||||||
"narHash": "sha256-7ojM1KSk3mzutD7SkrdSflHXEujPvW1u7QuqWoTLXQU=",
|
"narHash": "sha256-9UTxR8eukdg+XZeHgxW5hQA9fIKHsKCdOIUycTryeVw=",
|
||||||
"owner": "nixos",
|
"owner": "nixos",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "883180e6550c1723395a3a342f830bfc5c371f6b",
|
"rev": "5633bcff0c6162b9e4b5f1264264611e950c8ec7",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"owner": "nixos",
|
"owner": "nixos",
|
||||||
"ref": "nixos-24.05",
|
"ref": "nixos-unstable",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,8 @@
|
|||||||
description = "Artifacts MMO automation client";
|
description = "Artifacts MMO automation client";
|
||||||
|
|
||||||
inputs = {
|
inputs = {
|
||||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.05";
|
# TODO: Switch off 'unstable' when zig 0.13.0 is released in the stable branch
|
||||||
|
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = { self, nixpkgs }:
|
outputs = { self, nixpkgs }:
|
||||||
|
Loading…
Reference in New Issue
Block a user