diff options
| author | Liguros - Gitlab CI/CD [develop] <gitlab@liguros.net> | 2026-05-06 19:40:37 +0000 |
|---|---|---|
| committer | Liguros - Gitlab CI/CD [develop] <gitlab@liguros.net> | 2026-05-06 19:40:37 +0000 |
| commit | 6c2c44c149dc52d1f72e760c171f73fa33c4ee45 (patch) | |
| tree | 3773e2585fde44992b91653203cbd021b1d82e2e /eclass | |
| parent | 5a1e2f874db05baac26359a99597859d0f575014 (diff) | |
| download | baldeagleos-repo-6c2c44c149dc52d1f72e760c171f73fa33c4ee45.tar.gz baldeagleos-repo-6c2c44c149dc52d1f72e760c171f73fa33c4ee45.tar.xz baldeagleos-repo-6c2c44c149dc52d1f72e760c171f73fa33c4ee45.zip | |
Adding metadata
Diffstat (limited to 'eclass')
| -rw-r--r-- | eclass/go-module.eclass | 6 | ||||
| -rw-r--r-- | eclass/zig-utils.eclass | 3 | ||||
| -rw-r--r-- | eclass/zig.eclass | 112 |
3 files changed, 105 insertions, 16 deletions
diff --git a/eclass/go-module.eclass b/eclass/go-module.eclass index 1d7b6044d802..0dad51c11ef6 100644 --- a/eclass/go-module.eclass +++ b/eclass/go-module.eclass @@ -71,7 +71,7 @@ _GO_MODULE_ECLASS=1 inherit toolchain-funcs go-env if [[ ! ${GO_OPTIONAL} ]]; then - BDEPEND=">=dev-lang/go-1.20:=" + BDEPEND=">=dev-lang/go-1.24.11:=" # Workaround for pkgcheck false positive: https://github.com/pkgcore/pkgcheck/issues/214 # MissingUnpackerDep: version ...: missing BDEPEND="app-arch/unzip" @@ -108,13 +108,13 @@ QA_FLAGS_IGNORED='.*' # # You can use some combination of sed/awk/cut to extract the # contents of EGO_SUM or use the dev-go/get-ego-vendor tool. -# +# # One manual way to do this is the following: # # @CODE # # cat go.sum | cut -d" " -f1,2 | awk '{print "\t\"" $0 "\""}' -# +# # @CODE # # The format of go.sum is described upstream here: diff --git a/eclass/zig-utils.eclass b/eclass/zig-utils.eclass index 41d6fd2f3973..95f979b98c78 100644 --- a/eclass/zig-utils.eclass +++ b/eclass/zig-utils.eclass @@ -1,4 +1,4 @@ -# Copyright 2024-2025 Gentoo Authors +# Copyright 2024-2026 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 # @ECLASS: zig-utils.eclass @@ -494,6 +494,7 @@ zig-utils_find_installation() { # Upstream skipped releasing 0.15.0 local zig_supported_versions=( "9999" + "0.16.0" "0.15.2" "0.15.1" "0.14.1" diff --git a/eclass/zig.eclass b/eclass/zig.eclass index 06bbabc218a3..dec9f003b90b 100644 --- a/eclass/zig.eclass +++ b/eclass/zig.eclass @@ -339,25 +339,28 @@ zig_pkg_setup() { # Environment variables set by this eclass. # Used by Zig Build System to find `pkg-config`. - # UPSTREAM Used only by 9999 for now, should land in future - # 0.14 release. export PKG_CONFIG="${PKG_CONFIG:-"$(tc-getPKG_CONFIG)"}" # Used by whole Zig toolchain (most of the sub-commands) # to find local and global cache directories. export ZIG_LOCAL_CACHE_DIR="${T}/zig-cache/local/" export ZIG_GLOBAL_CACHE_DIR="${T}/zig-cache/global/" + + # Used by `zig fetch` and `zig build` to save packages. + # Zig 0.17+: https://codeberg.org/ziglang/zig/pulls/31992 + if ver_test "${ZIG_SLOT}" -ge "0.17"; then + export ZIG_LOCAL_PKG_DIR="${T}/zig-cache/pkgs/" + fi } # @FUNCTION: zig_live_fetch # @USAGE: [<args>...] +# @DEPRECATED: zig_live_src_unpack # @DESCRIPTION: # Fetches packages, if they exist, to the "ZBS_ECLASS_DIR/p/". # Adds build file path to ZBS_BASE_ARGS. # If you have some lazy dependency which is not triggered in default # configuration, pass options like you would pass them for regular # "ezig build". Try to cover all of them before "src_configure". -# **Note**: this function will be deprecated once/if -# https://github.com/ziglang/zig/pull/19975 lands. # # Example: # @CODE @@ -375,6 +378,10 @@ zig_pkg_setup() { # } # @CODE zig_live_fetch() { + if ver_test "${ZIG_SLOT}" -ge "0.16"; then + die "${ECLASS}: zig_live_fetch is not supported for Zig 0.16+, use zig_live_src_unpack instead" + fi + # This function will likely be called in src_unpack, # before [zig_]src_prepare, so this directory might not # exist yet. @@ -430,15 +437,87 @@ zig_src_unpack() { # Now unpack all Zig dependencies, including those that are # now unpacked from tarball-tarball. + + # Starting from Zig 0.16, packages can now be stored in two forms: + # 1. Compressed (used for checks and caches) + # 2. Folder (used for compilation and system mode) local zig_dep - for zig_dep in "${zig_deps[@]}"; do - # Hide now-spammy hash from stdout - ezig fetch --global-cache-dir "${ZBS_ECLASS_DIR}/" \ - "${DISTDIR}/${zig_dep}" > /dev/null - done + if ver_test "${ZIG_SLOT}" -ge "0.16"; then + # Two version-specific notes for 0.16.0: + # 1. Saves to zig-pkg/ local folder (not configurable). + # 2. Regression: needs build.zig to operate. + + # Both of them are fixed for master and 0.17+. + # https://codeberg.org/ziglang/zig/pulls/31992 + + # `touch` necessary only for 0.16, but it won't hurt for 0.17+. + touch build.zig || die + for zig_dep in "${zig_deps[@]}"; do + # Hide now-spammy hash from stdout + ezig fetch "${DISTDIR}/${zig_dep}" > /dev/null + done + + # For 0.17 and later: + # Folder packages: saved into "${ZIG_LOCAL_PKG_DIR}" (because this env var is supported) + # Compacted packages: saved into "${ZIG_GLOBAL_CACHE_DIR}/p/" + + # For 0.16.0: + # Folder packages: saved into "${WORKDIR}/zig-pkg/" (because hardcoded to local zig-pkg) + # Compacted packages: saved into "${ZIG_GLOBAL_CACHE_DIR}/p/" + else + for zig_dep in "${zig_deps[@]}"; do + # Hide now-spammy hash from stdout + ezig fetch --global-cache-dir "${ZBS_ECLASS_DIR}/" \ + "${DISTDIR}/${zig_dep}" > /dev/null + done + + # For 0.15 and before: + # Folder packages: saved into "${ZBS_ECLASS_DIR}/p/" (because passed --global-cache-dir) + # Compacted packages: don't exist. + fi + einfo "ZBS: ${#zig_deps[@]} dependencies unpacked" } +# @FUNCTION: zig_live_src_unpack +# @DESCRIPTION: +# Fetches all dependencies with build runner eagerly. +# Supported for Zig 0.16+. +zig_live_src_unpack() { + if ver_test "${ZIG_SLOT}" -lt "0.16"; then + die "${ECLASS}: zig_live_src_unpack is supported only for Zig 0.16+" + fi + + if [[ "${EBUILD_PHASE}" != "unpack" ]]; then + die "${FUNCNAME}: not valid for ${EBUILD_PHASE}. Use src_unpack instead" + fi + + mkdir -p "${BUILD_DIR}" > /dev/null || die + pushd "${BUILD_DIR}" > /dev/null || die + + ZBS_ARGS_BASE+=( --build-file "${S}/build.zig" ) + + local args=( + "${ZBS_ARGS_BASE[@]}" + + --fetch=all + ) + + # See notes in zig_src_unpack + if ver_test "${ZIG_SLOT}" -eq "0.16"; then + # Redirect hardcoded cache subfolder to same one + # as src_unpack and src_prepare use. + mkdir -p "${WORKDIR}/zig-pkg/" || die + ln -s "${WORKDIR}/zig-pkg" "zig-pkg" || die + fi + + einfo "ZBS: live-fetching with:" + einfo "${args[@]}" + ezig build "${args[@]}" > /dev/null + + popd > /dev/null || die +} + # @FUNCTION: zig_src_prepare # @DESCRIPTION: # Calls default "src_prepare" function, creates BUILD_DIR directory @@ -452,11 +531,20 @@ zig_src_prepare() { mkdir -p "${BUILD_DIR}" || die einfo "BUILD_DIR: \"${BUILD_DIR}\"" - local system_dir="${ZBS_ECLASS_DIR}/p/" + # See notes in zig_src_unpack + local system_dir + if ver_test "${ZIG_SLOT}" -ge "0.17"; then + system_dir="${ZIG_LOCAL_PKG_DIR}" + elif ver_test "${ZIG_SLOT}" -eq "0.16"; then + system_dir="${WORKDIR}/zig-pkg/" + else + system_dir="${ZBS_ECLASS_DIR}/p/" + fi + mkdir -p "${system_dir}" || die ZBS_ARGS_BASE+=( - # Disable network access after ensuring all dependencies - # are unpacked (by "src_unpack" or "live_fetch") + # Disable network access after ensuring + # all dependencies are unpacked into folder form --system "${system_dir}" ) } |
