Skip to content

Commit

Permalink
x11-misc/ly: patch 1.0.2 to work with Zig 0.13
Browse files Browse the repository at this point in the history
Signed-off-by: Eric Joldasov <[email protected]>
  • Loading branch information
BratishkaErik committed Aug 23, 2024
1 parent 5f8a4e0 commit 82e087c
Show file tree
Hide file tree
Showing 2 changed files with 133 additions and 7 deletions.
122 changes: 122 additions & 0 deletions x11-misc/ly/files/ly-1.0.2-update-to-zig-0.13.0.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
From: Eric Joldasov <[email protected]>

Update ly source code and dependencies to Zig 0.13.0.

diff --git a/build.zig b/build.zig
index 083bd2a..720a4a5 100644
--- a/build.zig
+++ b/build.zig
@@ -25,7 +25,7 @@ pub fn build(b: *std.Build) !void {

const exe = b.addExecutable(.{
.name = "ly",
- .root_source_file = .{ .path = "src/main.zig" },
+ .root_source_file = b.path("src/main.zig"),
.target = target,
.optimize = optimize,
});
@@ -38,14 +38,14 @@ pub fn build(b: *std.Build) !void {
const clap = b.dependency("clap", .{ .target = target, .optimize = optimize });
exe.root_module.addImport("clap", clap.module("clap"));

- exe.addIncludePath(.{ .path = "include" });
+ exe.addIncludePath(b.path("include"));
exe.linkSystemLibrary("pam");
exe.linkSystemLibrary("xcb");
exe.linkLibC();

// HACK: Only fails with ReleaseSafe, so we'll override it.
const translate_c = b.addTranslateC(.{
- .root_source_file = .{ .path = "include/termbox2.h" },
+ .root_source_file = b.path("include/termbox2.h"),
.target = target,
.optimize = if (optimize == .ReleaseSafe) .ReleaseFast else optimize,
});
@@ -94,7 +94,7 @@ pub fn build(b: *std.Build) !void {

pub fn ExeInstaller(install_conf: bool) type {
return struct {
- pub fn make(step: *std.Build.Step, progress: *std.Progress.Node) !void {
+ pub fn make(step: *std.Build.Step, progress: std.Progress.Node) !void {
_ = progress;
try install_ly(step.owner.allocator, install_conf);
}
@@ -108,7 +108,7 @@ const InitSystem = enum {
};
pub fn ServiceInstaller(comptime init_system: InitSystem) type {
return struct {
- pub fn make(step: *std.Build.Step, progress: *std.Progress.Node) !void {
+ pub fn make(step: *std.Build.Step, progress: std.Progress.Node) !void {
_ = progress;
const allocator = step.owner.allocator;
switch (init_system) {
@@ -220,7 +220,7 @@ fn install_ly(allocator: std.mem.Allocator, install_config: bool) !void {
}
}

-pub fn uninstallall(step: *std.Build.Step, progress: *std.Progress.Node) !void {
+pub fn uninstallall(step: *std.Build.Step, progress: std.Progress.Node) !void {
_ = progress;
try std.fs.cwd().deleteTree(data_directory);
const allocator = step.owner.allocator;
diff --git a/deps/p/122014e73fd712190e109950837b97f6143f02d7e2b6986e1db70b6f4aadb5ba6a0d/build.zig b/deps/p/122014e73fd712190e109950837b97f6143f02d7e2b6986e1db70b6f4aadb5ba6a0d/build.zig
index 53e5f90..0e35a04 100644
--- a/deps/p/122014e73fd712190e109950837b97f6143f02d7e2b6986e1db70b6f4aadb5ba6a0d/build.zig
+++ b/deps/p/122014e73fd712190e109950837b97f6143f02d7e2b6986e1db70b6f4aadb5ba6a0d/build.zig
@@ -1,14 +1,14 @@
const std = @import("std");

pub fn build(b: *std.Build) void {
- const clap_mod = b.addModule("clap", .{ .root_source_file = .{ .path = "clap.zig" } });
+ const clap_mod = b.addModule("clap", .{ .root_source_file = b.path("clap.zig") });

const optimize = b.standardOptimizeOption(.{});
const target = b.standardTargetOptions(.{});

const test_step = b.step("test", "Run all tests in all modes.");
const tests = b.addTest(.{
- .root_source_file = .{ .path = "clap.zig" },
+ .root_source_file = b.path("clap.zig"),
.target = target,
.optimize = optimize,
});
@@ -25,7 +25,7 @@ pub fn build(b: *std.Build) void {
}) |example_name| {
const example = b.addExecutable(.{
.name = example_name,
- .root_source_file = .{ .path = b.fmt("example/{s}.zig", .{example_name}) },
+ .root_source_file = b.path(b.fmt("example/{s}.zig", .{example_name})),
.target = target,
.optimize = optimize,
});
@@ -63,7 +63,7 @@ fn readMeStep(b: *std.Build) *std.Build.Step {
.name = "ReadMeStep",
.owner = b,
.makeFn = struct {
- fn make(step: *std.Build.Step, _: *std.Progress.Node) anyerror!void {
+ fn make(step: *std.Build.Step, _: std.Progress.Node) anyerror!void {
@setEvalBranchQuota(10000);
_ = step;
const file = try std.fs.cwd().createFile("README.md", .{});
diff --git a/src/main.zig b/src/main.zig
index ddee718..022ff54 100644
--- a/src/main.zig
+++ b/src/main.zig
@@ -512,7 +512,7 @@ pub fn main() !void {
run = false;
} else if (pressed_key == sleep_key) {
if (config.sleep_cmd) |sleep_cmd| {
- var sleep = std.ChildProcess.init(&[_][]const u8{ "/bin/sh", "-c", sleep_cmd }, allocator);
+ var sleep = std.process.Child.init(&[_][]const u8{ "/bin/sh", "-c", sleep_cmd }, allocator);
_ = sleep.spawnAndWait() catch .{};
}
}
@@ -617,7 +617,7 @@ pub fn main() !void {

update = true;

- var restore_cursor = std.ChildProcess.init(&[_][]const u8{ "/bin/sh", "-c", config.term_restore_cursor_cmd }, allocator);
+ var restore_cursor = std.process.Child.init(&[_][]const u8{ "/bin/sh", "-c", config.term_restore_cursor_cmd }, allocator);
_ = restore_cursor.spawnAndWait() catch .{};
},
else => {
18 changes: 11 additions & 7 deletions x11-misc/ly/ly-1.0.2.ebuild
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ LICENSE="WTFPL-2"
SLOT="0"
KEYWORDS="~amd64"

EZIG_MIN="0.12"
EZIG_MAX_EXCLUSIVE="0.13"
EZIG_MIN="0.13"
EZIG_MAX_EXCLUSIVE="0.14"

DEPEND="
|| ( dev-lang/zig-bin:${EZIG_MIN} dev-lang/zig:${EZIG_MIN} )
Expand All @@ -44,6 +44,10 @@ QA_FLAGS_IGNORED="usr/bin/ly"

RES="${S}/res"

PATCHES=(
"${FILESDIR}/ly-1.0.2-update-to-zig-0.13.0.patch"
)

# copied from sys-fs/ncdu::gentoo
# Many thanks to Florian Schmaus (Flowdalic)!
# Adapted from https://github.com/gentoo/gentoo/pull/28986
Expand Down Expand Up @@ -111,10 +115,10 @@ ezig() {
src_unpack() {
default

mkdir "${WORKDIR}/deps" || die
ezig fetch --global-cache-dir "${WORKDIR}/deps" "${DISTDIR}/zig-clap-${CLAP}.tar.gz"
ezig fetch --global-cache-dir "${WORKDIR}/deps" "${DISTDIR}/zigini-${ZIGINI}.tar.gz"
ezig fetch --global-cache-dir "${WORKDIR}/deps" "${DISTDIR}/ziglibini-${ZIGLIBINI}.tar.gz"
mkdir "${S}/deps" || die
ezig fetch --global-cache-dir "${S}/deps" "${DISTDIR}/zig-clap-${CLAP}.tar.gz"
ezig fetch --global-cache-dir "${S}/deps" "${DISTDIR}/zigini-${ZIGINI}.tar.gz"
ezig fetch --global-cache-dir "${S}/deps" "${DISTDIR}/ziglibini-${ZIGLIBINI}.tar.gz"
}

src_prepare(){
Expand All @@ -125,7 +129,7 @@ src_prepare(){

src_compile() {
# Building ly & accomodate for prefixed environment
ezig build --system "${WORKDIR}/deps/p" -Doptimize=ReleaseSafe -Ddata_directory="${EPREFIX}/etc/ly"
ezig build --system "${S}/deps/p/" -Doptimize=ReleaseSafe -Ddata_directory="${EPREFIX}/etc/ly"
}

src_install() {
Expand Down

0 comments on commit 82e087c

Please sign in to comment.