• [gentoo-dev] [PATCH 0/4] Zig eclasses: small fixes

    From Eric Joldasov@21:1/5 to All on Sun Feb 16 13:10:02 2025
    Eric Joldasov (3):
    zig-utils.eclass: add function to get the rightmost flag from CFLAGS
    zig-utils.eclass: fix translating `-march=unset` and `-march=native`
    on ARM
    zig.eclass: allow unset `my_zbs_args`

    sin-ack (1):
    zig.eclass: always use absolute path for `--prefix` argument

    dev-lang/zig/zig-0.13.0-r2.ebuild | 13 ++++---
    dev-lang/zig/zig-9999.ebuild | 13 ++++---
    eclass/tests/zig-utils.sh | 8 +++-
    eclass/zig-utils.eclass | 61 +++++++++++++++++++++++++++----
    eclass/zig.eclass | 32 +++++++++++-----
    5 files changed, 97 insertions(+), 30 deletions(-)

    --
    2.48.1

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Eric Joldasov@21:1/5 to All on Sun Feb 16 13:10:01 2025
    From: sin-ack <sin-ack@protonmail.com>

    Needed for correctness when `build.zig` uses them to manipulate default
    pathes in compiled artifact. Without `DESTDIR` it would try to install
    to root directly, so to fix this we set `DESTDIR` where appliable.

    Co-authored-by: Eric Joldasov <bratishkaerik@landless-city.net>
    Signed-off-by: Eric Joldasov <bratishkaerik@landless-city.net>
    ---
    dev-lang/zig/zig-0.13.0-r2.ebuild | 13 +++++++------
    dev-lang/zig/zig-9999.ebuild | 13 +++++++------
    eclass/zig.eclass | 27 +++++++++++++++++++++------
    3 files changed, 35 insertions(+), 18 deletions(-)

    diff --git a/dev-lang/zig/zig-0.13.0-r2.ebuild b/dev-lang/zig/zig-0.13.0-r2.ebuild
    index b970092ce4e4..b03ee38a13ef 100644
    --- a/dev-lang/zig/zig-0.13.0-r2.ebuild
    +++ b/dev-lang/zig/zig-0.13.0-r2.ebuild
    @@ -1,248 +1,249 @@
    # Copyright 2019-2024 Gentoo Authors
    # Distributed under the terms of the GNU General Public License v2

    EAPI=8

    LLVM_COMPAT=( 18 )
    LLVM_OPTIONAL=1

    ZIG_SLOT="$(ver_cut 1-2)"
    ZIG_OPTIONAL=1

    inherit check-reqs cmake flag-o-matic edo llvm-r1 toolchain-funcs zig

    DESCRIPTION="A robust, optimal, and maintainable programming language"
    HOMEPAGE="https://ziglang.org/ https://github.com/ziglang/zig/"
    if [[ ${PV} == 9999 ]]; then
    EGIT_REPO_URI="https://github.com/ziglang/zig.git"
    inherit git-r3
    else
    VERIFY_SIG_METHOD=minis
  • From Eric Joldasov@21:1/5 to All on Sun Feb 16 13:10:02 2025
    Previously it was defined as empty string when not setting this variable,
    which caused error during building because Zig treat it as a name of non-existant step "".

    Also fix DEFAULT_UNSET comment on `BUILD_DIR` and `my_zbs_args`.

    Closes: https://bugs.gentoo.org/948168
    Signed-off-by: Eric Joldasov <bratishkaerik@landless-city.net>
    ---
    eclass/zig.eclass | 5 ++---
    1 file changed, 2 insertions(+), 3 deletions(-)

    diff --git a/eclass/zig.eclass b/eclass/zig.eclass
    index 2a0178e66d71..26b55bf05d7f 100644
    --- a/eclass/zig.eclass
    +++ b/eclass/zig.eclass
    @@ -1,559 +1,558 @@
    -# Copyright 2024 Gentoo Authors
    +# Copyright 2024-2025 Gentoo Authors
    # Distributed under the terms of the GNU General Public License v2

    # @ECLASS: zig.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-utils
    # @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.
    #
    # Note that zig.eclass is mostly tailored for projects that:
    # 1) Install something in build.zig steps: "artif
  • From Eric Joldasov@21:1/5 to All on Sun Feb 16 13:10:02 2025
    Similar to `get-flag` from toolchain.eclass, but searches from the end,
    uses only CFLAGS, and returns value only.

    Signed-off-by: Eric Joldasov <bratishkaerik@landless-city.net>
    ---
    eclass/zig-utils.eclass | 43 ++++++++++++++++++++++++++++++++++-------
    1 file changed, 36 insertions(+), 7 deletions(-)

    diff --git a/eclass/zig-utils.eclass b/eclass/zig-utils.eclass
    index 5502d997935e..d92fd0724b17 100644
    --- a/eclass/zig-utils.eclass
    +++ b/eclass/zig-utils.eclass
    @@ -1,559 +1,588 @@
    # Copyright 2024-2025 Gentoo Authors
    # Distributed under the terms of the GNU General Public License v2

    # @ECLASS: zig-utils.eclass
    # @MAINTAINER:
    # Eric Joldasov <bratishkaerik@landless-city.net>
    # @AUTHOR:
    # Eric Joldasov <bratishkaerik@landless-city.net>
    # @SUPPORTED_EAPIS: 8
    # @BLURB: Prepare Zig toolchain and set global variables
    # @DESCRIPTION:
    # Prepare Zig toolchain and set global variables.
    # Supports Zig 0.13+.
    # Does not set any default function, ebuilds must call them manually.
    # Generally, only "zig-utils_setup" is needed.
    #
    # Intended to be used by ebuilds that call "zig build-exe/lib/obj"
    # or "zig test" directly and by "dev-lang/zig".
    # For ebu
  • From Eric Joldasov@21:1/5 to All on Sun Feb 16 13:10:01 2025
    Reported on IRC.

    Reported-by: sin-ack <sin-ack@protonmail.com>
    Signed-off-by: Eric Joldasov <bratishkaerik@landless-city.net>
    ---
    eclass/tests/zig-utils.sh | 8 +++++++-
    eclass/zig-utils.eclass | 18 +++++++++++++++++-
    2 files changed, 24 insertions(+), 2 deletions(-)

    diff --git a/eclass/tests/zig-utils.sh b/eclass/tests/zig-utils.sh
    index 14af1d2105e3..3c98134b9006 100755
    --- a/eclass/tests/zig-utils.sh
    +++ b/eclass/tests/zig-utils.sh
    @@ -1,320 +1,326 @@
    #!/bin/bash
    -# Copyright 2024 Gentoo Authors
    +# Copyright 2024-2025 Gentoo Authors
    # Distributed under the terms of the GNU General Public License v2

    EAPI=8
    source tests-common.sh || exit

    inherit zig-utils

    # Set ZIG_TEST_COMPILATION env-var to "1" if you want to test binary
    # compilation and running under QEMU. Assumes "zig" is present in PATH
    # and qemu binfmt is enabled.
    #
    # If CPU is marked with ":no-run", it means program compiled for it
    # successfully but crashed when running under QEMU.
    if [[ "${ZIG_TEST_COMPILATION:-0}" -eq 1 ]]; then
    MY_WORKDIR="$(mktemp -d)"
    my_cleanup() {
    popd > /dev/null
    rm -rf "${MY_WORKDIR}"