• [gentoo-dev] [PATCH] zig.eclass: new eclass

    From Violet Purcell@21:1/5 to All on Thu Oct 5 00:00:01 2023
    This is an eclass to help with building programs that use Zig's "build
    system." It includes things such as PIE support and the ability to set
    min/max for Zig versions.

    Signed-off-by: Violet Purcell <vimproved@inventati.org>
    ---
    eclass/zig.eclass | 168 ++++++++++++++++++++++++++++++++++++++++++++++
    1 file changed, 168 insertions(+)
    create mode 100644 eclass/zig.eclass

    diff --git a/eclass/zig.eclass b/eclass/zig.eclass
    new file mode 100644
    index 000000000000..f901f2ca49e4
    --- /dev/null
    +++ b/eclass/zig.eclass
    @@ -0,0 +1,168 @@
    +# Copyright 2023 Gentoo Authors
    +# Distributed under the terms of the GNU General Public License v2
    +
    +# @ECLASS: zig.eclass
    +# @MAINTAINER:
    +# Violet Purcell <vimproved@inventati.org>
    +# @AUTHOR:
    +# Violet Purcell <vimproved@inventati.org>
    +# @SUPPORTED_EAPIS: 8
    +# @BLURB: Utility functions for packages using Zig's build system.
    +# @DESCRIPTION:
    +# Utility eclass for packages that use Zig's build system (eg. with build.zig).
    +
    +case ${EAPI} in
    + 8) ;;
    + *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
    +esac
    +
    +if [[ ! ${_ZIG_ECLASS} ]]; then
    +_ZIG_ECLASS=1
    +
    +inherit edo
    +
    +# @ECLASS_VARIABLE: ZIG_USE_PIE
    +# @PRE_INHERIT
    +# @DESCRIPTION:
    +# If true, add the pie