Skip to content
Draft

Zig 0.16 #59955

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions common/build-style/zig-build.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
do_build() {
local zig_target zig_cpu
local zig_target zig_cpu zig_search_prefix

# TODO: This duplication between build-profiles and cross-profiles
# is totally unnecessary. It would be nice if there was some way to
# avoid it.
if [ "$CROSS_BUILD" ]; then
zig_target="${XBPS_CROSS_ZIG_TARGET}"
zig_cpu="${XBPS_CROSS_ZIG_CPU}"
zig_search_prefix=/
else
zig_target="${XBPS_ZIG_TARGET}"
zig_cpu="${XBPS_ZIG_CPU}"
zig_search_prefix=/usr
fi

# Inform zig of the required libc include paths.
Expand All @@ -30,8 +32,8 @@ do_build() {
# prefix used by the zig build system.
DESTDIR="zig-out" zig build \
-j"${XBPS_MAKEJOBS}" \
--sysroot "${XBPS_CROSS_BASE}" \
--search-prefix "${XBPS_CROSS_BASE}/usr" \
--sysroot "${XBPS_CROSS_BASE:-/}" \
--search-prefix "${zig_search_prefix}" \
--prefix /usr \
--global-cache-dir /host/zig \
--libc xbps_zig_libc.txt \
Expand Down
7 changes: 4 additions & 3 deletions srcpkgs/linuxwave/template
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
# Template file for 'linuxwave'
pkgname=linuxwave
version=0.2.0
version=0.4.0
revision=1
build_style=zig-build
configure_args="-Dpie"
short_desc="Generate music from the entropy of Linux"
maintainer="tranzystorekk <tranzystorek.io@protonmail.com>"
license="MIT"
homepage="https://orhun.dev/linuxwave/"
changelog="https://raw.githubusercontent.com/orhun/linuxwave/main/CHANGELOG.md"
distfiles="https://github.com/orhun/linuxwave/releases/download/v${version}/v${version}.tar.gz"
checksum=593b05809f68c830c95a3176fbec358306aff19238ca2ecdacfbeaabfefdab83
distfiles="https://github.com/orhun/linuxwave/archive/refs/tags/v${version}.tar.gz"
checksum=be5a2c9e5c59e3b241f9065cd922aace8595fbe2123843a6e3a43757b86f5ffe

post_install() {
vlicense LICENSE
Expand Down
27 changes: 27 additions & 0 deletions srcpkgs/river-classic/template
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Template file for 'river-classic'
pkgname=river-classic
version=0.3.17
revision=1
build_style=zig-build
configure_args="-Dpie -Dllvm $(vopt_if xwayland -Dxwayland)"
hostmakedepends="pkg-config scdoc"
makedepends="libevdev-devel libxkbcommon-devel pixman-devel wayland-devel wlroots0.20-devel"
depends="$(vopt_if xwayland xorg-server-xwayland)"
short_desc="Dynamic tiling Wayland compositor with flexible runtime configuration"
maintainer="tranzystorekk <tranzystorek.io@protonmail.com>"
license="GPL-3.0-or-later"
homepage="https://codeberg.org/river/river-classic"
changelog="https://codeberg.org/river/river-classic/releases"
distfiles="https://codeberg.org/river/river-classic/releases/download/v${version}/river-classic-${version}.tar.gz"
checksum=ecd5e632a417b1d79e23180bf0073c8d8f849180ebb9138e5fa71ec8bfe15fdd
conflicts="river>=0"
nocross="translate-c complains about compiler_rt for wrong target"

build_options="xwayland"
build_options_default="xwayland"
desc_option_xwayland="Enable Xwayland support"

post_install() {
vinstall contrib/river.desktop 644 usr/share/wayland-sessions
vsconf example/init
}
11 changes: 11 additions & 0 deletions srcpkgs/river/INSTALL.msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
With the 0.4 release, river no longer provides a Wayland window manager.
Instead, you need to use a separate window manager that implements river's protocol.

A forked 0.3 package providing the legacy self-contained experience is also available: river-classic

You can find packaged window managers for river by running:

xbps-query -Rp provides -s river-wm

More info: https://isaacfreund.com/blog/river-window-management/
River WM list: https://codeberg.org/river/wiki/src/branch/main/pages/wm-list.md
12 changes: 6 additions & 6 deletions srcpkgs/river/template
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
# Template file for 'river'
pkgname=river
version=0.3.7
version=0.4.5
revision=1
archs="~i686* ~armv6l* ~armv7l*"
build_style=zig-build
configure_args="$(vopt_if xwayland -Dxwayland) -Dpie"
configure_args="-Dpie -Dllvm $(vopt_if xwayland -Dxwayland)"
hostmakedepends="pkg-config wayland-devel scdoc"
makedepends="wlroots0.18-devel libevdev-devel pixman-devel
makedepends="wlroots0.20-devel libevdev-devel pixman-devel
wayland-protocols libxkbcommon-devel wayland-devel"
depends="$(vopt_if xwayland xorg-server-xwayland)"
short_desc="Dynamic tiling Wayland compositor"
maintainer="Orphaned <orphan@voidlinux.org>"
license="GPL-3.0-only"
homepage="https://codeberg.org/river/river"
changelog="https://codeberg.org/river/river/releases"
distfiles="https://codeberg.org/river/river/releases/download/v${version}/river-${version}.tar.gz"
checksum=a6007ff0ad1cd46b2229661c28e4602aa6fe160872293f0749c17fa95b78a873
checksum=91d77f58bd20c7cfbd6656000474967635f9ddaa9779824c3684270e34f28147
nocross="translate-c complains about compiler_rt for wrong target"

build_options="xwayland"
build_options_default="xwayland"
desc_option_xwayland="Enable Xwayland support"

post_install() {
vinstall contrib/river.desktop 644 usr/share/wayland-sessions
vsconf example/init
}
54 changes: 54 additions & 0 deletions srcpkgs/waylock/patches/use-translate-c.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
diff --git a/build.zig b/build.zig
index cdbe456..d13ad6a 100644
--- a/build.zig
+++ b/build.zig
@@ -91,6 +91,12 @@ pub fn build(b: *Build) !void {
const wayland = b.createModule(.{ .root_source_file = scanner.result });
const xkbcommon = b.dependency("xkbcommon", .{}).module("xkbcommon");

+ const translate_c = b.addTranslateC(.{
+ .root_source_file = b.path("src/c.h"),
+ .target = target,
+ .optimize = optimize,
+ });
+
const waylock = b.addExecutable(.{
.name = "waylock",
.root_module = b.createModule(.{
@@ -99,6 +105,12 @@ pub fn build(b: *Build) !void {
.optimize = optimize,
.link_libc = true,
.strip = strip,
+ .imports = &.{
+ .{
+ .name = "c",
+ .module = translate_c.createModule(),
+ },
+ },
}),
.use_llvm = use_llvm,
.use_lld = use_llvm,
diff --git a/src/auth.zig b/src/auth.zig
index 83fa68f..1ad06fe 100644
--- a/src/auth.zig
+++ b/src/auth.zig
@@ -8,10 +8,7 @@ const process = std.process;
const fatal = process.fatal;
const system = std.posix.system;

-const c = @cImport({
- @cInclude("unistd.h"); // getuid()
- @cInclude("pwd.h"); // getpwuid()
-});
+const c = @import("c");

const pam = @import("pam.zig");

diff --git a/src/c.h b/src/c.h
new file mode 100644
index 0000000..5d84a42
--- /dev/null
+++ b/src/c.h
@@ -0,0 +1,2 @@
+#include <unistd.h>
+#include <pwd.h>
6 changes: 3 additions & 3 deletions srcpkgs/waylock/template
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
# Template file for 'waylock'
pkgname=waylock
version=1.3.0
version=1.6.0
revision=1
build_style=zig-build
configure_args="-Dpie"
configure_args="-Dpie -Dllvm"
hostmakedepends="pkg-config wayland-devel scdoc"
makedepends="libxkbcommon-devel pam-devel wayland-protocols wayland-devel"
short_desc="Simple screenlocker for wayland compositors"
maintainer="Orphaned <orphan@voidlinux.org>"
license="ISC"
homepage="https://codeberg.org/ifreund/waylock"
distfiles="https://codeberg.org/ifreund/waylock/releases/download/v${version}/waylock-${version}.tar.gz"
checksum=b7ec04c1dc0c6adb47045b4f604cb35988e9ca93bd4f3317fcc91bfac7bf075a
checksum=b27ba39bbdb8f9a99fbb9a454a13e456ecdc6a0e8cc3145eb08f4f623a191e94

post_install() {
vlicense LICENSE
Expand Down
14 changes: 6 additions & 8 deletions srcpkgs/zig/template
Original file line number Diff line number Diff line change
@@ -1,25 +1,23 @@
# Template file for 'zig'
pkgname=zig
version=0.13.0
version=0.16.0
revision=1
archs="x86_64* aarch64*"
build_style=cmake
configure_args="-DZIG_TARGET_MCPU=baseline"
make_cmd=make
configure_args="-DZIG_TARGET_MCPU=baseline -DZIG_PIE=ON"
_llvmver=21
# we add xml2, zstd, zlib and ncurses
# because our lld is static-only and requires those to work
makedepends="clang18-devel llvm18-devel lld18-devel libxml2-devel libzstd-devel ncurses-devel zlib-devel"
makedepends="clang${_llvmver}-devel llvm${_llvmver}-devel lld${_llvmver}-devel
libxml2-devel libzstd-devel ncurses-devel zlib-devel"
short_desc="Programming language designed for robustness, optimality, and clarity"
maintainer="Orphaned <orphan@voidlinux.org>"
license="MIT"
homepage="https://ziglang.org"
distfiles="https://ziglang.org/download/${version}/zig-${version}.tar.xz"
checksum=06c73596beeccb71cc073805bdb9c0e05764128f16478fa53bf17dfabc1d4318
nopie=yes
checksum=43186959edc87d5c7a1be7b7d2a25efffd22ce5807c7af99067f86f99641bfdf
nocross=yes

export CMAKE_GENERATOR="Unix Makefiles"

post_install() {
vlicense LICENSE
}
18 changes: 7 additions & 11 deletions srcpkgs/zls/template
Original file line number Diff line number Diff line change
@@ -1,23 +1,19 @@
# Template file for 'zls'
pkgname=zls
version=0.13.0
version=0.16.0
revision=1
build_style=zig-build
configure_args="-Dpie"
short_desc="Zig language server"
maintainer="Orphaned <orphan@voidlinux.org>"
license="MIT"
homepage="https://github.com/zigtools/zls"
_tracy_gitrev="37aff70dfa50cf6307b3fee6074d627dc2929143"
distfiles="https://github.com/zigtools/zls/archive/refs/tags/${version}.tar.gz
https://github.com/wolfpld/tracy/archive/${_tracy_gitrev}.tar.gz"
checksum="2e8046b6b0de765a4bf4bb828345e2badc8b828bc257dc931d0f56b147684d9f
c24ce6179df7efb8a114fe409d197e26e4b937c6fc1258bea15840b15b1f79ff"
skip_extraction="${_tracy_gitrev}.tar.gz"
distfiles="https://github.com/zigtools/zls/archive/refs/tags/${version}.tar.gz"
checksum=e7c5936f5b3a057ce851be0876e4e259b5c4d02f9aae038cd24a5d6b586b029f

post_extract() {
vsrcextract -C src/tracy ${_tracy_gitrev}.tar.gz
}
case "${XBPS_TARGET_MACHINE}" in
armv[67]*) nopie=yes ;;
*) configure_args+=" -Dpie" ;;
esac

post_install() {
vlicense LICENSE
Expand Down
Loading