Skip to content

Commit

Permalink
some attempts
Browse files Browse the repository at this point in the history
  • Loading branch information
Yangff committed May 30, 2024
1 parent 1b3cbd8 commit 4b9fe63
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
34 changes: 34 additions & 0 deletions deps/third-repo/packages/z/zigcc/xmake.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package("zigcc")
set_kind("toolchain")
set_homepage("https://www.ziglang.org/")
set_description("Zig is a general-purpose programming language and toolchain for maintaining robust, optimal, and reusable software.")

on_source(function (package)
local jsonfile = os.tmpfile() .. ".json"
import("net.http")
http.download("https://ziglang.org/download/index.json", jsonfile)
import("core.base.json")
local json = json.loadfile(jsonfile)["master"]
-- print(json)
if is_host("windows") then
-- print("Windows: " .. json["x86_64-windows"]["tarball"])
package:set("urls", json["x86_64-windows"]["tarball"])
package:add("versions", "v0.13.0", json["x86_64-windows"]["shasum"])
elseif is_host("linux") then
-- print("Linux: " .. json["x86_64-linux"]["tarball"])
package:set("urls", json["x86_64-linux"]["tarball"])
package:add("versions", "v0.13.0", json["x86_64-linux"]["shasum"])
else
print("Unsupported platform!")
end
end)

on_install("@macosx", "@linux", "@windows", "@msys", "@bsd", function (package)
print("Install?" .. package:installdir())
os.cp("*", package:installdir())
package:addenv("PATH", package:installdir())
end)

on_test(function (package)
os.vrun("zig version")
end)
2 changes: 2 additions & 0 deletions xmake.lua
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ toolchain_end()

if is_plat("linux") then
if has_config("zig") then
-- add_requires("zigcc", {system = false})
-- set_toolchains("zigcross@zigcc", "rust")
set_toolchains("zigcross", "rust")
if is_host("windows") then
set_arch("x86_64-unknown-linux-gnu")
Expand Down

0 comments on commit 4b9fe63

Please sign in to comment.