Hello everyone,
This patch series adds new eclasses for packages that use Zig
toolchain with varying level of integration. Since some projects
or ebuilds use only Zig compiler directly, without touching Zig Build
System, I have decided to split eclasses into 2:
* zig-toolchain.eclass: handles dependency on Zig toolchain and
finds appropriate versions/slots, converts C-style target tuples/triples
to Zig format and sets environment variables to be used in other
eclasses and ebuilds. This eclass is more low-level and intended
to be used by programs and libraries that call "zig" commands directly,
without having build.zig file and using "zig build" command. For example,
authors could use "zig build-exe" and "zig test" directly in Makefile,
or add "zig cc" and compile both C and Zig version of library etc.
In this patchset it is also used by dev-lang/zig to convert targets
during bootstrapping, and other logic is suppressed.
* zig-build.eclass: handles working with "zig build" sub-command and build.zig files.
This eclass is more high-level and for most ebuilds it's the only
one which needs to be inherited. It sets default functions for
ebuild phases, deals with dependencies in package manager, allows
ebuilds and end users to configure used flags, respects multi-threading
and verboseness preferences, has some small support for cross-compilation
and so on.
Github PR and discussion here:
https://github.com/gentoo/gentoo/pull/37283 .
I have also wrote small generator for Zig ebuild skeletons here:
https://github.com/BratishkaErik/zig-ebuild . Example output in that PR.
It requires dev-lang/zig:9999 to compile, but at runtime it works
with any version supported by eclass (currently 0.13 and 9999).
In "v2" revision, including suggestions on mailing list:
* Move EAPI check after inherit guard
* Change BDEPEND from "+=" to "=" and remove initial space here,
* Keep length below 80 characters, and add 2 spaces after full stop,
* Align lines in switch cases (according to Neovim, on nano I had
not noticed it before),
* Add "die -n" to ezig(),
* Move and rewrite TODO comments in zig-build_start_base_args to be
shorter and move less relevant information to patch itself.
...and GitHub. Also remove old leftovers of Zig 0.12 compatibility.
Eric Joldasov (5):
zig-toolchain.eclass: new eclass
zig-build.eclass: new eclass
dev-lang/zig: add 0.13.0-r1
dev-lang/zig: sync 9999 with 0.13.0-r1
sys-fs/ncdu: add 2.6-r1
.../zig-0.13.0-skip-test-stack_iterator.patch | 32 +
dev-lang/zig/zig-0.13.0-r1.ebuild | 245 ++++++++
dev-lang/zig/zig-9999.ebuild | 244 ++++----
eclass/zig-build.eclass | 580 ++++++++++++++++++
eclass/zig-toolchain.eclass | 375 +++++++++++
sys-fs/ncdu/ncdu-2.6-r1.ebuild | 50 ++
6 files changed, 1407 insertions(+), 119 deletions(-)
create mode 100644 dev-lang/zig/files/zig-0.13.0-skip-test-stack_iterator.patch
create mode 100644 dev-lang/zig/zig-0.13.0-r1.ebuild
create mode 100644 eclass/zig-build.eclass
create mode 100644 eclass/zig-toolchain.eclass
create mode 100644 sys-fs/ncdu/ncdu-2.6-r1.ebuild
Interdiff against v1:
diff --git a/eclass/zig-build.eclass b/eclass/zig-build.eclass
index b1fc89e38d9d..ffa075043cde 100644
--- a/eclass/zig-build.eclass
+++ b/eclass/zig-build.eclass
@@ -1,572 +1,580 @@
# Copyright 2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: zig-build.eclass
# @MAINTAINER:
# Eric Joldasov <
bratishkaerik@landless-city.net>
# @AUTHOR:
# Alfred Wingate <
parona@protonmail.com>
# Violet Purcell <
vimproved@inventati.org>
# Eric Joldasov <
bratishkaerik@landless-city.net>
# @SUPPORTED_EAPIS: 8
# @PROVIDES: zig-toolchain
-# @BLURB: Functions for working with ZBS (Zig Build System).
+# @BLURB: Functions for working with ZBS (Zig Build System)
# @DESCRIPTION:
-# Functions for working with Zig build system and package manager.
-# Supports Zig 0.13+. Exports default functions for convenience.
+# Functions for working with Zig build system and package manager.
+# Supports Zig 0.13+. Exports default functions for convenience.
#
# Note that zig-build.eclass is mostly tailored for projects that:
# 1) Install something in build.zig steps