Skip to content

Commit

Permalink
cbuild: add zig_package build style
Browse files Browse the repository at this point in the history
  • Loading branch information
ifreund committed Feb 8, 2024
1 parent 500efd4 commit a0b6681
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 16 deletions.
5 changes: 5 additions & 0 deletions src/cbuild/build_style/zig_package.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from cbuild.util import zig_package


def use(tmpl):
tmpl.do_install = zig_package.install
14 changes: 14 additions & 0 deletions src/cbuild/util/zig_package.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
def install(pkg):
zig_pkg_hash = pkg.do(
"zig",
"fetch",
"--global-cache-dir",
"/tmp",
".",
capture_output=True,
).stdout.strip().decode("utf-8")

pkg.install_files(
"/tmp/p/" + zig_pkg_hash,
"usr/src/zig/packages/",
)
10 changes: 2 additions & 8 deletions user/zig-wayland/template.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
pkgname = "zig-wayland"
pkgver = "0.1.0"
pkgrel = 0
build_style = "zig_package"
hostmakedepends = ["zig"]
pkgdesc = "Zig bindings for libwayland"
maintainer = "Isaac Freund <mail@isaacfreund.com>"
license = "MIT"
Expand All @@ -9,13 +11,5 @@
sha256 = "46ce978744d2b4e5ba563b220a9a7a320fc1ea7b15b82800825efd685fa7e0af"


def do_install(self):
self.install_files(
".",
"usr/src/zig/packages/",
name="122062beeb6fd2bb21c91e81acb3ea6cbba69d3c00a31b62732254e190b5fc7a934e",
)


def post_install(self):
self.install_license("LICENSE")
10 changes: 2 additions & 8 deletions user/zig-xkbcommon/template.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
pkgname = "zig-xkbcommon"
pkgver = "0.1.0"
pkgrel = 0
build_style = "zig_package"
hostmakedepends = ["zig"]
pkgdesc = "Zig bindings for xkbcommon"
maintainer = "Isaac Freund <mail@isaacfreund.com>"
license = "MIT"
Expand All @@ -9,13 +11,5 @@
sha256 = "9140440d82266b9d912a988a0bb219cd01e65582104f01870cfc3dc47635a9ba"


def do_install(self):
self.install_files(
".",
"usr/src/zig/packages/",
name="1220ed0ec8a6cb1990c2f95bfd71fe7f8bcb6b8e4778573f03b3c755ea81fbf74ee8",
)


def post_install(self):
self.install_license("LICENSE")

0 comments on commit a0b6681

Please sign in to comment.