summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
Diffstat (limited to 'eclass')
-rw-r--r--eclass/Manifest.gzbin39215 -> 39224 bytes
-rw-r--r--eclass/autotools.eclass2
-rw-r--r--eclass/bzr.eclass257
-rw-r--r--eclass/cargo.eclass116
-rw-r--r--eclass/cmake.eclass10
-rw-r--r--eclass/dist-kernel-utils.eclass71
-rw-r--r--eclass/distutils-r1.eclass38
-rw-r--r--eclass/ecm.eclass30
-rw-r--r--eclass/flag-o-matic.eclass4
-rw-r--r--eclass/gear.kde.org.eclass26
-rw-r--r--eclass/git-r3.eclass13
-rw-r--r--eclass/gnome.org.eclass19
-rw-r--r--eclass/gnome2-utils.eclass97
-rw-r--r--eclass/gnome2.eclass38
-rw-r--r--eclass/go-env.eclass75
-rw-r--r--eclass/golang-base.eclass13
-rw-r--r--eclass/golang-build.eclass6
-rw-r--r--eclass/golang-vcs-snapshot.eclass6
-rw-r--r--eclass/golang-vcs.eclass6
-rw-r--r--eclass/greadme.eclass251
-rw-r--r--eclass/java-pkg-simple.eclass18
-rw-r--r--eclass/java-utils-2.eclass12
-rw-r--r--eclass/java-vm-2.eclass52
-rw-r--r--eclass/kernel-2.eclass2
-rw-r--r--eclass/kernel-build.eclass113
-rw-r--r--eclass/kernel-install.eclass144
-rw-r--r--eclass/linux-info.eclass29
-rw-r--r--eclass/llvm-r1.eclass11
-rw-r--r--eclass/llvm.eclass1
-rw-r--r--eclass/llvm.org.eclass40
-rw-r--r--eclass/ltprune.eclass177
-rw-r--r--eclass/mount-boot-utils.eclass2
-rw-r--r--eclass/mount-boot.eclass2
-rw-r--r--eclass/python-any-r1.eclass3
-rw-r--r--eclass/python-r1.eclass2
-rw-r--r--eclass/python-single-r1.eclass3
-rw-r--r--eclass/python-utils-r1.eclass57
-rw-r--r--eclass/rebar-utils.eclass160
-rw-r--r--eclass/rebar.eclass112
-rw-r--r--eclass/rebar3.eclass194
-rw-r--r--eclass/rust-toolchain.eclass64
-rw-r--r--eclass/savedconfig.eclass12
-rw-r--r--eclass/secureboot.eclass26
-rw-r--r--eclass/tests/Makefile2
-rwxr-xr-xeclass/tests/dist-kernel-utils.sh59
-rwxr-xr-xeclass/tests/eapi7-ver.sh174
-rwxr-xr-xeclass/tests/llvm-r1.sh26
-rw-r--r--eclass/tests/tests-common.sh2
-rwxr-xr-xeclass/tests/toolchain-funcs.sh40
-rwxr-xr-x[-rw-r--r--]eclass/tests/version-funcs.sh174
-rw-r--r--eclass/texlive-common.eclass20
-rw-r--r--eclass/toolchain-funcs.eclass35
-rw-r--r--eclass/toolchain.eclass89
-rw-r--r--eclass/tree-sitter-grammar.eclass4
-rw-r--r--eclass/unpacker.eclass11
-rw-r--r--eclass/vcs-snapshot.eclass16
56 files changed, 1772 insertions, 1194 deletions
diff --git a/eclass/Manifest.gz b/eclass/Manifest.gz
index 641abbe27db0..e53729fa9aca 100644
--- a/eclass/Manifest.gz
+++ b/eclass/Manifest.gz
Binary files differ
diff --git a/eclass/autotools.eclass b/eclass/autotools.eclass
index a456e9b9f589..3c9e89bda90e 100644
--- a/eclass/autotools.eclass
+++ b/eclass/autotools.eclass
@@ -94,7 +94,7 @@ _LATEST_AUTOCONF=( 2.72-r1:2.72 2.71-r6:2.71 )
# Do NOT change this variable in your ebuilds!
# If you want to force a newer minor version, you can specify the correct
# WANT value by using a colon: <PV>:<WANT_AUTOMAKE>
-_LATEST_AUTOMAKE=( 1.16.5:1.16 )
+_LATEST_AUTOMAKE=( 1.17-r1:1.17 1.16.5:1.16 )
_automake_atom="dev-build/automake"
_autoconf_atom="dev-build/autoconf"
diff --git a/eclass/bzr.eclass b/eclass/bzr.eclass
deleted file mode 100644
index d522326773e1..000000000000
--- a/eclass/bzr.eclass
+++ /dev/null
@@ -1,257 +0,0 @@
-# Copyright 1999-2023 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-# @ECLASS: bzr.eclass
-# @MAINTAINER:
-# Ulrich Müller <ulm@gentoo.org>
-# @AUTHOR:
-# Jorge Manuel B. S. Vicetto <jmbsvicetto@gentoo.org>
-# Mark Lee <bzr-gentoo-overlay@lazymalevolence.com>
-# Ulrich Müller <ulm@gentoo.org>
-# Christian Faulhammer <fauli@gentoo.org>
-# @SUPPORTED_EAPIS: 7 8
-# @BLURB: generic fetching functions for the Bazaar VCS
-# @DESCRIPTION:
-# The bzr.eclass provides functions to fetch and unpack sources from
-# repositories of the Bazaar distributed version control system.
-# The eclass was originally derived from git.eclass.
-#
-# Note: Just set EBZR_REPO_URI to the URI of the branch and src_unpack()
-# of this eclass will export the branch to ${WORKDIR}/${P}.
-
-case ${EAPI} in
- 7|8) ;;
- *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
-esac
-
-PROPERTIES+=" live"
-
-BDEPEND="dev-vcs/breezy"
-
-# @ECLASS_VARIABLE: EBZR_STORE_DIR
-# @USER_VARIABLE
-# @DESCRIPTION:
-# The directory to store all fetched Bazaar live sources.
-: "${EBZR_STORE_DIR:=${PORTAGE_ACTUAL_DISTDIR:-${DISTDIR}}/bzr-src}"
-
-# @ECLASS_VARIABLE: EBZR_UNPACK_DIR
-# @DESCRIPTION:
-# The working directory where the sources are copied to.
-: "${EBZR_UNPACK_DIR:=${WORKDIR}/${P}}"
-
-# @ECLASS_VARIABLE: EBZR_INIT_REPO_CMD
-# @DESCRIPTION:
-# The Bazaar command to initialise a shared repository.
-: "${EBZR_INIT_REPO_CMD:="brz init-shared-repository --no-trees"}"
-
-# @ECLASS_VARIABLE: EBZR_FETCH_CMD
-# @DESCRIPTION:
-# The Bazaar command to fetch the sources.
-: "${EBZR_FETCH_CMD:="brz branch --no-tree"}"
-
-# @ECLASS_VARIABLE: EBZR_UPDATE_CMD
-# @DESCRIPTION:
-# The Bazaar command to update the sources.
-: "${EBZR_UPDATE_CMD:="brz pull --overwrite-tags"}"
-
-# @ECLASS_VARIABLE: EBZR_EXPORT_CMD
-# @DESCRIPTION:
-# The Bazaar command to export a branch.
-: "${EBZR_EXPORT_CMD:="brz export"}"
-
-# @ECLASS_VARIABLE: EBZR_CHECKOUT_CMD
-# @DESCRIPTION:
-# The Bazaar command to checkout a branch.
-: "${EBZR_CHECKOUT_CMD:="brz checkout --lightweight -q"}"
-
-# @ECLASS_VARIABLE: EBZR_REVNO_CMD
-# @DESCRIPTION:
-# The Bazaar command to list a revision number of the branch.
-: "${EBZR_REVNO_CMD:="brz revno"}"
-
-# @ECLASS_VARIABLE: EBZR_OPTIONS
-# @DEFAULT_UNSET
-# @DESCRIPTION:
-# The options passed to the fetch and update commands.
-
-# @ECLASS_VARIABLE: EBZR_REPO_URI
-# @DEFAULT_UNSET
-# @REQUIRED
-# @DESCRIPTION:
-# The repository URI for the source package.
-
-# @ECLASS_VARIABLE: EBZR_PROJECT
-# @DESCRIPTION:
-# The project name of your ebuild. Normally, the branch will be stored
-# in the ${EBZR_STORE_DIR}/${EBZR_PROJECT} directory.
-#
-# If EBZR_BRANCH is set (see below), then a shared repository will be
-# created in that directory, and the branch will be located in
-# ${EBZR_STORE_DIR}/${EBZR_PROJECT}/${EBZR_BRANCH}.
-: "${EBZR_PROJECT:=${PN}}"
-
-# @ECLASS_VARIABLE: EBZR_BRANCH
-# @DEFAULT_UNSET
-# @DESCRIPTION:
-# The directory where to store the branch within a shared repository,
-# relative to ${EBZR_STORE_DIR}/${EBZR_PROJECT}.
-#
-# This variable should be set if there are several live ebuilds for
-# different branches of the same upstream project. The branches can
-# then share the same repository in EBZR_PROJECT, which will save both
-# data traffic volume and disk space.
-#
-# If there is only a live ebuild for one single branch, EBZR_BRANCH
-# needs not be set. In this case, the branch will be stored in a
-# stand-alone repository directly in EBZR_PROJECT.
-
-# @ECLASS_VARIABLE: EBZR_REVISION
-# @DEFAULT_UNSET
-# @DESCRIPTION:
-# Revision to fetch, defaults to the latest (see brz help revisionspec).
-
-# @ECLASS_VARIABLE: EBZR_OFFLINE
-# @USER_VARIABLE
-# @DESCRIPTION:
-# Set this variable to a non-empty value to disable automatic updating
-# of a bzr source tree. This is intended to be set outside the ebuild
-# by users.
-: "${EBZR_OFFLINE=${EVCS_OFFLINE}}"
-
-# @ECLASS_VARIABLE: EVCS_UMASK
-# @USER_VARIABLE
-# @DEFAULT_UNSET
-# @DESCRIPTION:
-# Set this variable to a custom umask. This is intended to be set by
-# users. By setting this to something like 002, it can make life easier
-# for people who do development as non-root (but are in the portage
-# group), and then switch over to building with FEATURES=userpriv.
-# Or vice-versa. Shouldn't be a security issue here as anyone who has
-# portage group write access already can screw the system over in more
-# creative ways.
-
-# @ECLASS_VARIABLE: EBZR_WORKDIR_CHECKOUT
-# @DEFAULT_UNSET
-# @DESCRIPTION:
-# If this variable is set to a non-empty value, EBZR_CHECKOUT_CMD will
-# be used instead of EBZR_EXPORT_CMD to copy the sources to WORKDIR.
-
-# @FUNCTION: _bzr_initial_fetch
-# @USAGE: <repository URI> <branch directory>
-# @INTERNAL
-# @DESCRIPTION:
-# Internal function, retrieves the source code from a repository for the
-# first time, using ${EBZR_FETCH_CMD}.
-_bzr_initial_fetch() {
- local repo_uri=$1 branch_dir=$2
-
- if [[ -n ${EBZR_OFFLINE} ]]; then
- die "EBZR_OFFLINE cannot be used when there is no local branch yet."
- fi
-
- # fetch branch
- einfo "bzr branch start -->"
- einfo " repository: ${repo_uri} => ${branch_dir}"
-
- ${EBZR_FETCH_CMD} ${EBZR_OPTIONS} "${repo_uri}" "${branch_dir}" \
- || die "${ECLASS}: can't branch from ${repo_uri}"
-}
-
-# @FUNCTION: _bzr_update
-# @USAGE: <repository URI> <branch directory>
-# @INTERNAL
-# @DESCRIPTION:
-# Internal function, updates the source code from a repository, using
-# ${EBZR_UPDATE_CMD}.
-_bzr_update() {
- local repo_uri=$1 branch_dir=$2
-
- if [[ -n ${EBZR_OFFLINE} ]]; then
- einfo "skipping bzr pull -->"
- einfo " repository: ${repo_uri}"
- else
- # update branch
- einfo "bzr pull start -->"
- einfo " repository: ${repo_uri}"
-
- pushd "${branch_dir}" > /dev/null \
- || die "${ECLASS}: can't chdir to ${branch_dir}"
- ${EBZR_UPDATE_CMD} ${EBZR_OPTIONS} "${repo_uri}" \
- || die "${ECLASS}: can't pull from ${repo_uri}"
- popd > /dev/null || die "${ECLASS}: popd failed"
- fi
-}
-
-# @FUNCTION: bzr_fetch
-# @DESCRIPTION:
-# Wrapper function to fetch sources from a Bazaar repository with
-# bzr branch or bzr pull, depending on whether there is an existing
-# working copy.
-bzr_fetch() {
- local repo_dir branch_dir save_umask
-
- [[ -n ${EBZR_REPO_URI} ]] || die "${ECLASS}: EBZR_REPO_URI is empty"
-
- if [[ ! -d ${EBZR_STORE_DIR} ]]; then
- (
- addwrite /
- mkdir -p "${EBZR_STORE_DIR}" \
- || die "${ECLASS}: can't mkdir ${EBZR_STORE_DIR}"
- )
- fi
-
- pushd "${EBZR_STORE_DIR}" > /dev/null \
- || die "${ECLASS}: can't chdir to ${EBZR_STORE_DIR}"
-
- repo_dir=${EBZR_STORE_DIR}/${EBZR_PROJECT}
- branch_dir=${repo_dir}${EBZR_BRANCH:+/${EBZR_BRANCH}}
-
- if [[ -n ${EVCS_UMASK} ]]; then
- save_umask=$(umask) || die
- umask "${EVCS_UMASK}" || die
- fi
- addwrite "${EBZR_STORE_DIR}"
-
- if [[ ! -d ${branch_dir}/.bzr ]]; then
- if [[ ${repo_dir} != "${branch_dir}" && ! -d ${repo_dir}/.bzr ]]; then
- einfo "creating shared bzr repository: ${repo_dir}"
- ${EBZR_INIT_REPO_CMD} "${repo_dir}" \
- || die "${ECLASS}: can't create shared repository"
- fi
- _bzr_initial_fetch "${EBZR_REPO_URI}" "${branch_dir}"
- else
- _bzr_update "${EBZR_REPO_URI}" "${branch_dir}"
- fi
-
- if [[ -n ${save_umask} ]]; then
- umask "${save_umask}" || die
- fi
-
- cd "${branch_dir}" || die "${ECLASS}: can't chdir to ${branch_dir}"
-
- # Save revision number in environment. #311101
- export EBZR_REVNO=$(${EBZR_REVNO_CMD})
-
- if [[ -n ${EBZR_WORKDIR_CHECKOUT} ]]; then
- einfo "checking out ..."
- ${EBZR_CHECKOUT_CMD} ${EBZR_REVISION:+-r ${EBZR_REVISION}} \
- . "${EBZR_UNPACK_DIR}" || die "${ECLASS}: checkout failed"
- else
- einfo "exporting ..."
- ${EBZR_EXPORT_CMD} ${EBZR_REVISION:+-r ${EBZR_REVISION}} \
- "${EBZR_UNPACK_DIR}" . || die "${ECLASS}: export failed"
- fi
- einfo \
- "revision ${EBZR_REVISION:-${EBZR_REVNO}} is now in ${EBZR_UNPACK_DIR}"
-
- popd > /dev/null || die "${ECLASS}: popd failed"
-}
-
-# @FUNCTION: bzr_src_unpack
-# @DESCRIPTION:
-# Default src_unpack(), calls bzr_fetch.
-bzr_src_unpack() {
- bzr_fetch
-}
-
-EXPORT_FUNCTIONS src_unpack
diff --git a/eclass/cargo.eclass b/eclass/cargo.eclass
index 7db34efb4e17..3a63e5027250 100644
--- a/eclass/cargo.eclass
+++ b/eclass/cargo.eclass
@@ -109,7 +109,7 @@ ECARGO_VENDOR="${ECARGO_HOME}/gentoo"
#
# If you enable CARGO_OPTIONAL, you have to set BDEPEND on virtual/rust
# for your package and call at least cargo_gen_config manually before using
-# other src_functions of this eclass.
+# other src_functions or cargo_env of this eclass.
# Note that cargo_gen_config is automatically called by cargo_src_unpack.
# @ECLASS_VARIABLE: myfeatures
@@ -248,7 +248,7 @@ cargo_crate_uris() {
# @FUNCTION: cargo_gen_config
# @DESCRIPTION:
-# Generate the $CARGO_HOME/config necessary to use our local registry and settings.
+# Generate the $CARGO_HOME/config.toml necessary to use our local registry and settings.
# Cargo can also be configured through environment variables in addition to the TOML syntax below.
# For each configuration key below of the form foo.bar the environment variable CARGO_FOO_BAR
# can also be used to define the value.
@@ -261,7 +261,7 @@ cargo_gen_config() {
mkdir -p "${ECARGO_HOME}" || die
- cat > "${ECARGO_HOME}/config" <<- _EOF_ || die "Failed to create cargo config"
+ cat > "${ECARGO_HOME}/config.toml" <<- _EOF_ || die "Failed to create cargo config"
[source.gentoo]
directory = "${ECARGO_VENDOR}"
@@ -324,9 +324,7 @@ _cargo_gen_git_config() {
# Return the directory within target that contains the build, e.g.
# target/aarch64-unknown-linux-gnu/release.
cargo_target_dir() {
- local abi
- tc-is-cross-compiler && abi=/$(rust_abi)
- echo "${CARGO_TARGET_DIR:-target}${abi}/$(usex debug debug release)"
+ echo "${CARGO_TARGET_DIR:-target}/$(rust_abi)/$(usex debug debug release)"
}
# @FUNCTION: cargo_src_unpack
@@ -523,36 +521,92 @@ cargo_src_configure() {
[[ ${ECARGO_ARGS[@]} ]] && einfo "Configured with: ${ECARGO_ARGS[@]}"
}
-# @FUNCTION: cargo_src_compile
+# @FUNCTION: cargo_env
+# @USAGE: Command with its arguments
# @DESCRIPTION:
-# Build the package using cargo build.
-cargo_src_compile() {
- debug-print-function ${FUNCNAME} "$@"
-
+# Run the given command under an environment needed for performing tasks with
+# Cargo such as building. RUSTFLAGS are appended to additional flags set here.
+# Ensure these are set consistently between Cargo invocations, otherwise
+# rebuilds will occur. Project-specific rustflags set against [build] will not
+# take affect due to Cargo limitations, so add these to your ebuild's RUSTFLAGS
+# if they seem important.
+cargo_env() {
[[ ${_CARGO_GEN_CONFIG_HAS_RUN} ]] || \
die "FATAL: please call cargo_gen_config before using ${FUNCNAME}"
+ # Shadow flag variables so that filtering below remains local.
+ local flag
+ for flag in $(all-flag-vars); do
+ local -x "${flag}=${!flag}"
+ done
+
+ # Rust extensions are incompatible with C/C++ LTO compiler see e.g.
+ # https://bugs.gentoo.org/910220
filter-lto
+
tc-export AR CC CXX PKG_CONFIG
- if tc-is-cross-compiler; then
- export CARGO_BUILD_TARGET=$(rust_abi)
- local TRIPLE=${CARGO_BUILD_TARGET//-/_}
- export CARGO_TARGET_"${TRIPLE^^}"_LINKER=$(tc-getCC)
-
- # Set vars for cc-rs crate.
- tc-export_build_env
- export \
- HOST_AR=$(tc-getBUILD_AR)
- HOST_CC=$(tc-getBUILD_CC)
- HOST_CXX=$(tc-getBUILD_CXX)
- HOST_CFLAGS=${BUILD_CFLAGS}
- HOST_CXXFLAGS=${BUILD_CXXFLAGS}
- fi
+ # Set vars for cc-rs crate.
+ local -x \
+ HOST_AR=$(tc-getBUILD_AR)
+ HOST_CC=$(tc-getBUILD_CC)
+ HOST_CXX=$(tc-getBUILD_CXX)
+ HOST_CFLAGS=${BUILD_CFLAGS}
+ HOST_CXXFLAGS=${BUILD_CXXFLAGS}
+
+ # Unfortunately, Cargo is *really* bad at handling flags. In short, it uses
+ # the first of the RUSTFLAGS env var, any target-specific config, and then
+ # any generic [build] config. It can merge within the latter two types from
+ # different sources, but it will not merge across these different types, so
+ # if a project sets flags under [target.'cfg(all())'], it will override any
+ # flags we set under [build] and vice-versa.
+ #
+ # It has been common for users and ebuilds to set RUSTFLAGS, which would
+ # have overridden whatever a project sets anyway, so the least-worst option
+ # is to include those RUSTFLAGS in target-specific config here, which will
+ # merge with any the project sets. Only flags in generic [build] config set
+ # by the project will be lost, and ebuilds will need to add those to
+ # RUSTFLAGS themselves if they are important.
+ #
+ # We could potentially inspect a project's generic [build] config and
+ # reapply those flags ourselves, but that would require a proper toml parser
+ # like tomlq, it might lead to confusion where projects also have
+ # target-specific config, and converting arrays to strings may not work
+ # well. Nightly features to inspect the config might help here in future.
+ #
+ # As of Rust 1.80, it is not possible to set separate flags for the build
+ # host and the target host when cross-compiling. The flags given are applied
+ # to the target host only with no flags being applied to the build host. The
+ # nightly host-config feature will improve this situation later.
+ #
+ # The default linker is "cc" so override by setting linker to CC in the
+ # RUSTFLAGS. The given linker cannot include any arguments, so split these
+ # into link-args along with LDFLAGS.
+ local -x CARGO_BUILD_TARGET=$(rust_abi)
+ local TRIPLE=${CARGO_BUILD_TARGET//-/_}
+ local TRIPLE=${TRIPLE^^} LD_A=( $(tc-getCC) ${LDFLAGS} )
+ local -x CARGO_TARGET_"${TRIPLE}"_RUSTFLAGS="-C strip=none -C linker=${LD_A[0]}"
+ [[ ${#LD_A[@]} -gt 1 ]] && local CARGO_TARGET_"${TRIPLE}"_RUSTFLAGS+="$(printf -- ' -C link-arg=%s' "${LD_A[@]:1}")"
+ local CARGO_TARGET_"${TRIPLE}"_RUSTFLAGS+=" ${RUSTFLAGS}"
+
+ (
+ # These variables will override the above, even if empty, so unset them
+ # locally. Do this in a subshell so that they remain set afterwards.
+ unset CARGO_BUILD_RUSTFLAGS CARGO_ENCODED_RUSTFLAGS RUSTFLAGS
+
+ "${@}"
+ )
+}
+
+# @FUNCTION: cargo_src_compile
+# @DESCRIPTION:
+# Build the package using cargo build.
+cargo_src_compile() {
+ debug-print-function ${FUNCNAME} "$@"
set -- cargo build $(usex debug "" --release) ${ECARGO_ARGS[@]} "$@"
einfo "${@}"
- "${@}" || die "cargo build failed"
+ cargo_env "${@}" || die "cargo build failed"
}
# @FUNCTION: cargo_src_install
@@ -564,16 +618,13 @@ cargo_src_compile() {
cargo_src_install() {
debug-print-function ${FUNCNAME} "$@"
- [[ ${_CARGO_GEN_CONFIG_HAS_RUN} ]] || \
- die "FATAL: please call cargo_gen_config before using ${FUNCNAME}"
-
set -- cargo install $(has --path ${@} || echo --path ./) \
--root "${ED}/usr" \
${GIT_CRATES[@]:+--frozen} \
$(usex debug --debug "") \
${ECARGO_ARGS[@]} "$@"
einfo "${@}"
- "${@}" || die "cargo install failed"
+ cargo_env "${@}" || die "cargo install failed"
rm -f "${ED}/usr/.crates.toml" || die
rm -f "${ED}/usr/.crates2.json" || die
@@ -585,12 +636,9 @@ cargo_src_install() {
cargo_src_test() {
debug-print-function ${FUNCNAME} "$@"
- [[ ${_CARGO_GEN_CONFIG_HAS_RUN} ]] || \
- die "FATAL: please call cargo_gen_config before using ${FUNCNAME}"
-
set -- cargo test $(usex debug "" --release) ${ECARGO_ARGS[@]} "$@"
einfo "${@}"
- "${@}" || die "cargo test failed"
+ cargo_env "${@}" || die "cargo test failed"
}
fi
diff --git a/eclass/cmake.eclass b/eclass/cmake.eclass
index de43bd017768..8079a5cb037b 100644
--- a/eclass/cmake.eclass
+++ b/eclass/cmake.eclass
@@ -388,7 +388,7 @@ cmake_src_prepare() {
local name
for name in "${modules_list[@]}" ; do
if [[ ${EAPI} == 7 ]]; then
- find "${S}" -name ${name}.cmake -exec rm -v {} + || die
+ find "${S}" -name "${name}.cmake" -exec rm -v {} + || die
else
find -name "${name}.cmake" -exec rm -v {} + || die
fi
@@ -542,10 +542,16 @@ cmake_src_configure() {
set(BUILD_SHARED_LIBS ON CACHE BOOL "")
set(Python3_FIND_UNVERSIONED_NAMES FIRST CACHE STRING "")
set(CMAKE_DISABLE_PRECOMPILE_HEADERS ON CACHE BOOL "")
+ set(CMAKE_TLS_VERIFY ON CACHE BOOL "")
+ set(CMAKE_COMPILE_WARNING_AS_ERROR OFF CACHE BOOL "")
_EOF_
if [[ -n ${_ECM_ECLASS} ]]; then
- echo 'set(ECM_DISABLE_QMLPLUGINDUMP ON CACHE BOOL "")' >> "${common_config}" || die
+ cat >> ${common_config} <<- _EOF_ || die
+ set(ECM_DISABLE_QMLPLUGINDUMP ON CACHE BOOL "")
+ set(ECM_DISABLE_APPSTREAMTEST ON CACHE BOOL "")
+ set(ECM_DISABLE_GIT ON CACHE BOOL "")
+ _EOF_
fi
# See bug 689410
diff --git a/eclass/dist-kernel-utils.eclass b/eclass/dist-kernel-utils.eclass
index 4bc3fab44aae..bb058d488a13 100644
--- a/eclass/dist-kernel-utils.eclass
+++ b/eclass/dist-kernel-utils.eclass
@@ -1,4 +1,4 @@
-# Copyright 2020-2023 Gentoo Authors
+# Copyright 2020-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: dist-kernel-utils.eclass
@@ -159,6 +159,35 @@ dist-kernel_PV_to_KV() {
echo "${kv}"
}
+# @FUNCTION: dist-kernel_get_module_suffix
+# @USAGE: <kernel_config>
+# @DESCRIPTION:
+# Returns the suffix for kernel modules based on the CONFIG_MODULES_COMPESS_*
+# setting in the kernel config and USE=modules-compress.
+dist-kernel_get_module_suffix() {
+ debug-print-function ${FUNCNAME} "${@}"
+
+ [[ ${#} -eq 1 ]] || die "${FUNCNAME}: invalid arguments"
+
+ local config=${1}
+
+ if ! in_iuse modules-compress || ! use modules-compress; then
+ echo .ko
+ elif [[ ! -r ${config} ]]; then
+ die "Cannot find kernel config ${config}"
+ elif grep -q "CONFIG_MODULE_COMPRESS_NONE=y" "${config}"; then
+ echo .ko
+ elif grep -q "CONFIG_MODULE_COMPRESS_GZIP=y" "${config}"; then
+ echo .ko.gz
+ elif grep -q "CONFIG_MODULE_COMPRESS_XZ=y" "${config}"; then
+ echo .ko.xz
+ elif grep -q "CONFIG_MODULE_COMPRESS_ZSTD=y" "${config}"; then
+ echo .ko.zst
+ else
+ die "Module compression is enabled, but compressor not known"
+ fi
+}
+
# @FUNCTION: dist-kernel_compressed_module_cleanup
# @USAGE: <path>
# @DESCRIPTION:
@@ -169,20 +198,41 @@ dist-kernel_compressed_module_cleanup() {
[[ ${#} -ne 1 ]] && die "${FUNCNAME}: invalid arguments"
local path=${1}
- local basename f
+ local config_path=/usr/src/linux-${KV_FULL}/.config
+
+ local option
+ for option in config source/.config build/.config; do
+ if [[ -f ${path}/${option} ]]; then
+ config_path=${path}/${option}
+ break
+ fi
+ done
+
+ local preferred=
+ [[ -f ${config_path} ]] && preferred=$(dist-kernel_get_module_suffix "${config_path}")
+
+ local basename suffix
while read -r basename; do
local prev=
- for f in "${path}/${basename}"{,.gz,.xz,.zst}; do
- if [[ ! -e ${f} ]]; then
- continue
+ for suffix in .ko .ko.gz .ko.xz .ko.zst; do
+ [[ ${suffix} == ${preferred} ]] && continue
+ local current=${path}/${basename}${suffix}
+ [[ -f ${current} ]] || continue
+
+ if [[ -f ${path}/${basename}${preferred} ]]; then
+ # If the module with the desired compression exists, remove
+ # all other variations.
+ rm -v "${current}" || die
elif [[ -z ${prev} ]]; then
- prev=${f}
- elif [[ ${f} -nt ${prev} ]]; then
+ # If not, then keep whichever of the duplicate modules is the
+ # newest. Normally you should not end up here.
+ prev=${current}
+ elif [[ ${current} -nt ${prev} ]]; then
rm -v "${prev}" || die
- prev=${f}
+ prev=${current}
else
- rm -v "${f}" || die
+ rm -v "${current}" || die
fi
done
done < <(
@@ -192,7 +242,8 @@ dist-kernel_compressed_module_cleanup() {
-o -name '*.ko.gz' \
-o -name '*.ko.xz' \
-o -name '*.ko.zst' \
- \) | sed -e 's:[.]\(gz\|xz\|zst\)$::' | sort | uniq -d || die
+ \) | sed -e 's:[.]ko\(\|[.]gz\|[.]xz\|[.]zst\)$::' |
+ sort | uniq -d || die
)
}
diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
index 61c0a80323ec..0f9dc8d14d5e 100644
--- a/eclass/distutils-r1.eclass
+++ b/eclass/distutils-r1.eclass
@@ -195,7 +195,6 @@ esac
# @CODE
# @ECLASS_VARIABLE: DISTUTILS_ALLOW_WHEEL_REUSE
-# @DEFAULT_UNSET
# @USER_VARIABLE
# @DESCRIPTION:
# If set to a non-empty value, the eclass is allowed to reuse a wheel
@@ -205,6 +204,7 @@ esac
# This is an optimization that can avoid the overhead of calling into
# the build system in pure Python packages and packages using the stable
# Python ABI.
+: ${DISTUTILS_ALLOW_WHEEL_REUSE=1}
# @ECLASS_VARIABLE: BUILD_DIR
# @OUTPUT_VARIABLE
@@ -572,6 +572,9 @@ distutils_enable_sphinx() {
# with the specified test runner. Also copies the current value
# of RDEPEND to test?-BDEPEND. The test-runner argument must be one of:
#
+# - import-check: `pytest --import-check` fallback (for use when there are
+# no tests to run)
+#
# - pytest: dev-python/pytest
#
# - setup.py: setup.py test (no deps included)
@@ -597,9 +600,13 @@ distutils_enable_tests() {
[[ ${#} -eq 1 ]] || die "${FUNCNAME} takes exactly one argument: test-runner"
local test_deps=${RDEPEND}
+ local test_pkgs=
case ${1} in
+ import-check)
+ test_pkgs+=' dev-python/pytest-import-check[${PYTHON_USEDEP}]'
+ ;&
pytest)
- local test_pkgs='>=dev-python/pytest-7.4.4[${PYTHON_USEDEP}]'
+ test_pkgs+=' >=dev-python/pytest-7.4.4[${PYTHON_USEDEP}]'
if [[ -n ${EPYTEST_TIMEOUT} ]]; then
test_pkgs+=' dev-python/pytest-timeout[${PYTHON_USEDEP}]'
fi
@@ -929,6 +936,7 @@ _distutils-r1_print_package_versions() {
# distutils patches and/or quirks.
distutils-r1_python_prepare_all() {
debug-print-function ${FUNCNAME} "${@}"
+ _python_sanity_checks
_distutils-r1_check_all_phase_mismatch
if [[ ! ${DISTUTILS_OPTIONAL} ]]; then
@@ -1244,7 +1252,9 @@ distutils_pep517_install() {
die "mydistutilsargs are banned in PEP517 mode (use DISTUTILS_ARGS)"
fi
- local config_settings=
+ local cmd=() config_settings=
+ has cargo ${INHERITED} && cmd+=( cargo_env )
+
case ${DISTUTILS_USE_PEP517} in
maturin)
# `maturin pep517 build-wheel --help` for options
@@ -1381,9 +1391,14 @@ distutils_pep517_install() {
;;
esac
+ # https://pyo3.rs/latest/building-and-distribution.html#cross-compiling
+ if tc-is-cross-compiler; then
+ local -x PYO3_CROSS_LIB_DIR=${SYSROOT}/$(python_get_stdlib)
+ fi
+
local build_backend=$(_distutils-r1_get_backend)
einfo " Building the wheel for ${PWD#${WORKDIR}/} via ${build_backend}"
- local cmd=(
+ cmd+=(
"${EPYTHON}" -m gpep517 build-wheel
--prefix="${EPREFIX}/usr"
--backend "${build_backend}"
@@ -1560,6 +1575,9 @@ distutils-r1_python_test() {
_python_check_EPYTHON
case ${_DISTUTILS_TEST_RUNNER} in
+ import-check)
+ epytest --import-check "${BUILD_DIR}/install$(python_get_sitedir)"
+ ;;
pytest)
epytest
;;
@@ -1782,16 +1800,6 @@ distutils-r1_run_phase() {
# bug fixes from Cython (this works only when setup.py is using
# cythonize() but it's better than nothing)
local -x CYTHON_FORCE_REGEN=1
-
- # Rust extensions are incompatible with C/C++ LTO compiler
- # see e.g. https://bugs.gentoo.org/910220
- if has cargo ${INHERITED}; then
- local x
- for x in $(all-flag-vars); do
- local -x "${x}=${!x}"
- done
- filter-lto
- fi
fi
# silence warnings when pydevd is loaded on Python 3.11+
@@ -1933,7 +1941,7 @@ _distutils-r1_compare_installed_files() {
# Perform the check only if at least one potentially reusable wheel
# has been produced. Nonpure packages (e.g. NumPy) may install
# interpreter configuration details into sitedir.
- if [[ ${!DISTUTILS_WHEELS[*]} != *-none-any.whl* &&
+ if [[ ${!DISTUTILS_WHEELS[*]} != *py3-none-any.whl* &&
${!DISTUTILS_WHEELS[*]} != *-abi3-*.whl ]]; then
return
fi
diff --git a/eclass/ecm.eclass b/eclass/ecm.eclass
index 3d3b9328269d..c8731b8c0cff 100644
--- a/eclass/ecm.eclass
+++ b/eclass/ecm.eclass
@@ -649,6 +649,9 @@ ecm_src_test() {
# Wrapper for cmake_src_install. Drops executable bit from .desktop files
# installed inside /usr/share/applications. This is set by cmake when install()
# is called in PROGRAM form, as seen in many kde.org projects.
+# In case kde.org.eclass is detected, in case KDE_ORG_NAME != PN, tries real
+# hard to detect, then rename, metainfo.xml appdata files to something unique
+# including SLOT if else than "0" (basically KDE_ORG_NAME -> PN+SLOT).
ecm_src_install() {
debug-print-function ${FUNCNAME} "$@"
@@ -664,6 +667,33 @@ ecm_src_install() {
fi
done
fi
+
+ mv_metainfo() {
+ if [[ -f ${1} ]]; then
+ mv -v ${1} ${1/${2}/${3}} || die
+ fi
+ }
+
+ if [[ -n ${_KDE_ORG_ECLASS} && -d "${ED}"/usr/share/metainfo/ ]]; then
+ if [[ ${KDE_ORG_NAME} != ${PN} ]]; then
+ local ecm_metainfo
+ pushd "${ED}"/usr/share/metainfo/ > /dev/null || die
+ for ecm_metainfo in find * -type f -iname "*metainfo.xml"; do
+ case ${ecm_metainfo} in
+ *${KDE_ORG_NAME}*)
+ mv_metainfo ${ecm_metainfo} ${KDE_ORG_NAME} ${PN}${SLOT/0*/}
+ ;;
+ *${KDE_ORG_NAME/-/_}*)
+ mv_metainfo ${ecm_metainfo} ${KDE_ORG_NAME/-/_} ${PN}${SLOT/0*/}
+ ;;
+ org.kde.*)
+ mv_metainfo ${ecm_metainfo} "org.kde." "org.kde.${PN}${SLOT/0*/}-"
+ ;;
+ esac
+ done
+ popd > /dev/null || die
+ fi
+ fi
}
# @FUNCTION: ecm_pkg_preinst
diff --git a/eclass/flag-o-matic.eclass b/eclass/flag-o-matic.eclass
index ecac452aa0ef..c6b1ad80e12e 100644
--- a/eclass/flag-o-matic.eclass
+++ b/eclass/flag-o-matic.eclass
@@ -129,6 +129,10 @@ _setup-allowed-flags() {
# needed for arm64 (and in particular SCS)
-ffixed-x18
+ # needed for riscv (to prevent unaligned vector access)
+ # See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115789
+ -mstrict-align -mvector-strict-align
+
# gcc 4.5
-mno-fma4 -mno-movbe -mno-xop -mno-lwp
# gcc 4.6
diff --git a/eclass/gear.kde.org.eclass b/eclass/gear.kde.org.eclass
index e0d0a8640b5b..3f8126dd1c01 100644
--- a/eclass/gear.kde.org.eclass
+++ b/eclass/gear.kde.org.eclass
@@ -132,7 +132,6 @@ if $(ver_test -gt 24.01.75); then
kde-dev-utils | \
kdebugsettings | \
kdeconnect | \
- kdegraphics-mobipocket | \
kdenetwork-filesharing | \
kdenlive | \
kdepim-addons | \
@@ -243,7 +242,6 @@ if $(ver_test -gt 24.01.75); then
spectacle | \
svgpart | \
sweeper | \
- thumbnailers | \
yakuake | \
zanshin)
RDEPEND+=" !${CATEGORY}/${PN}:5" ;;
@@ -264,4 +262,28 @@ if $(ver_test -gt 24.04.75); then
esac
fi
+# list of applications ported to KF6 post-24.05 in SLOT=6 having to block SLOT=5
+if $(ver_test -gt 24.07.75); then
+ case ${PN} in
+ k3b | \
+ kde-dev-scripts | \
+ kdesdk-thumbnailers | \
+ kdevelop | \
+ kdevelop-php | \
+ kdevelop-python | \
+ kgraphviewer | \
+ kimagemapeditor | \
+ kmplot | \
+ kompare | \
+ krdc | \
+ libkomparediff2 | \
+ lokalize | \
+ massif-visualizer | \
+ poxml | \
+ skanlite)
+ RDEPEND+=" !${CATEGORY}/${PN}:5" ;;
+ *) ;;
+ esac
+fi
+
fi
diff --git a/eclass/git-r3.eclass b/eclass/git-r3.eclass
index 565f6ada8382..35ad6afe8e88 100644
--- a/eclass/git-r3.eclass
+++ b/eclass/git-r3.eclass
@@ -4,7 +4,7 @@
# @ECLASS: git-r3.eclass
# @MAINTAINER:
# Michał Górny <mgorny@gentoo.org>
-# @SUPPORTED_EAPIS: 6 7 8
+# @SUPPORTED_EAPIS: 7 8
# @BLURB: Eclass for fetching and unpacking git repositories.
# @DESCRIPTION:
# Third generation eclass for easing maintenance of live ebuilds using
@@ -26,7 +26,7 @@
# If non-empty, then the repo likely needs EGIT_LFS to clone properly.
case ${EAPI} in
- 6|7|8) ;;
+ 7|8) ;;
*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
esac
@@ -35,13 +35,8 @@ _GIT_R3_ECLASS=1
PROPERTIES+=" live"
-if [[ ${EAPI} != 6 ]]; then
- BDEPEND=">=dev-vcs/git-1.8.2.1[curl]"
- [[ ${EGIT_LFS} ]] && BDEPEND+=" dev-vcs/git-lfs"
-else
- DEPEND=">=dev-vcs/git-1.8.2.1[curl]"
- [[ ${EGIT_LFS} ]] && DEPEND+=" dev-vcs/git-lfs"
-fi
+BDEPEND=">=dev-vcs/git-1.8.2.1[curl]"
+[[ ${EGIT_LFS} ]] && BDEPEND+=" dev-vcs/git-lfs"
# @ECLASS_VARIABLE: EGIT_CLONE_TYPE
# @USER_VARIABLE
diff --git a/eclass/gnome.org.eclass b/eclass/gnome.org.eclass
index 760dc2ba0b66..70884edefef7 100644
--- a/eclass/gnome.org.eclass
+++ b/eclass/gnome.org.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2023 Gentoo Authors
+# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: gnome.org.eclass
@@ -7,22 +7,19 @@
# @AUTHOR:
# Authors: Spidler <spidler@gentoo.org> with help of carparski.
# eclass variable additions and documentation: Gilles Dartiguelongue <eva@gentoo.org>
-# @SUPPORTED_EAPIS: 5 6 7 8
+# @SUPPORTED_EAPIS: 7 8
# @BLURB: Helper eclass for gnome.org hosted archives
# @DESCRIPTION:
# Provide a default SRC_URI for tarball hosted on gnome.org mirrors.
case ${EAPI} in
- 5|6|7|8) ;;
+ 7|8) ;;
*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
esac
if [[ -z ${_GNOME_ORG_ECLASS} ]] ; then
_GNOME_ORG_ECLASS=1
-# versionator inherit kept for older EAPIs due to ebuilds (potentially) relying on it
-[[ ${EAPI} == [56] ]] && inherit eapi7-ver versionator
-
# @ECLASS_VARIABLE: GNOME_TARBALL_SUFFIX
# @PRE_INHERIT
# @DESCRIPTION:
@@ -33,19 +30,13 @@ _GNOME_ORG_ECLASS=1
# Even though xz-utils are in @system, they must still be added to BDEPEND; see
# https://archives.gentoo.org/gentoo-dev/msg_a0d4833eb314d1be5d5802a3b710e0a4.xml
-if [[ ${GNOME_TARBALL_SUFFIX} == "xz" ]]; then
- if [[ ${EAPI} != [56] ]]; then
- BDEPEND="app-arch/xz-utils"
- else
- DEPEND="app-arch/xz-utils"
- fi
-fi
+[[ ${GNOME_TARBALL_SUFFIX} == "xz" ]] && BDEPEND="app-arch/xz-utils"
# @ECLASS_VARIABLE: GNOME_ORG_MODULE
# @DESCRIPTION:
# Name of the module as hosted on gnome.org mirrors.
# Leave unset if package name matches module name.
-: "${GNOME_ORG_MODULE:=$PN}"
+: "${GNOME_ORG_MODULE:=${PN}}"
# @ECLASS_VARIABLE: GNOME_ORG_RELEASE
# @INTERNAL
diff --git a/eclass/gnome2-utils.eclass b/eclass/gnome2-utils.eclass
index bbee2a419dfc..dd4014c09bf7 100644
--- a/eclass/gnome2-utils.eclass
+++ b/eclass/gnome2-utils.eclass
@@ -4,7 +4,7 @@
# @ECLASS: gnome2-utils.eclass
# @MAINTAINER:
# gnome@gentoo.org
-# @SUPPORTED_EAPIS: 5 6 7 8
+# @SUPPORTED_EAPIS: 7 8
# @PROVIDES: xdg-utils
# @BLURB: Auxiliary functions commonly used by Gnome packages.
# @DESCRIPTION:
@@ -15,13 +15,12 @@
# * GConf schemas management
# * scrollkeeper (old Gnome help system) management
-[[ ${EAPI} == 5 ]] && inherit multilib
# toolchain-funs.eclass: tc-is-cross-compiler
# xdg-utils.eclass: xdg_environment_reset, xdg_icon_cache_update
inherit toolchain-funcs xdg-utils
case ${EAPI} in
- 5|6|7|8) ;;
+ 7|8) ;;
*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
esac
@@ -100,7 +99,7 @@ gnome2_environment_reset() {
# Ensure we don't rely on dconf/gconf while building, bug #511946
export GSETTINGS_BACKEND="memory"
- if has ${EAPI} 6 7; then
+ if [[ ${EAPI} == 7 ]]; then
# Try to cover the packages honoring this variable, bug #508124
export GST_INSPECT="$(type -P true)"
@@ -126,7 +125,7 @@ gnome2_gconf_savelist() {
# using gconftool-2.
# This function should be called from pkg_postinst.
gnome2_gconf_install() {
- local updater="${EROOT%/}${GCONFTOOL_BIN}"
+ local updater="${EROOT}${GCONFTOOL_BIN}"
if [[ -z "${GNOME2_ECLASS_SCHEMAS}" ]]; then
debug-print "No GNOME 2 GConf schemas found"
@@ -148,15 +147,15 @@ gnome2_gconf_install() {
# We are ready to install the GCONF Scheme now
unset GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL
- export GCONF_CONFIG_SOURCE="$("${updater}" --get-default-source | sed "s;:/;:${ROOT%/}/;")"
+ export GCONF_CONFIG_SOURCE="$("${updater}" --get-default-source | sed "s;:/;:${ROOT}/;")"
einfo "Installing GNOME 2 GConf schemas"
local F
for F in ${GNOME2_ECLASS_SCHEMAS}; do
- if [[ -e "${EROOT%/}/${F}" ]]; then
+ if [[ -e "${EROOT}/${F}" ]]; then
debug-print "Installing schema: ${F}"
- "${updater}" --makefile-install-rule "${EROOT%/}/${F}" 1>/dev/null
+ "${updater}" --makefile-install-rule "${EROOT}/${F}" 1>/dev/null
fi
done
@@ -174,7 +173,7 @@ gnome2_gconf_install() {
# Removes schema files previously installed by the current ebuild from Gconf's
# database.
gnome2_gconf_uninstall() {
- local updater="${EROOT%/}${GCONFTOOL_BIN}"
+ local updater="${EROOT}${GCONFTOOL_BIN}"
if [[ -z "${GNOME2_ECLASS_SCHEMAS}" ]]; then
debug-print "No GNOME 2 GConf schemas found"
@@ -194,15 +193,15 @@ gnome2_gconf_uninstall() {
fi
unset GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL
- export GCONF_CONFIG_SOURCE="$("${updater}" --get-default-source | sed "s;:/;:${ROOT%/}/;")"
+ export GCONF_CONFIG_SOURCE="$("${updater}" --get-default-source | sed "s;:/;:${ROOT}/;")"
einfo "Uninstalling GNOME 2 GConf schemas"
local F
for F in ${GNOME2_ECLASS_SCHEMAS}; do
- if [[ -e "${EROOT%/}/${F}" ]]; then
+ if [[ -e "${EROOT}/${F}" ]]; then
debug-print "Uninstalling gconf schema: ${F}"
- "${updater}" --makefile-uninstall-rule "${EROOT%/}/${F}" 1>/dev/null
+ "${updater}" --makefile-uninstall-rule "${EROOT}/${F}" 1>/dev/null
fi
done
@@ -221,31 +220,29 @@ gnome2_gconf_uninstall() {
# calls to scrollkeeper-update and sandbox violations.
# This function should be called from src_prepare.
gnome2_omf_fix() {
- local omf_makefiles filename
-
- omf_makefiles="$@"
+ local omf_makefiles=( "$@" )
if [[ -f ${S}/omf.make ]] ; then
- omf_makefiles="${omf_makefiles} ${S}/omf.make"
+ omf_makefiles+=( "${S}"/omf.make )
fi
if [[ -f ${S}/gnome-doc-utils.make ]] ; then
- omf_makefiles="${omf_makefiles} ${S}/gnome-doc-utils.make"
+ omf_makefiles+=( "${S}"/gnome-doc-utils.make )
fi
# testing fixing of all makefiles found
# The sort is important to ensure .am is listed before the respective .in for
# maintainer mode regeneration not kicking in due to .am being newer than .in
- for filename in $(find "${S}" -name "Makefile.in" -o -name "Makefile.am" |sort) ; do
- omf_makefiles="${omf_makefiles} ${filename}"
- done
+ local filename
+ while IFS="" read -r filename ; do
+ omf_makefiles+=( "${filename}" )
+ done < <(find "${S}" -name "Makefile.in" -o -name "Makefile.am" | sort)
ebegin "Fixing OMF Makefiles"
- local retval=0
+ local omf retval=0
local fails=( )
-
- for omf in ${omf_makefiles} ; do
+ for omf in "${omf_makefiles[@]}" ; do
sed -i -e 's:scrollkeeper-update:true:' "${omf}"
retval=$?
@@ -253,7 +250,7 @@ gnome2_omf_fix() {
debug-print "updating of ${omf} failed"
# Add to the list of failures
- fails[$(( ${#fails[@]} + 1 ))]=$omf
+ fails+=( "${omf}" )
retval=2
fi
@@ -261,6 +258,7 @@ gnome2_omf_fix() {
eend $retval
+ local f
for f in "${fails[@]}" ; do
eerror "Failed to update OMF Makefile $f"
done
@@ -282,7 +280,7 @@ gnome2_scrollkeeper_savelist() {
# Updates the global scrollkeeper database.
# This function should be called from pkg_postinst and pkg_postrm.
gnome2_scrollkeeper_update() {
- local updater="${EROOT%/}${SCROLLKEEPER_UPDATE_BIN}"
+ local updater="${EROOT}${SCROLLKEEPER_UPDATE_BIN}"
if [[ -z "${GNOME2_ECLASS_SCROLLS}" ]]; then
debug-print "No scroll cache to update"
@@ -303,7 +301,7 @@ gnome2_scrollkeeper_update() {
fi
ebegin "Updating scrollkeeper database ..."
- "${updater}" -q -p "${EROOT%/}${SCROLLKEEPER_DIR}"
+ "${updater}" -q -p "${EROOT}${SCROLLKEEPER_DIR}"
eend $?
}
@@ -324,7 +322,7 @@ gnome2_schemas_savelist() {
# Updates GSettings schemas.
# This function should be called from pkg_postinst and pkg_postrm.
gnome2_schemas_update() {
- local updater="${EROOT%/}${GLIB_COMPILE_SCHEMAS}"
+ local updater="${EROOT}${GLIB_COMPILE_SCHEMAS}"
if tc-is-cross-compiler ; then
ewarn "Updating of GSettings schemas skipped due to cross-compilation."
@@ -340,7 +338,7 @@ gnome2_schemas_update() {
fi
ebegin "Updating GSettings schemas"
- ${updater} --allow-any-name "$@" "${EROOT%/}/usr/share/glib-2.0/schemas" &>/dev/null
+ ${updater} --allow-any-name "$@" "${EROOT}/usr/share/glib-2.0/schemas" &>/dev/null
eend $?
}
@@ -360,8 +358,8 @@ gnome2_gdk_pixbuf_savelist() {
# Updates gdk-pixbuf loader cache if GNOME2_ECLASS_GDK_PIXBUF_LOADERS has some.
# This function should be called from pkg_postinst and pkg_postrm.
gnome2_gdk_pixbuf_update() {
- local updater="${EROOT%/}/usr/bin/${CHOST}-gdk-pixbuf-query-loaders"
- [[ -x ${updater} ]] || updater="${EROOT%/}/usr/bin/gdk-pixbuf-query-loaders"
+ local updater="${EROOT}/usr/bin/${CHOST}-gdk-pixbuf-query-loaders"
+ [[ -x ${updater} ]] || updater="${EROOT}/usr/bin/gdk-pixbuf-query-loaders"
if tc-is-cross-compiler ; then
ewarn "Updating of gdk-pixbuf loader cache skipped due to cross-compilation."
@@ -380,7 +378,7 @@ gnome2_gdk_pixbuf_update() {
local tmp_file=$(mktemp "${T}"/tmp.XXXXXXXXXX) || die "Failed to create temporary file"
${updater} 1> "${tmp_file}" &&
chmod 0644 "${tmp_file}" &&
- cp -f "${tmp_file}" "${EROOT%/}/usr/$(get_libdir)/gdk-pixbuf-2.0/2.10.0/loaders.cache" &&
+ cp -f "${tmp_file}" "${EROOT}/usr/$(get_libdir)/gdk-pixbuf-2.0/2.10.0/loaders.cache" &&
rm "${tmp_file}" # don't replace this with mv, required for SELinux support
eend $?
}
@@ -398,7 +396,7 @@ gnome2_query_immodules_gtk2() {
fi
ebegin "Updating gtk2 input method module cache"
- GTK_IM_MODULE_FILE="${EROOT%/}/usr/$(get_libdir)/gtk-2.0/2.10.0/immodules.cache" \
+ GTK_IM_MODULE_FILE="${EROOT}/usr/$(get_libdir)/gtk-2.0/2.10.0/immodules.cache" \
"${updater}" --update-cache
eend $?
}
@@ -416,7 +414,7 @@ gnome2_query_immodules_gtk3() {
fi
ebegin "Updating gtk3 input method module cache"
- GTK_IM_MODULE_FILE="${EROOT%/}/usr/$(get_libdir)/gtk-3.0/3.0.0/immodules.cache" \
+ GTK_IM_MODULE_FILE="${EROOT}/usr/$(get_libdir)/gtk-3.0/3.0.0/immodules.cache" \
"${updater}" --update-cache
eend $?
}
@@ -426,8 +424,8 @@ gnome2_query_immodules_gtk3() {
# Updates glib's gio modules cache.
# This function should be called from pkg_postinst and pkg_postrm.
gnome2_giomodule_cache_update() {
- local updater="${EROOT%/}/usr/bin/${CHOST}-gio-querymodules"
- [[ -x ${updater} ]] || updater="${EROOT%/}/usr/bin/gio-querymodules"
+ local updater="${EROOT}/usr/bin/${CHOST}-gio-querymodules"
+ [[ -x ${updater} ]] || updater="${EROOT}/usr/bin/gio-querymodules"
if tc-is-cross-compiler ; then
ewarn "Updating of GIO modules cache skipped due to cross-compilation."
@@ -443,7 +441,7 @@ gnome2_giomodule_cache_update() {
fi
ebegin "Updating GIO modules cache"
- ${updater} "${EROOT%/}"/usr/$(get_libdir)/gio/modules
+ ${updater} "${EROOT}"/usr/$(get_libdir)/gio/modules
eend $?
}
@@ -486,30 +484,3 @@ gnome2_disable_deprecation_warning() {
ewarn "Failed to disable deprecation warnings in ${makefile}"
done
}
-
-case ${EAPI} in
-5|6)
-
-# @FUNCTION: gnome2_icon_savelist
-# @DESCRIPTION:
-# Find the icons that are about to be installed and save their location
-# in the GNOME2_ECLASS_ICONS environment variable. This is only
-# necessary for eclass implementations that call
-# gnome2_icon_cache_update conditionally.
-# This function should be called from pkg_preinst.
-gnome2_icon_savelist() {
- pushd "${ED}" > /dev/null || die
- export GNOME2_ECLASS_ICONS=$(find 'usr/share/icons' -maxdepth 1 -mindepth 1 -type d 2> /dev/null)
- popd > /dev/null || die
-}
-
-# @FUNCTION: gnome2_icon_cache_update
-# @DESCRIPTION:
-# Updates Gtk+ icon cache files under /usr/share/icons.
-# Deprecated. Please use xdg_icon_cache_update from xdg-utils.eclass
-gnome2_icon_cache_update() {
- xdg_icon_cache_update
-}
-
-;;
-esac
diff --git a/eclass/gnome2.eclass b/eclass/gnome2.eclass
index 66de2df97f9f..9ef5d92a1c9e 100644
--- a/eclass/gnome2.eclass
+++ b/eclass/gnome2.eclass
@@ -4,7 +4,7 @@
# @ECLASS: gnome2.eclass
# @MAINTAINER:
# gnome@gentoo.org
-# @SUPPORTED_EAPIS: 6 7 8
+# @SUPPORTED_EAPIS: 7 8
# @PROVIDES: gnome2-utils
# @BLURB: Provides phases for Gnome/Gtk+ based packages.
# @DESCRIPTION:
@@ -12,7 +12,7 @@
# GNOME framework. For additional functions, see gnome2-utils.eclass.
case ${EAPI} in
- 6|7|8) ;;
+ 7|8) ;;
*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
esac
@@ -22,11 +22,9 @@ _GNOME2_ECLASS=1
# @ECLASS_VARIABLE: GNOME2_EAUTORECONF
# @DEFAULT_UNSET
# @DESCRIPTION:
-# Run eautoreconf instead of only elibtoolize
-GNOME2_EAUTORECONF=${GNOME2_EAUTORECONF:-""}
+# Run eautoreconf instead of only elibtoolize if set to "yes".
[[ ${GNOME2_EAUTORECONF} == yes ]] && inherit autotools
-[[ ${EAPI} == 6 ]] && inherit ltprune
inherit libtool gnome.org gnome2-utils xdg
@@ -34,7 +32,6 @@ inherit libtool gnome.org gnome2-utils xdg
# @DEFAULT_UNSET
# @DESCRIPTION:
# Extra options passed to elibtoolize
-ELTCONF=${ELTCONF:-""}
# @ECLASS_VARIABLE: GNOME2_ECLASS_GIO_MODULES
# @INTERNAL
@@ -42,13 +39,10 @@ ELTCONF=${ELTCONF:-""}
# Array containing glib GIO modules
# @ECLASS_VARIABLE: GNOME2_LA_PUNT
+# @DEFAULT_UNSET
# @DESCRIPTION:
-# In EAPI 6, it relies on prune_libtool_files (from ltprune.eclass) for
-# this. Later EAPIs use find ... -delete. Available values for GNOME2_LA_PUNT:
-# - "no": will not clean any .la files
-# - "yes": will run prune_libtool_files --modules
-# - If it is not set, it will run prune_libtool_files
-GNOME2_LA_PUNT=${GNOME2_LA_PUNT:-""}
+# If set to "no", no .la files will be cleaned, otherwise
+# will run "find ... -delete" in src_install.
# @FUNCTION: gnome2_src_prepare
# @DESCRIPTION:
@@ -141,8 +135,7 @@ gnome2_src_install() {
export GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL="1"
local sk_tmp_dir="/var/lib/scrollkeeper"
- # scrollkeeper-update from rarian doesn't do anything. Then, since eapi6
- # we stop taking care of it
+ # scrollkeeper-update from rarian doesn't do anything.
#
# if this is not present, scrollkeeper-update may segfault and
# create bogus directories in /var/lib/
@@ -150,9 +143,8 @@ gnome2_src_install() {
unset GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL
- # Handle documentation as 'default' for eapi5, bug #373131
- # Since eapi6 this is handled by default on its own plus MAINTAINERS and HACKING
- # files that are really common in gnome packages (bug #573390)
+ # Install MAINTAINERS and HACKING which are really common
+ # in gnome packages (bug #573390)
local d
for d in HACKING MAINTAINERS; do
[[ -s ${d} ]] && dodoc "${d}"
@@ -170,16 +162,8 @@ gnome2_src_install() {
rm -rf "${ED}/usr/share/applications/mimeinfo.cache" || die
# Delete all .la files
- if has ${EAPI} 6; then
- case "${GNOME2_LA_PUNT}" in
- yes) prune_libtool_files --modules;;
- no) ;;
- *) prune_libtool_files;;
- esac
- else
- if [[ ${GNOME2_LA_PUNT} != 'no' ]]; then
- find "${ED}" -name '*.la' -delete || die
- fi
+ if [[ ${GNOME2_LA_PUNT} != no ]]; then
+ find "${ED}" -type f -name '*.la' -delete || die
fi
}
diff --git a/eclass/go-env.eclass b/eclass/go-env.eclass
index 1a2c9787a146..11fdf943e774 100644
--- a/eclass/go-env.eclass
+++ b/eclass/go-env.eclass
@@ -6,11 +6,17 @@
# Flatcar Linux Maintainers <infra@flatcar-linux.org>
# @AUTHOR:
# Flatcar Linux Maintainers <infra@flatcar-linux.org>
+# @SUPPORTED_EAPIS: 7 8
# @BLURB: Helper eclass for setting the Go compile environment. Required for cross-compiling.
# @DESCRIPTION:
# This eclass includes helper functions for setting the compile environment for Go ebuilds.
# Intended to be called by other Go eclasses in an early build stage, e.g. src_unpack.
+case ${EAPI} in
+ 7|8) ;;
+ *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
+esac
+
if [[ -z ${_GO_ENV_ECLASS} ]]; then
_GO_ENV_ECLASS=1
@@ -34,19 +40,40 @@ go-env_set_compile_environment() {
use x86 && export GO386=$(go-env_go386)
# XXX: Hack for checking ICE (bug #912152, gcc PR113204)
- case ${EAPI} in
- 6)
- has_version "sys-devel/gcc[debug]" && filter-lto
- ;;
- *)
- has_version -b "sys-devel/gcc[debug]" && filter-lto
- ;;
- esac
+ has_version -b "sys-devel/gcc[debug]" && filter-lto
export CGO_CFLAGS="${CGO_CFLAGS:-$CFLAGS}"
export CGO_CPPFLAGS="${CGO_CPPFLAGS:-$CPPFLAGS}"
export CGO_CXXFLAGS="${CGO_CXXFLAGS:-$CXXFLAGS}"
export CGO_LDFLAGS="${CGO_LDFLAGS:-$LDFLAGS}"
+
+ # bug #929219
+ if tc-is-gcc ; then
+ CGO_CFLAGS=$(
+ CFLAGS=${CGO_CFLAGS}
+ replace-flags -g3 -g
+ replace-flags -ggdb3 -ggdb
+ printf %s "${CFLAGS}"
+ )
+ fi
+}
+
+# @FUNCTION: go-env_goos
+# @USAGE: [toolchain prefix]
+# @DESCRIPTION:
+# Returns the appropriate GOOS setting for the target operating system.
+go-env_goos() {
+ local target=${1:-${CHOST}}
+ case "${target}" in
+ *-linux*) echo linux ;;
+ *-darwin*) echo darwin ;;
+ *-freebsd*) echo freebsd ;;
+ *-netbsd*) echo netbsd ;;
+ *-openbsd*) echo openbsd ;;
+ *-solaris*) echo solaris ;;
+ *-cygwin*|*-interix*|*-winnt*) echo windows ;;
+ *) die "unknown GOOS for ${target}" ;;
+ esac
}
# @FUNCTION: go-env_goarch
@@ -54,21 +81,23 @@ go-env_set_compile_environment() {
# @DESCRIPTION:
# Returns the appropriate GOARCH setting for the target architecture.
go-env_goarch() {
- # By chance most portage arch names match Go
- local tc_arch=$(tc-arch $@)
- case "${tc_arch}" in
- x86) echo 386;;
- x64-*) echo amd64;;
- loong) echo loong64;;
- mips) if use abi_mips_o32; then
- [[ $(tc-endian $@) = big ]] && echo mips || echo mipsle
- elif use abi_mips_n64; then
- [[ $(tc-endian $@) = big ]] && echo mips64 || echo mips64le
- fi ;;
- ppc64) [[ $(tc-endian $@) = big ]] && echo ppc64 || echo ppc64le ;;
- riscv) echo riscv64 ;;
- s390) echo s390x ;;
- *) echo "${tc_arch}";;
+ local target=${1:-${CHOST}}
+ # Some Portage arch names match Go.
+ local arch=$(tc-arch "${target}") cpu=${target%%-*}
+ case "${arch}" in
+ x86) echo 386 ;;
+ loong) echo loong64 ;;
+ *) case "${cpu}" in
+ aarch64*be) echo arm64be ;;
+ arm64) echo arm64 ;;
+ arm*b*) echo armbe ;;
+ mips64*l*) echo mips64le ;;
+ mips*l*) echo mipsle ;;
+ powerpc64le*) echo ppc64le ;;
+ arm64|s390x) echo "${cpu}" ;;
+ mips64*|riscv64*|sparc64*) echo "${arch}64" ;;
+ *) echo "${arch}" ;;
+ esac ;;
esac
}
diff --git a/eclass/golang-base.eclass b/eclass/golang-base.eclass
index 4bba00200cfc..a2996e3b0683 100644
--- a/eclass/golang-base.eclass
+++ b/eclass/golang-base.eclass
@@ -1,10 +1,10 @@
-# Copyright 1999-2022 Gentoo Authors
+# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: golang-base.eclass
# @MAINTAINER:
# William Hubbs <williamh@gentoo.org>
-# @SUPPORTED_EAPIS: 5 6 7
+# @SUPPORTED_EAPIS: 7
# @BLURB: Eclass that provides base functions for Go packages.
# @DEPRECATED: go-module.eclass
# @DESCRIPTION:
@@ -12,12 +12,9 @@
# programming language; it also provides the build-time dependency on
# dev-lang/go.
-case "${EAPI:-0}" in
- 5|6|7)
- ;;
- *)
- die "${ECLASS}: Unsupported EAPI (EAPI=${EAPI})"
- ;;
+case ${EAPI} in
+ 7) ;;
+ *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
esac
if [[ -z ${_GOLANG_BASE} ]]; then
diff --git a/eclass/golang-build.eclass b/eclass/golang-build.eclass
index 235313bd70f5..b5218ce36572 100644
--- a/eclass/golang-build.eclass
+++ b/eclass/golang-build.eclass
@@ -1,10 +1,10 @@
-# Copyright 1999-2023 Gentoo Authors
+# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: golang-build.eclass
# @MAINTAINER:
# William Hubbs <williamh@gentoo.org>
-# @SUPPORTED_EAPIS: 6 7
+# @SUPPORTED_EAPIS: 7
# @PROVIDES: golang-base
# @BLURB: Eclass for compiling go packages.
# @DEPRECATED: go-module.eclass
@@ -13,7 +13,7 @@
# functions for software written in the Go programming language.
case ${EAPI} in
- 6|7) ;;
+ 7) ;;
*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
esac
diff --git a/eclass/golang-vcs-snapshot.eclass b/eclass/golang-vcs-snapshot.eclass
index d34b8a6e913d..a91ddbbe3615 100644
--- a/eclass/golang-vcs-snapshot.eclass
+++ b/eclass/golang-vcs-snapshot.eclass
@@ -1,10 +1,10 @@
-# Copyright 1999-2023 Gentoo Authors
+# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: golang-vcs-snapshot.eclass
# @MAINTAINER:
# William Hubbs <williamh@gentoo.org>
-# @SUPPORTED_EAPIS: 6 7
+# @SUPPORTED_EAPIS: 7
# @PROVIDES: golang-base
# @BLURB: eclass to unpack VCS snapshot tarballs for Go software
# @DEPRECATED: go-module.eclass
@@ -45,7 +45,7 @@
# and add the vendored tarballs to ${WORKDIR}/src/${EGO_PN}/vendor
case ${EAPI} in
- 6|7) ;;
+ 7) ;;
*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
esac
diff --git a/eclass/golang-vcs.eclass b/eclass/golang-vcs.eclass
index 6f7a837bc15f..dee040505d23 100644
--- a/eclass/golang-vcs.eclass
+++ b/eclass/golang-vcs.eclass
@@ -1,10 +1,10 @@
-# Copyright 1999-2023 Gentoo Authors
+# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: golang-vcs.eclass
# @MAINTAINER:
# William Hubbs <williamh@gentoo.org>
-# @SUPPORTED_EAPIS: 6 7
+# @SUPPORTED_EAPIS: 7
# @PROVIDES: golang-base
# @BLURB: Eclass for fetching and unpacking go repositories.
# @DEPRECATED: go-module.eclass
@@ -13,7 +13,7 @@
# of software written in the Go programming language.
case ${EAPI} in
- 6|7) ;;
+ 7) ;;
*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
esac
diff --git a/eclass/greadme.eclass b/eclass/greadme.eclass
new file mode 100644
index 000000000000..38190becf91d
--- /dev/null
+++ b/eclass/greadme.eclass
@@ -0,0 +1,251 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+# @ECLASS: greadme.eclass
+# @MAINTAINER:
+# Florian Schmaus <flow@gentoo.org>
+# @SUPPORTED_EAPIS: 8
+# @BLURB: install a doc file, that will be conditionally shown via elog messages
+# @DESCRIPTION:
+# An eclass for installing a README.gentoo doc file with important
+# information for the user. The content of README.gentoo will shown be
+# via elog messages either on fresh installations or if the contents of
+# the file have changed. Furthermore, the README.gentoo file will be
+# installed under /usr/share/doc/${PF} for later consultation.
+#
+# This eclass was inspired by readme.gentoo-r1.eclass. The main
+# differences are as follows. Firstly, it only displays the doc file
+# contents if they have changed (unless GREADME_SHOW is set).
+# Secondly, it provides a convenient API to install the doc file via
+# stdin.
+#
+# @CODE
+# inherit greadme
+#
+# src_install() {
+# ...
+# greadme_stdin <<-EOF
+# This is the content of the created readme doc file.
+# EOF
+# ...
+# if use foo; then
+# greadme_stdin --append <<-EOF
+# This is conditional readme content, based on USE=foo.
+# EOF
+# fi
+# }
+# @CODE
+#
+# If the ebuild overrides the default pkg_preinst or respectively
+# pkg_postinst, then it must call greadme_pkg_preinst and
+# greadme_pkg_postinst explicitly.
+
+if [[ -z ${_GREADME_ECLASS} ]]; then
+_GREADME_ECLASS=1
+
+case ${EAPI} in
+ 8) ;;
+ *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
+esac
+
+_GREADME_TMP_FILE="${T}/README.gentoo"
+_GREADME_REL_PATH="/usr/share/doc/${PF}/README.gentoo"
+
+# @ECLASS_VARIABLE: GREADME_SHOW
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# If set to "yes" then unconditionally show the contents of the readme
+# file in pkg_postinst via elog. If set to "no", then do not show the
+# contents of the readme file, even if they have changed.
+
+# @ECLASS_VARIABLE: GREADME_DISABLE_AUTOFORMAT
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# If non-empty, the readme file will not be automatically formatted.
+
+# @FUNCTION: greadme_stdin
+# @USAGE: [--append]
+# @DESCRIPTION:
+# Create the readme doc via stdin. You can use --append to append to an
+# existing readme doc.
+greadme_stdin() {
+ debug-print-function ${FUNCNAME} "${@}"
+
+ local append
+ if [[ ${1} = --append ]]; then
+ append=1
+ shift
+ fi
+
+ [[ $# -eq 0 ]] || die "${FUNCNAME[0]}: Bad parameters: $*"
+
+ if [[ -n ${append} ]]; then
+ if [[ ! -f ${_GREADME_TMP_FILE} ]]; then
+ die "Gentoo README does not exist when trying to append to it"
+ fi
+
+ cat >> "${_GREADME_TMP_FILE}" || die
+ else
+ cat > "${_GREADME_TMP_FILE}" || die
+ fi
+
+ _greadme_install_doc
+}
+
+# @FUNCTION: greadme_file
+# @USAGE: <file>
+# @DESCRIPTION:
+# Installs the provided file as readme doc.
+greadme_file() {
+ debug-print-function ${FUNCNAME} "${@}"
+
+ local input_doc_file="${1}"
+ if [[ -z ${input_doc_file} ]]; then
+ die "No file specified"
+ fi
+
+ cp "${input_doc_file}" "${_GREADME_TMP_FILE}" || die
+
+ _greadme_install_doc
+}
+
+# @FUNCTION: _greadme_install_doc
+# @INTERNAL
+# @DESCRIPTION:
+# Installs the readme file from the temp directory into the image.
+_greadme_install_doc() {
+ debug-print-function ${FUNCNAME} "${@}"
+
+ local greadme="${_GREADME_TMP_FILE}"
+ if [[ ! ${GREADME_DISABLE_AUTOFORMAT} ]]; then
+ greadme="${_GREADME_TMP_FILE}".formatted
+
+ # Use fold, followed by a sed to strip trailing whitespace.
+ # https://bugs.gentoo.org/460050#c7
+ fold -s -w 70 "${_GREADME_TMP_FILE}" |
+ sed 's/[[:space:]]*$//' > "${greadme}"
+ assert "failed to autoformat README.gentoo"
+ fi
+
+ # Subshell to avoid pollution of calling environment.
+ (
+ docinto .
+ newdoc "${greadme}" "README.gentoo"
+ )
+
+ # Exclude the readme file from compression, so that its contents can
+ # be easily compared.
+ docompress -x "${_GREADME_REL_PATH}"
+
+ # Save the contents of the of the readme. Unfortunately we have to
+ # do this in src_* phase, because FEATURES=nodoc is applied right
+ # after src_install and not after pkg_preinst.
+ _GREADME_CONTENT=$(< "${greadme}")
+}
+
+# @FUNCTION: greadme_pkg_preinst
+# @DESCRIPTION:
+# Performs checks like comparing the readme doc from the image with a
+# potentially existing one in the live system.
+greadme_pkg_preinst() {
+ debug-print-function ${FUNCNAME} "${@}"
+
+ if [[ -z ${REPLACING_VERSIONS} ]]; then
+ _GREADME_SHOW="fresh-install"
+ return
+ fi
+
+ if [[ -v GREADME_SHOW ]]; then
+ case ${GREADME_SHOW} in
+ yes)
+ _GREADME_SHOW="forced"
+ ;;
+ no)
+ _GREADME_SHOW=""
+ ;;
+ *)
+ die "Invalid argument of GREADME_SHOW: ${GREADME_SHOW}"
+ ;;
+ esac
+ return
+ fi
+
+ local image_greadme_file="${ED}${_GREADME_REL_PATH}"
+ if [[ ! -f ${image_greadme_file} ]]; then
+ if [[ -v _GREADME_CONTENT ]]; then
+ # There is no greadme in the image but the ebuild created
+ # one. This is likely because FEATURES=nodoc is active.
+ # Unconditionally show greadme's contents.
+ _GREADME_SHOW="nodoc-active"
+ else
+ # No README file was created by the ebuild.
+ _GREADME_SHOW=""
+ fi
+
+ return
+ fi
+
+ check_live_doc_file() {
+ local cur_pvr=$1
+ local live_greadme_file="${EROOT}/usr/share/doc/${PN}-${cur_pvr}/README.gentoo"
+
+ if [[ ! -f ${live_greadme_file} ]]; then
+ _GREADME_SHOW="no-current-greadme"
+ return
+ fi
+
+ cmp -s "${live_greadme_file}" "${image_greadme_file}"
+ case $? in
+ 0)
+ _GREADME_SHOW=""
+ ;;
+ 1)
+ _GREADME_SHOW="content-differs"
+ ;;
+ *)
+ die "cmp failed with $?"
+ ;;
+ esac
+ }
+
+ local replaced_version
+ for replaced_version in ${REPLACING_VERSIONS}; do
+ check_live_doc_file ${replaced_version}
+
+ # Once _GREADME_SHOW is non empty, we found a reason to show the
+ # readme and we can abort the loop.
+ if [[ -n ${_GREADME_SHOW} ]]; then
+ break
+ fi
+ done
+}
+
+# @FUNCTION: greadme_pkg_postinst
+# @DESCRIPTION:
+# Conditionally shows the contents of the readme doc via elog.
+greadme_pkg_postinst() {
+ debug-print-function ${FUNCNAME} "${@}"
+
+ if [[ ! -v _GREADME_SHOW ]]; then
+ die "_GREADME_SHOW not set. Did you call greadme_pkg_preinst?"
+ fi
+
+ if [[ -z ${_GREADME_SHOW} ]]; then
+ # If _GREADME_SHOW is empty, then there is no reason to show the contents.
+ return
+ fi
+
+ local line
+ printf '%s\n' "${_GREADME_CONTENT}" | while read -r line; do
+ elog "${line}"
+ done
+ elog ""
+ elog "NOTE: Above message is only printed the first time package is"
+ elog "installed or if the message changed. Please look at"
+ elog "${EPREFIX}${_GREADME_REL_PATH}"
+ elog "for future reference."
+}
+
+fi
+
+EXPORT_FUNCTIONS pkg_preinst pkg_postinst
diff --git a/eclass/java-pkg-simple.eclass b/eclass/java-pkg-simple.eclass
index 6b473ed768ed..5ed7e3e5b78e 100644
--- a/eclass/java-pkg-simple.eclass
+++ b/eclass/java-pkg-simple.eclass
@@ -26,8 +26,12 @@ _JAVA_PKG_SIMPLE_ECLASS=1
inherit java-utils-2
-if ! has java-pkg-2 ${INHERITED}; then
- eerror "java-pkg-simple eclass can only be inherited AFTER java-pkg-2"
+if has java-pkg-2 ${INHERITED}; then
+ JAVA_PKG_OPT=0
+elif has java-pkg-opt-2 ${INHERITED}; then
+ JAVA_PKG_OPT=1
+else
+ eerror "java-pkg-simple eclass can only be inherited AFTER java-pkg-2 or java-pkg-opt-2"
fi
# We are only interested in finding all java source files, wherever they may be.
@@ -50,7 +54,12 @@ if has test ${JAVA_PKG_IUSE}; then
test_deps+=" dev-java/testng:0";;
esac
done
- [[ ${test_deps} ]] && DEPEND="test? ( ${test_deps} )"
+ if [[ ${JAVA_PKG_OPT} == 1 ]]; then
+ [[ ${test_deps} ]] && DEPEND="test? ( ${JAVA_PKG_OPT_USE}? ( ${test_deps} ) )"
+ else
+ [[ ${test_deps} ]] && DEPEND="test? ( ${test_deps} )"
+ fi
+
unset test_deps
fi
@@ -347,6 +356,7 @@ java-pkg-simple_prepend_resources() {
# If USE FLAG 'binary' exists and is set, it will just copy
# ${JAVA_BINJAR_FILENAME} to ${S} and skip the rest of src_compile.
java-pkg-simple_src_compile() {
+ [[ ${JAVA_PKG_OPT} == 1 ]] && ! use ${JAVA_PKG_OPT_USE} && return
local sources=sources.lst classes=target/classes apidoc=target/api moduleinfo
# do not compile if we decide to install binary jar
@@ -461,6 +471,7 @@ java-pkg-simple_src_compile() {
# ${JAVA_JAR_FILENAME}. It will also install a launcher if
# ${JAVA_MAIN_CLASS} is set. Also invokes einstalldocs.
java-pkg-simple_src_install() {
+ [[ ${JAVA_PKG_OPT} == 1 ]] && ! use ${JAVA_PKG_OPT_USE} && return
local sources=sources.lst classes=target/classes apidoc=target/api
# install the jar file that we need
@@ -503,6 +514,7 @@ java-pkg-simple_src_install() {
# in the "generated-test" directory as content of this directory is preserved,
# whereas content of target/test-classes is removed.
java-pkg-simple_src_test() {
+ [[ ${JAVA_PKG_OPT} == 1 ]] && ! use ${JAVA_PKG_OPT_USE} && return
local test_sources=test_sources.lst classes=target/test-classes moduleinfo
local tests_to_run classpath
diff --git a/eclass/java-utils-2.eclass b/eclass/java-utils-2.eclass
index 91f8fba8790b..9c657cc4c1f9 100644
--- a/eclass/java-utils-2.eclass
+++ b/eclass/java-utils-2.eclass
@@ -1838,7 +1838,7 @@ ejunit_() {
local junit=${1}
shift 1
- local cp=$(java-pkg_getjars --with-dependencies ${junit}${pkgs})
+ local cp=$(java-pkg_getjars --build-only --with-dependencies ${junit}${pkgs})
if [[ ${1} = -cp || ${1} = -classpath ]]; then
cp="${2}:${cp}"
shift 2
@@ -1926,7 +1926,7 @@ etestng() {
local runner=org.testng.TestNG
if [[ ${PN} != testng ]]; then
- local cp=$(java-pkg_getjars --with-dependencies testng)
+ local cp=$(java-pkg_getjars --build-only --with-dependencies testng)
else
local cp=testng.jar
fi
@@ -2723,7 +2723,13 @@ java-pkg_build-vm-from-handle() {
fi
for vm in ${JAVA_PKG_WANT_BUILD_VM}; do
- if java-config-2 --select-vm=${vm} 2>/dev/null; then
+ local java_config
+ for java_config in java-config{,-2}; do
+ type -p ${java_config} >/dev/null && break
+ done
+ [[ -z ${java_config} ]] && die "No java-config binary in PATH"
+
+ if ${java_config} --select-vm=${vm} 2>/dev/null; then
echo ${vm}
return 0
fi
diff --git a/eclass/java-vm-2.eclass b/eclass/java-vm-2.eclass
index c7a207ae24f7..c90cd8664f30 100644
--- a/eclass/java-vm-2.eclass
+++ b/eclass/java-vm-2.eclass
@@ -164,58 +164,6 @@ get_system_arch() {
}
-# @FUNCTION: set_java_env
-# @DESCRIPTION:
-# Installs a vm env file.
-# DEPRECATED, use java-vm_install-env instead.
-
-set_java_env() {
- debug-print-function ${FUNCNAME} $*
-
- local platform="$(get_system_arch)"
- local env_file="${ED}${JAVA_VM_CONFIG_DIR}/${VMHANDLE}"
-
- if [[ ${1} ]]; then
- local source_env_file="${1}"
- else
- local source_env_file="${FILESDIR}/${VMHANDLE}.env"
- fi
-
- if [[ ! -f ${source_env_file} ]]; then
- die "Unable to find the env file: ${source_env_file}"
- fi
-
- dodir ${JAVA_VM_CONFIG_DIR}
- sed \
- -e "s/@P@/${P}/g" \
- -e "s/@PN@/${PN}/g" \
- -e "s/@PV@/${PV}/g" \
- -e "s/@PF@/${PF}/g" \
- -e "s/@SLOT@/${SLOT}/g" \
- -e "s/@PLATFORM@/${platform}/g" \
- -e "s/@LIBDIR@/$(get_libdir)/g" \
- -e "/^LDPATH=.*lib\\/\\\"/s|\"\\(.*\\)\"|\"\\1${platform}/:\\1${platform}/server/\"|" \
- < "${source_env_file}" \
- > "${env_file}" || die "sed failed"
-
- (
- echo "VMHANDLE=\"${VMHANDLE}\""
- echo "BUILD_ONLY=\"${JAVA_VM_BUILD_ONLY}\""
- ) >> "${env_file}"
-
- eprefixify ${env_file}
-
- [[ -n ${JAVA_PROVIDE} ]] && echo "PROVIDES=\"${JAVA_PROVIDE}\"" >> ${env_file}
-
- local java_home=$(source "${env_file}"; echo ${JAVA_HOME})
- [[ -z ${java_home} ]] && die "No JAVA_HOME defined in ${env_file}"
-
- # Make the symlink
- dodir "${JAVA_VM_DIR}"
- dosym "${java_home}" "${JAVA_VM_DIR}/${VMHANDLE}"
-}
-
-
# @FUNCTION: java-vm_install-env
# @DESCRIPTION:
#
diff --git a/eclass/kernel-2.eclass b/eclass/kernel-2.eclass
index ffbe986f3e87..c60fcb04dd73 100644
--- a/eclass/kernel-2.eclass
+++ b/eclass/kernel-2.eclass
@@ -1332,7 +1332,7 @@ getfilevar() {
unset ARCH
echo -e "include ${basefname}\ne:\n\t@echo \$(${1})" |
- make -C "${basedname}" ${BUILD_FIXES} -s -f - e 2>/dev/null
+ make -C "${basedname}" -s -f - e 2>/dev/null
ARCH=${xarch}
fi
diff --git a/eclass/kernel-build.eclass b/eclass/kernel-build.eclass
index 86c7cd4a172d..c4f3db0028a9 100644
--- a/eclass/kernel-build.eclass
+++ b/eclass/kernel-build.eclass
@@ -20,6 +20,14 @@
# the kernel and installing it along with its modules and subset
# of sources needed to build external modules.
+# @ECLASS_VARIABLE: KV_FULL
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# A string containing the full kernel release version, e.g.
+# '6.9.6-gentoo-dist'. This is used to ensure consistency between the
+# kernel's release version and Gentoo's tooling. This is set by
+# kernel-build_src_configure() once we have a kernel.release file.
+
case ${EAPI} in
8) ;;
*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
@@ -28,7 +36,7 @@ esac
if [[ ! ${_KERNEL_BUILD_ECLASS} ]]; then
_KERNEL_BUILD_ECLASS=1
-PYTHON_COMPAT=( python3_{10..12} )
+PYTHON_COMPAT=( python3_{10..13} )
if [[ ${KERNEL_IUSE_MODULES_SIGN} ]]; then
inherit secureboot
fi
@@ -123,13 +131,35 @@ fi
# Call python-any-r1 and secureboot pkg_setup
kernel-build_pkg_setup() {
python-any-r1_pkg_setup
- if [[ ${KERNEL_IUSE_MODULES_SIGN} ]]; then
+ if [[ ${KERNEL_IUSE_MODULES_SIGN} && ${MERGE_TYPE} != binary ]]; then
secureboot_pkg_setup
- if [[ -e ${MODULES_SIGN_KEY} && ${MODULES_SIGN_KEY} != pkcs11:* ]]; then
- if [[ -e ${MODULES_SIGN_CERT} && ${MODULES_SIGN_CERT} != ${MODULES_SIGN_KEY} ]]; then
- MODULES_SIGN_KEY_CONTENTS="$(cat "${MODULES_SIGN_CERT}" "${MODULES_SIGN_KEY}" || die)"
+
+ if use modules-sign && [[ -n ${MODULES_SIGN_KEY} ]]; then
+ # Sanity check: fail early if key/cert in DER format or does not exist
+ local openssl_args=(
+ -noout -nocert
+ )
+ if [[ -n ${MODULES_SIGN_CERT} ]]; then
+ openssl_args+=( -inform PEM -in "${MODULES_SIGN_CERT}" )
else
- MODULES_SIGN_KEY_CONTENTS="$(< "${MODULES_SIGN_KEY}")"
+ # If no cert specified, we assume the pem key also contains the cert
+ openssl_args+=( -inform PEM -in "${MODULES_SIGN_KEY}" )
+ fi
+ if [[ ${MODULES_SIGN_KEY} == pkcs11:* ]]; then
+ openssl_args+=( -engine pkcs11 -keyform ENGINE -key "${MODULES_SIGN_KEY}" )
+ else
+ openssl_args+=( -keyform PEM -key "${MODULES_SIGN_KEY}" )
+ fi
+
+ openssl x509 "${openssl_args[@]}" ||
+ die "Kernel module signing certificate or key not found or not PEM format."
+
+ if [[ ${MODULES_SIGN_KEY} != pkcs11:* ]]; then
+ if [[ -n ${MODULES_SIGN_CERT} && ${MODULES_SIGN_CERT} != ${MODULES_SIGN_KEY} ]]; then
+ MODULES_SIGN_KEY_CONTENTS="$(cat "${MODULES_SIGN_CERT}" "${MODULES_SIGN_KEY}" || die)"
+ else
+ MODULES_SIGN_KEY_CONTENTS="$(< "${MODULES_SIGN_KEY}")"
+ fi
fi
fi
fi
@@ -157,6 +187,10 @@ kernel-build_src_configure() {
fi
# force ld.bfd if we can find it easily
+ local HOSTLD="$(tc-getBUILD_LD)"
+ if type -P "${HOSTLD}.bfd" &>/dev/null; then
+ HOSTLD+=.bfd
+ fi
local LD="$(tc-getLD)"
if type -P "${LD}.bfd" &>/dev/null; then
LD+=.bfd
@@ -168,6 +202,8 @@ kernel-build_src_configure() {
HOSTCC="$(tc-getBUILD_CC)"
HOSTCXX="$(tc-getBUILD_CXX)"
+ HOSTLD="${HOSTLD}"
+ HOSTAR="$(tc-getBUILD_AR)"
HOSTCFLAGS="${BUILD_CFLAGS}"
HOSTLDFLAGS="${BUILD_LDFLAGS}"
@@ -180,6 +216,7 @@ kernel-build_src_configure() {
STRIP="$(tc-getSTRIP)"
OBJCOPY="$(tc-getOBJCOPY)"
OBJDUMP="$(tc-getOBJDUMP)"
+ READELF="$(tc-getREADELF)"
# we need to pass it to override colliding Gentoo envvar
ARCH=$(tc-arch-kernel)
@@ -223,6 +260,32 @@ kernel-build_src_configure() {
mkdir -p "${WORKDIR}"/modprep || die
mv .config "${WORKDIR}"/modprep/ || die
emake O="${WORKDIR}"/modprep "${MAKEARGS[@]}" olddefconfig
+
+ local k_release=$(emake -s O="${WORKDIR}"/modprep "${MAKEARGS[@]}" kernelrelease)
+ if [[ -z ${KV_FULL} ]]; then
+ KV_FULL=${k_release}
+ fi
+
+ # Make sure we are about to build the correct kernel
+ if [[ ${PV} != *9999 ]]; then
+ local expected_ver=$(dist-kernel_PV_to_KV "${PV}")
+
+ if [[ ${KV_FULL} != ${k_release} ]]; then
+ eerror "KV_FULL mismatch!"
+ eerror "KV_FULL: ${KV_FULL}"
+ eerror "Expected: ${k_release}"
+ die "KV_FULL mismatch: got ${KV_FULL}, expected ${k_release}"
+ fi
+
+ if [[ ${KV_FULL} != ${expected_ver}* ]]; then
+ eerror "Kernel version does not match PV!"
+ eerror "Source version: ${KV_FULL}"
+ eerror "Expected (PV*): ${expected_ver}*"
+ eerror "Please ensure you are applying the correct patchset."
+ die "Kernel version mismatch: got ${KV_FULL}, expected ${expected_ver}*"
+ fi
+ fi
+
emake O="${WORKDIR}"/modprep "${MAKEARGS[@]}" modules_prepare
cp -pR "${WORKDIR}"/modprep "${WORKDIR}"/build || die
}
@@ -254,20 +317,15 @@ kernel-build_src_test() {
INSTALL_MOD_PATH="${T}" INSTALL_MOD_STRIP="${strip_args}" \
modules_install
- local dir_ver=${PV}${KV_LOCALVERSION}
- local relfile=${WORKDIR}/build/include/config/kernel.release
- local module_ver
- module_ver=$(<"${relfile}") || die
-
- kernel-install_test "${module_ver}" \
+ kernel-install_test "${KV_FULL}" \
"${WORKDIR}/build/$(dist-kernel_get_image_path)" \
- "${T}/lib/modules/${module_ver}"
+ "${T}/lib/modules/${KV_FULL}"
}
# @FUNCTION: kernel-build_src_install
# @DESCRIPTION:
# Install the built kernel along with subset of sources
-# into /usr/src/linux-${PV}. Install the modules. Save the config.
+# into /usr/src/linux-${KV_FULL}. Install the modules. Save the config.
kernel-build_src_install() {
debug-print-function ${FUNCNAME} "${@}"
@@ -304,8 +362,7 @@ kernel-build_src_install() {
# note: we're using mv rather than doins to save space and time
# install main and arch-specific headers first, and scripts
local kern_arch=$(tc-arch-kernel)
- local dir_ver=${PV}${KV_LOCALVERSION}
- local kernel_dir=/usr/src/linux-${dir_ver}
+ local kernel_dir=/usr/src/linux-${KV_FULL}
if use sparc ; then
# We don't want tc-arch-kernel's sparc64, even though we do
@@ -378,10 +435,6 @@ kernel-build_src_install() {
# strip empty directories
find "${D}" -type d -empty -exec rmdir {} + || die
- local relfile=${ED}${kernel_dir}/include/config/kernel.release
- local module_ver
- module_ver=$(<"${relfile}") || die
-
# warn when trying to "make" a dist-kernel
cat <<-EOF >> "${ED}${kernel_dir}/Makefile" || die
@@ -399,12 +452,14 @@ kernel-build_src_install() {
echo "${CATEGORY}/${PF}:${SLOT}" > "${ED}${kernel_dir}/dist-kernel" || die
# fix source tree and build dir symlinks
- dosym "../../../${kernel_dir}" "/lib/modules/${module_ver}/build"
- dosym "../../../${kernel_dir}" "/lib/modules/${module_ver}/source"
+ dosym "../../../${kernel_dir}" "/lib/modules/${KV_FULL}/build"
+ dosym "../../../${kernel_dir}" "/lib/modules/${KV_FULL}/source"
+ dosym "../../../${kernel_dir}/.config" "/lib/modules/${KV_FULL}/config"
+ dosym "../../../${kernel_dir}/System.map" "/lib/modules/${KV_FULL}/System.map"
if [[ "${image_path}" == *vmlinux* ]]; then
- dosym "../../../${kernel_dir}/${image_path}" "/lib/modules/${module_ver}/vmlinux"
+ dosym "../../../${kernel_dir}/${image_path}" "/lib/modules/${KV_FULL}/vmlinux"
else
- dosym "../../../${kernel_dir}/${image_path}" "/lib/modules/${module_ver}/vmlinuz"
+ dosym "../../../${kernel_dir}/${image_path}" "/lib/modules/${KV_FULL}/vmlinuz"
fi
if [[ ${KERNEL_IUSE_MODULES_SIGN} ]]; then
@@ -435,8 +490,8 @@ kernel-build_src_install() {
--conf "${T}/empty-file"
--confdir "${T}/empty-directory"
--kernel-image "${image}"
- --kmoddir "${ED}/lib/modules/${dir_ver}"
- --kver "${dir_ver}"
+ --kmoddir "${ED}/lib/modules/${KV_FULL}"
+ --kver "${KV_FULL}"
--verbose
--compress="xz -9e --check=crc32"
--no-hostonly
@@ -462,11 +517,11 @@ kernel-build_src_install() {
--linux="${image}"
--initrd="${image%/*}/initrd"
--cmdline="${KERNEL_GENERIC_UKI_CMDLINE}"
- --uname="${dir_ver}"
+ --uname="${KV_FULL}"
--output="${image%/*}/uki.efi"
)
- if [[ ${KERNEL_IUSE_SECUREBOOT} ]] && use secureboot; then
+ if [[ ${KERNEL_IUSE_MODULES_SIGN} ]] && use secureboot; then
ukify_args+=(
--signtool=sbsign
--secureboot-private-key="${SECUREBOOT_SIGN_KEY}"
@@ -520,7 +575,7 @@ kernel-build_pkg_postinst() {
ewarn
ewarn "MODULES_SIGN_KEY was not set, this means the kernel build system"
ewarn "automatically generated the signing key. This key was installed"
- ewarn "in ${EROOT}/usr/src/linux-${PV}${KV_LOCALVERSION}/certs"
+ ewarn "in ${EROOT}/usr/src/linux-${KV_FULL}/certs"
ewarn "and will also be included in any binary packages."
ewarn "Please take appropriate action to protect the key!"
ewarn
diff --git a/eclass/kernel-install.eclass b/eclass/kernel-install.eclass
index 77570a905ce1..930640188c26 100644
--- a/eclass/kernel-install.eclass
+++ b/eclass/kernel-install.eclass
@@ -26,6 +26,15 @@
# If set to a non-null value, adds IUSE=generic-uki and required
# logic to install a generic unified kernel image.
+# @ECLASS_VARIABLE: KV_FULL
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# A string containing the full kernel release version, e.g.
+# '6.9.6-gentoo-dist'. Defaults to ${PV}${KV_LOCALVERSION},
+# but can be set by the ebuild when this default value does
+# not match the kernel release. kernel-build.eclass sets this
+# to whatever is in the built kernel's kernel.release file.
+
# @ECLASS_VARIABLE: KV_LOCALVERSION
# @DEFAULT_UNSET
# @DESCRIPTION:
@@ -63,7 +72,10 @@ _IDEPEND_BASE="
>=sys-kernel/installkernel-14
)
initramfs? (
- >=sys-kernel/installkernel-14[dracut(-)]
+ || (
+ >=sys-kernel/installkernel-14[dracut(-)]
+ >=sys-kernel/installkernel-14[ugrd(-)]
+ )
)
"
@@ -190,7 +202,7 @@ if [[ ${KERNEL_IUSE_GENERIC_UKI} ]]; then
"
IDEPEND="
generic-uki? (
- >=sys-kernel/installkernel-14[-dracut(-),-ukify(-)]
+ >=sys-kernel/installkernel-14[-dracut(-),-ugrd(-),-ukify(-)]
)
!generic-uki? (
${_IDEPEND_BASE}
@@ -543,16 +555,26 @@ kernel-install_pkg_pretend() {
if ! use initramfs && ! has_version "${CATEGORY}/${PN}[-initramfs]"; then
ewarn
- ewarn "WARNING: The standard configuration of the Gentoo distribution"
- ewarn "kernels requires an initramfs! You have disabled the initramfs"
- ewarn "USE flag and as a result dracut was not pulled in as a dependency."
- ewarn "Please ensure that you are either overriding the standard"
- ewarn "configuration or that an alternative initramfs generation plugin"
- ewarn "is installed for your installkernel implementation!"
+ ewarn "WARNING: The default distribution kernel configuration is designed"
+ ewarn "to be used with an initramfs! Although possible, there is no guarantee"
+ ewarn "that distribution kernels will boot without an initramfs."
ewarn
- ewarn "This is an advanced use case, you are on your own to ensure"
- ewarn "that your system is bootable!"
+ ewarn "You have disabled the initramfs USE flag, and as a result the package manager"
+ ewarn "will not enforce the configuration of an initramfs generator in"
+ ewarn "sys-kernel/installkernel."
ewarn
+ ewarn "If you wish to use a custom initramfs generator, then please ensure that"
+ ewarn "/sbin/installkernel is capable of calling it via a kernel installation hook,"
+ ewarn "and is also configured to use it via /etc/kernel/install.conf."
+ ewarn
+ ewarn "If you wish to boot without an initramfs, then please ensure that"
+ ewarn "all kernel drivers required to boot your system are built into the"
+ ewarn "kernel by modifying the default distribution kernel configuration"
+ ewarn "using /etc/kernel/config.d"
+ ewarn
+ ewarn "Please refer to the installkernel and distribution kernel documentation:"
+ ewarn " https://wiki.gentoo.org/wiki/Installkernel"
+ ewarn " https://wiki.gentoo.org/wiki/Project:Distribution_Kernel"
fi
}
@@ -571,40 +593,47 @@ kernel-install_src_test() {
kernel-install_pkg_preinst() {
debug-print-function ${FUNCNAME} "${@}"
- local dir_ver=${PV}${KV_LOCALVERSION}
- local kernel_dir=${ED}/usr/src/linux-${dir_ver}
- local relfile=${kernel_dir}/include/config/kernel.release
+ # Set KV_FULL to ${PV}${KV_LOCALVERSION} if it hasn't
+ # been set elsewhere for backward compatibility with existing
+ # bin-kernel packages
+ if [[ -z ${KV_FULL} ]]; then
+ KV_FULL=${PV}${KV_LOCALVERSION}
+ fi
+
+ local kernel_dir=${ED}/usr/src/linux-${KV_FULL}
local image_path=$(dist-kernel_get_image_path)
[[ ! -d ${kernel_dir} ]] &&
die "Kernel directory ${kernel_dir} not installed!"
- [[ ! -f ${relfile} ]] &&
- die "Release file ${relfile} not installed!"
- local release
- release="$(<"${relfile}")" || die
- DIST_KERNEL_RELEASE="${release}"
# perform the version check for release ebuilds only
if [[ ${PV} != *9999 ]]; then
local expected_ver=$(dist-kernel_PV_to_KV "${PV}")
- if [[ ${release} != ${expected_ver}* ]]; then
- eerror "Kernel release mismatch!"
- eerror " expected (PV): ${expected_ver}*"
- eerror " found: ${release}"
- eerror "Please verify that you are applying the correct patches."
- die "Kernel release mismatch (${release} instead of ${expected_ver}*)"
+ if [[ ${KV_FULL} != ${expected_ver}* ]]; then
+ eerror "Kernel version does not match PV!"
+ eerror "Source version: ${KV_FULL}"
+ eerror "Expected (PV*): ${expected_ver}*"
+ eerror "Please ensure you are applying the correct patchset."
+ die "Kernel version mismatch: got ${KV_FULL}, expected ${expected_ver}*"
fi
fi
if [[ -L ${EROOT}/lib && ${EROOT}/lib -ef ${EROOT}/usr/lib ]]; then
# Adjust symlinks for merged-usr.
- rm "${ED}/lib/modules/${release}"/{build,source} || die
- dosym "../../../src/linux-${dir_ver}" "/usr/lib/modules/${release}/build"
- dosym "../../../src/linux-${dir_ver}" "/usr/lib/modules/${release}/source"
+ rm "${ED}/lib/modules/${KV_FULL}"/{build,source} || die
+ dosym "../../../src/linux-${KV_FULL}" "/usr/lib/modules/${KV_FULL}/build"
+ dosym "../../../src/linux-${KV_FULL}" "/usr/lib/modules/${KV_FULL}/source"
+ local file
+ for file in .config System.map; do
+ if [[ -L "${ED}/lib/modules/${KV_FULL}/${file#.}" ]]; then
+ rm "${ED}/lib/modules/${KV_FULL}/${file#.}" || die
+ dosym "../../../src/linux-${KV_FULL}/${file}" "/usr/lib/modules/${KV_FULL}/${file#.}"
+ fi
+ done
for file in vmlinux vmlinuz; do
- if [[ -L "${ED}/lib/modules/${release}/${file}" ]]; then
- rm "${ED}/lib/modules/${release}/${file}" || die
- dosym "../../../src/linux-${dir_ver}/${image_path}" "/usr/lib/modules/${release}/${file}"
+ if [[ -L "${ED}/lib/modules/${KV_FULL}/${file}" ]]; then
+ rm "${ED}/lib/modules/${KV_FULL}/${file}" || die
+ dosym "../../../src/linux-${KV_FULL}/${image_path}" "/usr/lib/modules/${KV_FULL}/${file}"
fi
done
fi
@@ -678,13 +707,12 @@ kernel-install_install_all() {
kernel-install_pkg_postinst() {
debug-print-function ${FUNCNAME} "${@}"
- local dir_ver=${PV}${KV_LOCALVERSION}
- kernel-install_update_symlink "${EROOT}/usr/src/linux" "${dir_ver}"
+ kernel-install_update_symlink "${EROOT}/usr/src/linux" "${KV_FULL}"
dist-kernel_compressed_module_cleanup \
- "${EROOT}/lib/modules/${DIST_KERNEL_RELEASE}"
+ "${EROOT}/lib/modules/${KV_FULL}"
if [[ -z ${ROOT} ]]; then
- kernel-install_install_all "${dir_ver}"
+ kernel-install_install_all "${KV_FULL}"
fi
if [[ ${KERNEL_IUSE_GENERIC_UKI} ]] && use generic-uki; then
@@ -708,8 +736,7 @@ kernel-install_pkg_postrm() {
debug-print-function ${FUNCNAME} "${@}"
if [[ -z ${ROOT} && ! ${KERNEL_IUSE_GENERIC_UKI} ]]; then
- local dir_ver=${PV}${KV_LOCALVERSION}
- local kernel_dir=${EROOT}/usr/src/linux-${dir_ver}
+ local kernel_dir=${EROOT}/usr/src/linux-${KV_FULL}
local image_path=$(dist-kernel_get_image_path)
ebegin "Removing initramfs"
rm -f "${kernel_dir}/${image_path%/*}"/{initrd,uki.efi} &&
@@ -724,7 +751,11 @@ kernel-install_pkg_postrm() {
kernel-install_pkg_config() {
[[ -z ${ROOT} ]] || die "ROOT!=/ not supported currently"
- kernel-install_install_all "${PV}${KV_LOCALVERSION}"
+ if [[ -z ${KV_FULL} ]]; then
+ KV_FULL=${PV}${KV_LOCALVERSION}
+ fi
+
+ kernel-install_install_all "${KV_FULL}"
}
# @FUNCTION: kernel-install_compress_modules
@@ -735,14 +766,39 @@ kernel-install_compress_modules() {
if use modules-compress; then
einfo "Compressing kernel modules ..."
- # xz options taken from scripts/Makefile.modinst
- # we don't do 'xz -T' because it applies multithreading per file,
- # so it works only for big files, and we have lots of small files
- # instead
- find "${ED}/lib" -name '*.ko' -print0 |
- xargs -0 -P "$(makeopts_jobs)" -n 128 \
- xz --check=crc32 --lzma2=dict=1MiB
+ if [[ -z ${KV_FULL} ]]; then
+ KV_FULL=${PV}${KV_LOCALVERSION}
+ fi
+ local suffix=$(dist-kernel_get_module_suffix "${ED}/usr/src/linux-${KV_FULL}/.config")
+ local compress=()
+ # Options taken from linux-mod-r1.eclass.
+ # We don't instruct the compressor to parallelize because it applies
+ # multithreading per file, so it works only for big files, and we have
+ # lots of small files instead.
+ case ${suffix} in
+ .ko)
+ return
+ ;;
+ .ko.gz)
+ compress+=( gzip )
+ ;;
+ .ko.xz)
+ compress+=( xz --check=crc32 --lzma2=dict=1MiB )
+ ;;
+ .ko.zst)
+ compress+=( zstd -q --rm )
+ ;;
+ *)
+ die "Unknown compressor: ${suffix}"
+ ;;
+ esac
+
+ find "${ED}/lib/modules/${KV_FULL}" -name '*.ko' -print0 |
+ xargs -0 -P "$(makeopts_jobs)" -n 128 "${compress[@]}"
assert "Compressing kernel modules failed"
+
+ # Module paths have changed, run depmod
+ depmod --all --basedir "${ED}" ${KV_FULL} || die
fi
}
diff --git a/eclass/linux-info.eclass b/eclass/linux-info.eclass
index 9449a6359d2a..0f6138150144 100644
--- a/eclass/linux-info.eclass
+++ b/eclass/linux-info.eclass
@@ -6,7 +6,7 @@
# kernel@gentoo.org
# @AUTHOR:
# Original author: John Mylchreest <johnm@gentoo.org>
-# @SUPPORTED_EAPIS: 6 7 8
+# @SUPPORTED_EAPIS: 7 8
# @BLURB: eclass used for accessing kernel related information
# @DESCRIPTION:
# This eclass is used as a central eclass for accessing kernel
@@ -28,7 +28,7 @@
# get_running_version
case ${EAPI} in
- 6|7|8) ;;
+ 7|8) ;;
*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
esac
@@ -38,7 +38,6 @@ _LINUX_INFO_ECLASS=1
# A Couple of env vars are available to effect usage of this eclass
# These are as follows:
-
# @ECLASS_VARIABLE: CHECKCONFIG_DONOTHING
# @USER_VARIABLE
# @DEFAULT_UNSET
@@ -51,7 +50,7 @@ _LINUX_INFO_ECLASS=1
# @DESCRIPTION:
# A string containing the directory of the target kernel sources. The default value is
# "/usr/src/linux"
-KERNEL_DIR="${KERNEL_DIR:-${ROOT%/}/usr/src/linux}"
+KERNEL_DIR="${KERNEL_DIR:-${ROOT}/usr/src/linux}"
# @ECLASS_VARIABLE: CONFIG_CHECK
# @DEFAULT_UNSET
@@ -88,7 +87,6 @@ KERNEL_DIR="${KERNEL_DIR:-${ROOT%/}/usr/src/linux}"
# CONFIG_CHECK="~CFG" with ERROR_<CFG>="Error Message" calls eerror without dying
# CONFIG_CHECK="~CFG" with WARNING_<CFG>="Warning Message" calls ewarn without dying
-
# @ECLASS_VARIABLE: KBUILD_OUTPUT
# @DEFAULT_UNSET
# @DESCRIPTION:
@@ -168,13 +166,6 @@ KERNEL_DIR="${KERNEL_DIR:-${ROOT%/}/usr/src/linux}"
# And to ensure all the weirdness with crosscompile
inherit toolchain-funcs
-[[ ${EAPI} == 6 ]] && inherit eapi7-ver
-
-# bug #75034
-case ${ARCH} in
- ppc) BUILD_FIXES="${BUILD_FIXES} TOUT=${T}/.tmp_gas_check";;
- ppc64) BUILD_FIXES="${BUILD_FIXES} TOUT=${T}/.tmp_gas_check";;
-esac
# @FUNCTION: set_arch_to_kernel
# @DESCRIPTION:
@@ -248,8 +239,7 @@ getfilevar() {
# Pass dot-config=0 to avoid the config check in kernels prior to 5.4.
echo -e "e:\\n\\t@echo \$(${1})\\ninclude ${basefname}" | \
nonfatal emake -C "${basedname}" --no-print-directory M="${T}" \
- dot-config=0 need-config= need-compiler= \
- ${BUILD_FIXES} -s -f - 2>/dev/null
+ dot-config=0 need-config= need-compiler= -s -f - 2>/dev/null
ARCH=${myARCH}
fi
@@ -642,7 +632,7 @@ get_version() {
# caught before this if they are.
if [[ -z ${OUTPUT_DIR} ]] ; then
# Try to locate a kernel that is most relevant for us.
- for OUTPUT_DIR in "${SYSROOT}" "${ROOT%/}" "" ; do
+ for OUTPUT_DIR in "${SYSROOT}" "${ROOT}" "" ; do
OUTPUT_DIR+="/lib/modules/${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}${KV_EXTRA}${KV_LOCAL}/build"
if [[ -e ${OUTPUT_DIR} ]] ; then
break
@@ -670,10 +660,10 @@ get_running_version() {
local kv=$(uname -r)
- if [[ -f ${ROOT%/}/lib/modules/${kv}/source/Makefile ]]; then
- KERNEL_DIR=$(readlink -f "${ROOT%/}/lib/modules/${kv}/source")
- if [[ -f ${ROOT%/}/lib/modules/${kv}/build/Makefile ]]; then
- KBUILD_OUTPUT=$(readlink -f "${ROOT%/}/lib/modules/${kv}/build")
+ if [[ -f ${ROOT}/lib/modules/${kv}/source/Makefile ]]; then
+ KERNEL_DIR=$(readlink -f "${ROOT}/lib/modules/${kv}/source")
+ if [[ -f ${ROOT}/lib/modules/${kv}/build/Makefile ]]; then
+ KBUILD_OUTPUT=$(readlink -f "${ROOT}/lib/modules/${kv}/build")
fi
get_version && return 0
fi
@@ -718,7 +708,6 @@ linux-info_get_any_version() {
fi
}
-
# ebuild check functions
# ---------------------------------------
diff --git a/eclass/llvm-r1.eclass b/eclass/llvm-r1.eclass
index 075df9218be8..0a53b9a3cb5e 100644
--- a/eclass/llvm-r1.eclass
+++ b/eclass/llvm-r1.eclass
@@ -61,7 +61,7 @@ _LLVM_OLDEST_SLOT=15
# @DESCRIPTION:
# The newest stable LLVM version. Versions newer than that won't
# be automatically enabled via USE defaults.
-_LLVM_NEWEST_STABLE=17
+_LLVM_NEWEST_STABLE=18
# == control variables ==
@@ -123,11 +123,16 @@ _llvm_set_globals() {
fi
if [[ ${stable[@]} ]]; then
+ # If there is at least one stable slot supported, then enable
+ # the newest stable slot by default.
IUSE="+llvm_slot_${stable[-1]}"
unset 'stable[-1]'
else
- IUSE="+llvm_slot_${unstable[-1]}"
- unset 'unstable[-1]'
+ # Otherwise, enable the "oldest" ~arch slot. We really only
+ # expect a single ~arch version, so this primarily prevents
+ # defaulting to non-keyworded slots.
+ IUSE="+llvm_slot_${unstable[0]}"
+ unset 'unstable[0]'
fi
local nondefault=( "${stable[@]}" "${unstable[@]}" )
IUSE+=" ${nondefault[*]/#/llvm_slot_}"
diff --git a/eclass/llvm.eclass b/eclass/llvm.eclass
index e297fe992c9f..bb5ff5d78290 100644
--- a/eclass/llvm.eclass
+++ b/eclass/llvm.eclass
@@ -9,6 +9,7 @@
# @SUPPORTED_EAPIS: 7 8
# @PROVIDES: llvm-utils
# @BLURB: Utility functions to build against slotted LLVM
+# @DEPRECATED: llvm-r1.eclass
# @DESCRIPTION:
# The llvm.eclass provides utility functions that can be used to build
# against specific version of slotted LLVM (with fallback to :0 for old
diff --git a/eclass/llvm.org.eclass b/eclass/llvm.org.eclass
index a6a7b542e64b..4b49d35a542b 100644
--- a/eclass/llvm.org.eclass
+++ b/eclass/llvm.org.eclass
@@ -57,7 +57,7 @@ LLVM_VERSION=$(ver_cut 1-3)
# @DESCRIPTION:
# The major version of current LLVM trunk. Used to determine
# the correct branch to use.
-_LLVM_MAIN_MAJOR=19
+_LLVM_MAIN_MAJOR=20
# @ECLASS_VARIABLE: _LLVM_SOURCE_TYPE
# @INTERNAL
@@ -72,11 +72,14 @@ if [[ -z ${_LLVM_SOURCE_TYPE+1} ]]; then
_LLVM_SOURCE_TYPE=snapshot
case ${PV} in
- 19.0.0_pre20240630)
- EGIT_COMMIT=022d15c0039fc1cfaa3cc2eb1a45b71bbb21fadd
+ 20.0.0_pre20240815)
+ EGIT_COMMIT=db8ef6188cbbe2125e6d60bdef77a535105772df
;;
- 19.0.0_pre20240623)
- EGIT_COMMIT=3ae6755719c6dfc07761b4e9bdac8c86bcb41734
+ 20.0.0_pre20240808)
+ EGIT_COMMIT=fd7d7882e7fa5a38d4bfde426120d4663718beb4
+ ;;
+ 20.0.0_pre20240801)
+ EGIT_COMMIT=130c135689ec12ab78c53645808524a8d28f7cae
;;
*)
die "Unknown snapshot: ${PV}"
@@ -238,12 +241,21 @@ llvm.org_set_globals() {
EGIT_BRANCH="release/${LLVM_MAJOR}.x"
;;
tar)
- SRC_URI+="
- https://github.com/llvm/llvm-project/releases/download/llvmorg-${PV/_/-}/llvm-project-${PV/_/}.src.tar.xz
- verify-sig? (
- https://github.com/llvm/llvm-project/releases/download/llvmorg-${PV/_/-}/llvm-project-${PV/_/}.src.tar.xz.sig
- )
- "
+ if [[ ${LLVM_MAJOR} -ge 19 ]]; then
+ SRC_URI+="
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${PV/_/-}/llvm-project-${PV/_/-}.src.tar.xz
+ verify-sig? (
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${PV/_/-}/llvm-project-${PV/_/-}.src.tar.xz.sig
+ )
+ "
+ else
+ SRC_URI+="
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${PV/_/-}/llvm-project-${PV/_/}.src.tar.xz
+ verify-sig? (
+ https://github.com/llvm/llvm-project/releases/download/llvmorg-${PV/_/-}/llvm-project-${PV/_/}.src.tar.xz.sig
+ )
+ "
+ fi
BDEPEND+="
verify-sig? (
>=sec-keys/openpgp-keys-llvm-18.1.6
@@ -356,7 +368,11 @@ llvm.org_src_unpack() {
git-r3_checkout '' . '' "${components[@]}"
;;
tar)
- archive=llvm-project-${PV/_/}.src.tar.xz
+ if [[ ${LLVM_MAJOR} -ge 19 ]]; then
+ archive=llvm-project-${PV/_/-}.src.tar.xz
+ else
+ archive=llvm-project-${PV/_/}.src.tar.xz
+ fi
if use verify-sig; then
verify-sig_verify_detached \
"${DISTDIR}/${archive}" "${DISTDIR}/${archive}.sig"
diff --git a/eclass/ltprune.eclass b/eclass/ltprune.eclass
deleted file mode 100644
index 51f5aaabfea7..000000000000
--- a/eclass/ltprune.eclass
+++ /dev/null
@@ -1,177 +0,0 @@
-# Copyright 1999-2024 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-# @DEAD
-# @ECLASS: ltprune.eclass
-# @MAINTAINER:
-# Michał Górny <mgorny@gentoo.org>
-# @SUPPORTED_EAPIS: 0 1 2 3 4 5 6
-# @BLURB: Smart .la file pruning
-# @DEPRECATED: none
-# @DESCRIPTION:
-# A function to locate and remove unnecessary .la files.
-#
-# Discouraged. Whenever possible, please use much simpler:
-# @CODE
-# find "${ED}" -type f -name '*.la' -delete || die
-# @CODE
-
-if [[ -z ${_LTPRUNE_ECLASS} ]]; then
-
-case ${EAPI:-0} in
- 0|1|2|3|4|5|6)
- ;;
- *)
- die "${ECLASS}: banned in EAPI=${EAPI}; use 'find' instead";;
-esac
-
-inherit toolchain-funcs
-
-# @FUNCTION: prune_libtool_files
-# @USAGE: [--all|--modules]
-# @DESCRIPTION:
-# Locate unnecessary libtool files (.la) and libtool static archives
-# (.a) and remove them from installation image.
-#
-# By default, .la files are removed whenever the static linkage can
-# either be performed using pkg-config or doesn't introduce additional
-# flags.
-#
-# If '--modules' argument is passed, .la files for modules (plugins) are
-# removed as well. This is usually useful when the package installs
-# plugins and the plugin loader does not use .la files.
-#
-# If '--all' argument is passed, all .la files are removed without
-# performing any heuristic on them. You shouldn't ever use that,
-# and instead report a bug in the algorithm instead.
-#
-# The .a files are only removed whenever corresponding .la files state
-# that they should not be linked to, i.e. whenever these files
-# correspond to plugins.
-#
-# Note: if your package installs both static libraries and .pc files
-# which use variable substitution for -l flags, you need to add
-# pkg-config to your DEPEND.
-prune_libtool_files() {
- debug-print-function ${FUNCNAME} "$@"
-
- local removing_all removing_modules opt
- for opt; do
- case "${opt}" in
- --all)
- removing_all=1
- removing_modules=1
- ;;
- --modules)
- removing_modules=1
- ;;
- *)
- die "Invalid argument to ${FUNCNAME}(): ${opt}"
- esac
- done
-
- local f
- local queue=()
- while IFS= read -r -d '' f; do # for all .la files
- local archivefile=${f/%.la/.a}
-
- # The following check is done by libtool itself.
- # It helps us avoid removing random files which match '*.la',
- # see bug #468380.
- if ! sed -n -e '/^# Generated by .*libtool/q0;4q1' "${f}"; then
- continue
- fi
-
- [[ ${f} != ${archivefile} ]] || die 'regex sanity check failed'
- local reason= pkgconfig_scanned=
- local snotlink=$(sed -n -e 's:^shouldnotlink=::p' "${f}")
-
- if [[ ${snotlink} == yes ]]; then
-
- # Remove static libs we're not supposed to link against.
- if [[ -f ${archivefile} ]]; then
- einfo "Removing unnecessary ${archivefile#${D%/}} (static plugin)"
- queue+=( "${archivefile}" )
- fi
-
- # The .la file may be used by a module loader, so avoid removing it
- # unless explicitly requested.
- if [[ ${removing_modules} ]]; then
- reason='module'
- fi
-
- else
-
- # Remove .la files when:
- # - user explicitly wants us to remove all .la files,
- # - respective static archive doesn't exist,
- # - they are covered by a .pc file already,
- # - they don't provide any new information (no libs & no flags).
-
- if [[ ${removing_all} ]]; then
- reason='requested'
- elif [[ ! -f ${archivefile} ]]; then
- reason='no static archive'
- elif [[ ! $(sed -nre \
- "s/^(dependency_libs|inherited_linker_flags)='(.*)'$/\2/p" \
- "${f}") ]]; then
- reason='no libs & flags'
- else
- if [[ ! ${pkgconfig_scanned} ]]; then
- # Create a list of all .pc-covered libs.
- local pc_libs=()
- if [[ ! ${removing_all} ]]; then
- local pc
- local tf=${T}/prune-lt-files.pc
- local pkgconf=$(tc-getPKG_CONFIG)
-
- while IFS= read -r -d '' pc; do # for all .pc files
- local arg libs
-
- # Use pkg-config if available (and works),
- # fallback to sed.
- if ${pkgconf} --exists "${pc}" &>/dev/null; then
- sed -e '/^Requires:/d' "${pc}" > "${tf}"
- libs=$(${pkgconf} --libs "${tf}")
- else
- libs=$(sed -ne 's/^Libs://p' "${pc}")
- fi
-
- for arg in ${libs}; do
- if [[ ${arg} == -l* ]]; then
- if [[ ${arg} == '*$*' ]]; then
- eerror "${FUNCNAME}: variable substitution likely failed in ${pc}"
- eerror "(arg: ${arg})"
- eerror "Most likely, you need to add virtual/pkgconfig to DEPEND."
- die "${FUNCNAME}: unsubstituted variable found in .pc"
- fi
-
- pc_libs+=( lib${arg#-l}.la )
- fi
- done
- done < <(find "${D}" -type f -name '*.pc' -print0)
-
- rm -f "${tf}"
- fi
-
- pkgconfig_scanned=1
- fi # pkgconfig_scanned
-
- has "${f##*/}" "${pc_libs[@]}" && reason='covered by .pc'
- fi # removal due to .pc
-
- fi # shouldnotlink==no
-
- if [[ ${reason} ]]; then
- einfo "Removing unnecessary ${f#${D%/}} (${reason})"
- queue+=( "${f}" )
- fi
- done < <(find "${D}" -xtype f -name '*.la' -print0)
-
- if [[ ${queue[@]} ]]; then
- rm -f "${queue[@]}"
- fi
-}
-
-_LTPRUNE_ECLASS=1
-fi #_LTPRUNE_ECLASS
diff --git a/eclass/mount-boot-utils.eclass b/eclass/mount-boot-utils.eclass
index 39f8e94b84ec..e24b4e0c0826 100644
--- a/eclass/mount-boot-utils.eclass
+++ b/eclass/mount-boot-utils.eclass
@@ -4,7 +4,7 @@
# @ECLASS: mount-boot-utils.eclass
# @MAINTAINER:
# base-system@gentoo.org
-# @SUPPORTED_EAPIS: 6 7 8
+# @SUPPORTED_EAPIS: 7 8
# @BLURB: functions for packages that install files into /boot or the ESP
# @DESCRIPTION:
# This eclass is really only useful for bootloaders and kernel installation.
diff --git a/eclass/mount-boot.eclass b/eclass/mount-boot.eclass
index ab02b39d6141..ce17026ffd2b 100644
--- a/eclass/mount-boot.eclass
+++ b/eclass/mount-boot.eclass
@@ -4,7 +4,7 @@
# @ECLASS: mount-boot.eclass
# @MAINTAINER:
# base-system@gentoo.org
-# @SUPPORTED_EAPIS: 6 7 8
+# @SUPPORTED_EAPIS: 7 8
# @BLURB: eclass for packages that install files into /boot or the ESP
# @DESCRIPTION:
# This eclass is really only useful for bootloaders and kernel installation.
diff --git a/eclass/python-any-r1.eclass b/eclass/python-any-r1.eclass
index a21df8e89498..c1f27cfbac0d 100644
--- a/eclass/python-any-r1.eclass
+++ b/eclass/python-any-r1.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2023 Gentoo Authors
+# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: python-any-r1.eclass
@@ -272,6 +272,7 @@ python_gen_any_dep() {
# This function will call python_check_deps() if defined.
python_setup() {
debug-print-function ${FUNCNAME} "${@}"
+ _python_sanity_checks
# support developer override
if [[ ${PYTHON_COMPAT_OVERRIDE} ]]; then
diff --git a/eclass/python-r1.eclass b/eclass/python-r1.eclass
index c5fa6770558f..adf87c2c52f7 100644
--- a/eclass/python-r1.eclass
+++ b/eclass/python-r1.eclass
@@ -617,6 +617,7 @@ _python_multibuild_wrapper() {
# locally, and the former two are exported to the command environment.
python_foreach_impl() {
debug-print-function ${FUNCNAME} "${@}"
+ _python_sanity_checks
if [[ ${_DISTUTILS_R1_ECLASS} ]]; then
if has "${EBUILD_PHASE}" prepare configure compile test install &&
@@ -708,6 +709,7 @@ python_foreach_impl() {
# @CODE
python_setup() {
debug-print-function ${FUNCNAME} "${@}"
+ _python_sanity_checks
local has_check_deps
declare -f python_check_deps >/dev/null && has_check_deps=1
diff --git a/eclass/python-single-r1.eclass b/eclass/python-single-r1.eclass
index 4d61f08c06f0..481b6cf91ba0 100644
--- a/eclass/python-single-r1.eclass
+++ b/eclass/python-single-r1.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2022 Gentoo Authors
+# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: python-single-r1.eclass
@@ -393,6 +393,7 @@ python_gen_impl_dep() {
# the Python build environment up for it.
python_setup() {
debug-print-function ${FUNCNAME} "${@}"
+ _python_sanity_checks
unset EPYTHON
diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
index c47565fa1db2..45d3da6bb98c 100644
--- a/eclass/python-utils-r1.eclass
+++ b/eclass/python-utils-r1.eclass
@@ -332,6 +332,17 @@ _python_export() {
export PYTHON=${BROOT-${EPREFIX}}/usr/bin/${impl}
debug-print "${FUNCNAME}: PYTHON = ${PYTHON}"
;;
+ PYTHON_STDLIB)
+ [[ -n ${PYTHON} ]] || die "PYTHON needs to be set for ${var} to be exported, or requested before it"
+ PYTHON_STDLIB=$(
+ "${PYTHON}" - "${EPREFIX}/usr" <<-EOF || die
+ import sys, sysconfig
+ print(sysconfig.get_path("stdlib", vars={"installed_base": sys.argv[1]}))
+ EOF
+ )
+ export PYTHON_STDLIB
+ debug-print "${FUNCNAME}: PYTHON_STDLIB = ${PYTHON_STDLIB}"
+ ;;
PYTHON_SITEDIR)
[[ -n ${PYTHON} ]] || die "PYTHON needs to be set for ${var} to be exported, or requested before it"
PYTHON_SITEDIR=$(
@@ -466,6 +477,18 @@ _python_export() {
done
}
+# @FUNCTION: python_get_stdlib
+# @USAGE: [<impl>]
+# @DESCRIPTION:
+# Obtain and print the 'stdlib' path for the given implementation. If no
+# implementation is provided, ${EPYTHON} will be used.
+python_get_stdlib() {
+ debug-print-function ${FUNCNAME} "${@}"
+
+ _python_export "${@}" PYTHON_STDLIB
+ echo "${PYTHON_STDLIB}"
+}
+
# @FUNCTION: python_get_sitedir
# @USAGE: [<impl>]
# @DESCRIPTION:
@@ -1544,4 +1567,38 @@ python_has_version() {
return 0
}
+# @FUNCTION: _python_sanity_checks
+# @INTERNAL
+# @DESCRIPTION:
+# Perform additional environment sanity checks.
+_python_sanity_checks() {
+ debug-print-function ${FUNCNAME} "${@}"
+
+ [[ ${_PYTHON_SANITY_CHECKED} ]] && return
+
+ if [[ -v PYTHONPATH ]]; then
+ local x paths=()
+ mapfile -d ':' -t paths <<<${PYTHONPATH}
+
+ for x in "${paths[@]}"; do
+ if [[ ${x} != /* ]]; then
+ eerror "Relative path found in PYTHONPATH:"
+ eerror
+ eerror " PYTHONPATH=${PYTHONPATH@Q}"
+ eerror
+ eerror "This is guaranteed to cause random breakage. Please make sure that"
+ eerror "your PYTHONPATH contains absolute paths only (and only if necessary)."
+ eerror "Note that empty values (including ':' at either end and an empty"
+ eerror "PYTHONPATH) count as the current directory. If no PYTHONPATH"
+ eerror "is intended, it needs to be unset instead."
+ die "Relative paths in PYTHONPATH are forbidden: ${x@Q}"
+ fi
+ done
+
+ elog "PYTHONPATH=${PYTHONPATH@Q}"
+ fi
+
+ _PYTHON_SANITY_CHECKED=1
+}
+
fi
diff --git a/eclass/rebar-utils.eclass b/eclass/rebar-utils.eclass
new file mode 100644
index 000000000000..5657908eb8e9
--- /dev/null
+++ b/eclass/rebar-utils.eclass
@@ -0,0 +1,160 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+# @ECLASS: rebar-utils.eclass
+# @MAINTAINER:
+# Florian Schmaus <flow@gentoo.org>
+# @AUTHOR:
+# Amadeusz Żołnowski <aidecoe@gentoo.org>
+# @SUPPORTED_EAPIS: 7 8
+# @BLURB: Auxiliary functions for using dev-util/rebar.
+# @DESCRIPTION:
+# This eclass provides a set of axiliary functions commonly needed
+# when building Erlang/OTP packages with rebar.
+
+case ${EAPI} in
+ 7|8) ;;
+ *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
+esac
+
+if [[ -z ${_REBAR_UTILS_ECLASS} ]]; then
+_REBAR_UTILS_ECLASS=1
+
+# @ECLASS_VARIABLE: REBAR_APP_SRC
+# @DESCRIPTION:
+# Relative path to .app.src description file. Defaults to
+# 'src/${PN}.app.src'.
+: "${REBAR_APP_SRC:=src/${PN}.app.src}"
+
+# @FUNCTION: get_erl_libs
+# @RETURN: the path to Erlang lib directory
+# @DESCRIPTION:
+# Get the full path without EPREFIX to Erlang lib directory.
+get_erl_libs() {
+ echo "/usr/$(get_libdir)/erlang/lib"
+}
+
+# @FUNCTION: _rebar_find_dep
+# @INTERNAL
+# @USAGE: <project_name>
+# @RETURN: 0 success, 1 dependency not found, 2 multiple versions found
+# @DESCRIPTION:
+# Find a Erlang package/project by name in Erlang lib directory. Project
+# directory is usually suffixed with version. It is matched to '<project_name>'
+# or '<project_name>-*'.
+_rebar_find_dep() {
+ local pn="${1}"
+ local p
+ local result
+
+ pushd "${EPREFIX}$(get_erl_libs)" >/dev/null || return 1
+ for p in ${pn} ${pn}-*; do
+ if [[ -d ${p} ]]; then
+ # Ensure there's at most one matching.
+ [[ ${result} ]] && return 2
+ result="${p}"
+ fi
+ done
+ popd >/dev/null || die
+
+ [[ ${result} ]] || return 1
+ echo "${result}"
+}
+
+# @FUNCTION: rebar_disable_coverage
+# @USAGE: [<rebar_config>]
+# @DESCRIPTION:
+# Disable coverage in rebar.config. This is a workaround for failing coverage.
+# Coverage is not relevant in this context, so there's no harm to disable it,
+# although the issue should be fixed.
+rebar_disable_coverage() {
+ debug-print-function ${FUNCNAME} "${@}"
+
+ local rebar_config="${1:-rebar.config}"
+
+ sed -e 's/{cover_enabled, true}/{cover_enabled, false}/' \
+ -i "${rebar_config}" \
+ || die "failed to disable coverage in ${rebar_config}"
+}
+
+# @FUNCTION: rebar_fix_include_path
+# @USAGE: <project_name> [<rebar_config>]
+# @DESCRIPTION:
+# Fix path in rebar.config to 'include' directory of dependent project/package,
+# so it points to installation in system Erlang lib rather than relative 'deps'
+# directory.
+#
+# <rebar_config> is optional. Default is 'rebar.config'.
+#
+# The function dies on failure.
+rebar_fix_include_path() {
+ debug-print-function ${FUNCNAME} "${@}"
+
+ local pn="${1}"
+ local rebar_config="${2:-rebar.config}"
+ local erl_libs="${EPREFIX}$(get_erl_libs)"
+ local p
+
+ p="$(_rebar_find_dep "${pn}")" \
+ || die "failed to unambiguously resolve dependency of '${pn}'"
+
+ gawk -i inplace \
+ -v erl_libs="${erl_libs}" -v pn="${pn}" -v p="${p}" '
+/^{[[:space:]]*erl_opts[[:space:]]*,/, /}[[:space:]]*\.$/ {
+ pattern = "\"(./)?deps/" pn "/include\"";
+ if (match($0, "{i,[[:space:]]*" pattern "[[:space:]]*}")) {
+ sub(pattern, "\"" erl_libs "/" p "/include\"");
+ }
+ print $0;
+ next;
+}
+1
+' "${rebar_config}" || die "failed to fix include paths in ${rebar_config} for '${pn}'"
+}
+
+# @FUNCTION: rebar_remove_deps
+# @USAGE: [<rebar_config>]
+# @DESCRIPTION:
+# Remove dependencies list from rebar.config and deceive build rules that any
+# dependencies are already fetched and built. Otherwise rebar tries to fetch
+# dependencies and compile them.
+#
+# <rebar_config> is optional. Default is 'rebar.config'.
+#
+# The function dies on failure.
+rebar_remove_deps() {
+ debug-print-function ${FUNCNAME} "${@}"
+
+ local rebar_config="${1:-rebar.config}"
+
+ mkdir -p "${S}/deps" && :>"${S}/deps/.got" && :>"${S}/deps/.built" || die
+ gawk -i inplace '
+/^{[[:space:]]*deps[[:space:]]*,/, /}[[:space:]]*\.$/ {
+ if ($0 ~ /}[[:space:]]*\.$/) {
+ print "{deps, []}.";
+ }
+ next;
+}
+1
+' "${rebar_config}" || die "failed to remove deps from ${rebar_config}"
+}
+
+# @FUNCTION: rebar_set_vsn
+# @USAGE: [<version>]
+# @DESCRIPTION:
+# Set version in project description file if it's not set.
+#
+# <version> is optional. Default is PV stripped from version suffix.
+#
+# The function dies on failure.
+rebar_set_vsn() {
+ debug-print-function ${FUNCNAME} "${@}"
+
+ local version="${1:-${PV%_*}}"
+
+ sed -e "s/vsn, git/vsn, \"${version}\"/" \
+ -i "${S}/${REBAR_APP_SRC}" \
+ || die "failed to set version in src/${PN}.app.src"
+}
+
+fi
diff --git a/eclass/rebar.eclass b/eclass/rebar.eclass
index 97638c761814..1e4e845a9adb 100644
--- a/eclass/rebar.eclass
+++ b/eclass/rebar.eclass
@@ -7,6 +7,7 @@
# @AUTHOR:
# Amadeusz Żołnowski <aidecoe@gentoo.org>
# @SUPPORTED_EAPIS: 7 8
+# @PROVIDES: rebar-utils
# @BLURB: Build Erlang/OTP projects using dev-util/rebar.
# @DESCRIPTION:
# An eclass providing functions to build Erlang/OTP projects using
@@ -27,6 +28,8 @@ esac
if [[ -z ${_REBAR_ECLASS} ]]; then
_REBAR_ECLASS=1
+inherit rebar-utils
+
RDEPEND="dev-lang/erlang:="
DEPEND="${RDEPEND}"
BDEPEND="
@@ -34,19 +37,6 @@ BDEPEND="
>=sys-apps/gawk-4.1
"
-# @ECLASS_VARIABLE: REBAR_APP_SRC
-# @DESCRIPTION:
-# Relative path to .app.src description file.
-REBAR_APP_SRC="${REBAR_APP_SRC-src/${PN}.app.src}"
-
-# @FUNCTION: get_erl_libs
-# @RETURN: the path to Erlang lib directory
-# @DESCRIPTION:
-# Get the full path without EPREFIX to Erlang lib directory.
-get_erl_libs() {
- echo "/usr/$(get_libdir)/erlang/lib"
-}
-
# @FUNCTION: _rebar_find_dep
# @INTERNAL
# @USAGE: <project_name>
@@ -74,22 +64,6 @@ _rebar_find_dep() {
echo "${result}"
}
-# @FUNCTION: rebar_disable_coverage
-# @USAGE: [<rebar_config>]
-# @DESCRIPTION:
-# Disable coverage in rebar.config. This is a workaround for failing coverage.
-# Coverage is not relevant in this context, so there's no harm to disable it,
-# although the issue should be fixed.
-rebar_disable_coverage() {
- debug-print-function ${FUNCNAME} "${@}"
-
- local rebar_config="${1:-rebar.config}"
-
- sed -e 's/{cover_enabled, true}/{cover_enabled, false}/' \
- -i "${rebar_config}" \
- || die "failed to disable coverage in ${rebar_config}"
-}
-
# @FUNCTION: erebar
# @USAGE: <targets>
# @DESCRIPTION:
@@ -105,86 +79,6 @@ erebar() {
rebar -v skip_deps=true "$@" || die -n "rebar $@ failed"
}
-# @FUNCTION: rebar_fix_include_path
-# @USAGE: <project_name> [<rebar_config>]
-# @DESCRIPTION:
-# Fix path in rebar.config to 'include' directory of dependent project/package,
-# so it points to installation in system Erlang lib rather than relative 'deps'
-# directory.
-#
-# <rebar_config> is optional. Default is 'rebar.config'.
-#
-# The function dies on failure.
-rebar_fix_include_path() {
- debug-print-function ${FUNCNAME} "${@}"
-
- local pn="${1}"
- local rebar_config="${2:-rebar.config}"
- local erl_libs="${EPREFIX}$(get_erl_libs)"
- local p
-
- p="$(_rebar_find_dep "${pn}")" \
- || die "failed to unambiguously resolve dependency of '${pn}'"
-
- gawk -i inplace \
- -v erl_libs="${erl_libs}" -v pn="${pn}" -v p="${p}" '
-/^{[[:space:]]*erl_opts[[:space:]]*,/, /}[[:space:]]*\.$/ {
- pattern = "\"(./)?deps/" pn "/include\"";
- if (match($0, "{i,[[:space:]]*" pattern "[[:space:]]*}")) {
- sub(pattern, "\"" erl_libs "/" p "/include\"");
- }
- print $0;
- next;
-}
-1
-' "${rebar_config}" || die "failed to fix include paths in ${rebar_config} for '${pn}'"
-}
-
-# @FUNCTION: rebar_remove_deps
-# @USAGE: [<rebar_config>]
-# @DESCRIPTION:
-# Remove dependencies list from rebar.config and deceive build rules that any
-# dependencies are already fetched and built. Otherwise rebar tries to fetch
-# dependencies and compile them.
-#
-# <rebar_config> is optional. Default is 'rebar.config'.
-#
-# The function dies on failure.
-rebar_remove_deps() {
- debug-print-function ${FUNCNAME} "${@}"
-
- local rebar_config="${1:-rebar.config}"
-
- mkdir -p "${S}/deps" && :>"${S}/deps/.got" && :>"${S}/deps/.built" || die
- gawk -i inplace '
-/^{[[:space:]]*deps[[:space:]]*,/, /}[[:space:]]*\.$/ {
- if ($0 ~ /}[[:space:]]*\.$/) {
- print "{deps, []}.";
- }
- next;
-}
-1
-' "${rebar_config}" || die "failed to remove deps from ${rebar_config}"
-}
-
-# @FUNCTION: rebar_set_vsn
-# @USAGE: [<version>]
-# @DESCRIPTION:
-# Set version in project description file if it's not set.
-#
-# <version> is optional. Default is PV stripped from version suffix.
-#
-# The function dies on failure.
-rebar_set_vsn() {
- debug-print-function ${FUNCNAME} "${@}"
-
- local version="${1:-${PV%_*}}"
-
- sed -e "s/vsn, git/vsn, \"${version}\"/" \
- -i "${S}/${REBAR_APP_SRC}" \
- || die "failed to set version in src/${PN}.app.src"
-}
-
# @FUNCTION: rebar_src_prepare
# @DESCRIPTION:
# Prevent rebar from fetching and compiling dependencies. Set version in
diff --git a/eclass/rebar3.eclass b/eclass/rebar3.eclass
new file mode 100644
index 000000000000..f6383b9c8cdd
--- /dev/null
+++ b/eclass/rebar3.eclass
@@ -0,0 +1,194 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+# @ECLASS: rebar3.eclass
+# @MAINTAINER:
+# Florian Schmaus <flow@gentoo.org>
+# @AUTHOR:
+# Amadeusz Żołnowski <aidecoe@gentoo.org>
+# Anna (cybertailor) Vyalkova <cyber+gentoo@sysrq.in>
+# @SUPPORTED_EAPIS: 8
+# @PROVIDES: rebar-utils
+# @BLURB: Build Erlang/OTP projects using dev-util/rebar:3.
+# @DESCRIPTION:
+# An eclass providing functions to build Erlang/OTP projects using
+# dev-util/rebar:3.
+#
+# rebar is a tool which tries to resolve dependencies itself which is by
+# cloning remote git repositories. Dependent projects are usually expected to
+# be in sub-directory 'deps' rather than looking at system Erlang lib
+# directory. Projects relying on rebar usually don't have 'install' make
+# targets. The eclass workarounds some of these problems. It handles
+# installation in a generic way for Erlang/OTP structured projects.
+
+case ${EAPI} in
+ 8) ;;
+ *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
+esac
+
+if [[ -z ${_REBAR3_ECLASS} ]]; then
+_REBAR3_ECLASS=1
+
+inherit edo rebar-utils
+
+RDEPEND="dev-lang/erlang:="
+DEPEND="${RDEPEND}"
+BDEPEND="
+ dev-util/rebar:3
+ >=sys-apps/gawk-4.1
+"
+
+# @ECLASS_VARIABLE: REBAR_PROFILE
+# @DESCRIPTION:
+# Rebar profile to use. Defaults to
+# 'default'.
+: "${REBAR_PROFILE:=default}"
+
+# @FUNCTION: _rebar_find_dep
+# @INTERNAL
+# @USAGE: <project_name>
+# @RETURN: 0 success, 1 dependency not found, 2 multiple versions found
+# @DESCRIPTION:
+# Find a Erlang package/project by name in Erlang lib directory. Project
+# directory is usually suffixed with version. It is matched to '<project_name>'
+# or '<project_name>-*'.
+_rebar_find_dep() {
+ local pn="${1}"
+ local p
+ local result
+
+ pushd "${EPREFIX}$(get_erl_libs)" >/dev/null || return 1
+ for p in ${pn} ${pn}-*; do
+ if [[ -d ${p} ]]; then
+ # Ensure there's at most one matching.
+ [[ ${result} ]] && return 2
+ result="${p}"
+ fi
+ done
+ popd >/dev/null || die
+
+ [[ ${result} ]] || return 1
+ echo "${result}"
+}
+
+# @FUNCTION: erebar3
+# @USAGE: <targets>
+# @DESCRIPTION:
+# Run rebar with verbose flag. Die on failure.
+erebar3() {
+ debug-print-function ${FUNCNAME} "${@}"
+
+ (( $# > 0 )) || die "${FUNCNAME}: at least one target is required"
+
+ case ${1} in
+ eunit|ct)
+ local -x ERL_LIBS="." ;;
+ *)
+ local -x ERL_LIBS="${EPREFIX}$(get_erl_libs)" ;;
+ esac
+
+ local -x HEX_OFFLINE=true
+ edo rebar3 "$@"
+}
+
+# @FUNCTION: rebar3_src_prepare
+# @DESCRIPTION:
+# Prevent rebar3 from fetching and compiling dependencies. Set version in
+# project description file if it's not set.
+#
+# Existence of rebar.config is optional, but file description file must exist
+# at 'src/${PN}.app.src'.
+rebar3_src_prepare() {
+ debug-print-function ${FUNCNAME} "${@}"
+
+ default
+ rebar_set_vsn
+
+ if [[ -f rebar.lock ]]; then
+ rm rebar.lock || die
+ fi
+
+ if [[ -f rebar.config ]]; then
+ rebar_disable_coverage
+ rebar_remove_deps
+ fi
+}
+
+# @FUNCTION: rebar3_src_configure
+# @DESCRIPTION:
+# Configure with ERL_LIBS set.
+rebar3_src_configure() {
+ debug-print-function ${FUNCNAME} "${@}"
+
+ local -x ERL_LIBS="${EPREFIX}$(get_erl_libs)"
+ default
+}
+
+# @FUNCTION: rebar3_src_compile
+# @DESCRIPTION:
+# Compile project with rebar3.
+rebar3_src_compile() {
+ debug-print-function ${FUNCNAME} "${@}"
+
+ erebar3 as "${REBAR_PROFILE}" release --all
+}
+
+# @FUNCTION: rebar3_src_test
+# @DESCRIPTION:
+# Run unit tests.
+rebar3_src_test() {
+ debug-print-function ${FUNCNAME} "${@}"
+
+ erebar3 eunit -v
+}
+
+# @FUNCTION: rebar3_install_lib
+# @USAGE: <dir>
+# @DESCRIPTION:
+# Install BEAM files, include headers and native libraries.
+#
+# Function expects that project conforms to Erlang/OTP structure.
+rebar3_install_lib() {
+ debug-print-function ${FUNCNAME} "${@}"
+
+ local dest="$(get_erl_libs)/${P}"
+ insinto "${dest}"
+
+ pushd "${1?}" >/dev/null || die
+ for dir in ebin include priv; do
+ if [[ -d ${dir} && ! -L ${dir} ]]; then
+ doins -r "${dir}"
+ fi
+ done
+ popd >/dev/null || die
+}
+
+# @FUNCTION: rebar3_src_install
+# @DESCRIPTION:
+# Install built release or library.
+#
+# Function expects that project conforms to Erlang/OTP structure.
+rebar3_src_install() {
+ debug-print-function ${FUNCNAME} "${@}"
+
+ pushd "_build/${REBAR_PROFILE}" >/dev/null || die
+ if [[ -d rel/${PN} ]]; then
+ if ! declare -f rebar3_install_release >/dev/null; then
+ die "${FUNCNAME}: a custom function named 'rebar3_install_release' is required to install a release"
+ fi
+ pushd rel/${PN} >/dev/null || die
+ rebar3_install_release || die
+ popd >/dev/null || die
+ elif [[ -d lib/${PN} ]]; then
+ rebar3_install_lib lib/${PN}
+ else
+ die "No releases or libraries to install"
+ fi
+ popd >/dev/null || die
+
+ einstalldocs
+}
+
+fi
+
+EXPORT_FUNCTIONS src_prepare src_compile src_test src_install
diff --git a/eclass/rust-toolchain.eclass b/eclass/rust-toolchain.eclass
index 111aece796ce..89bca88b9e6b 100644
--- a/eclass/rust-toolchain.eclass
+++ b/eclass/rust-toolchain.eclass
@@ -31,26 +31,30 @@ esac
rust_abi() {
local CTARGET=${1:-${CHOST}}
case ${CTARGET%%*-} in
- aarch64*gnu) echo aarch64-unknown-linux-gnu;;
- aarch64*musl) echo aarch64-unknown-linux-musl;;
- armv6j*h*) echo arm-unknown-linux-gnueabihf;;
- armv6j*s*) echo arm-unknown-linux-gnueabi;;
- armv7a*h*) echo armv7-unknown-linux-gnueabihf;;
- i?86*) echo i686-unknown-linux-gnu;;
- loongarch64*) echo loongarch64-unknown-linux-gnu;;
- mips64el*) echo mips64el-unknown-linux-gnuabi64;;
- mips64*) echo mips64-unknown-linux-gnuabi64;;
- mipsel*) echo mipsel-unknown-linux-gnu;;
- mips*) echo mips-unknown-linux-gnu;;
- powerpc64le*) echo powerpc64le-unknown-linux-gnu;;
- powerpc64*) echo powerpc64-unknown-linux-gnu;;
- powerpc*) echo powerpc-unknown-linux-gnu;;
- riscv64*gnu) echo riscv64gc-unknown-linux-gnu;;
- riscv64*musl) echo riscv64gc-unknown-linux-musl;;
- s390x*) echo s390x-unknown-linux-gnu;;
- x86_64*gnu) echo x86_64-unknown-linux-gnu;;
- x86_64*musl) echo x86_64-unknown-linux-musl;;
- *) echo ${CTARGET};;
+ aarch64*gnu) echo aarch64-unknown-linux-gnu;;
+ aarch64*musl) echo aarch64-unknown-linux-musl;;
+ armv6j*h*) echo arm-unknown-linux-gnueabihf;;
+ armv6j*s*) echo arm-unknown-linux-gnueabi;;
+ armv7a*h*) echo armv7-unknown-linux-gnueabihf;;
+ i?86*) echo i686-unknown-linux-gnu;;
+ loongarch64*) echo loongarch64-unknown-linux-gnu;;
+ mips64el*) echo mips64el-unknown-linux-gnuabi64;;
+ mips64*) echo mips64-unknown-linux-gnuabi64;;
+ mipsel*) echo mipsel-unknown-linux-gnu;;
+ mips*) echo mips-unknown-linux-gnu;;
+ powerpc64le*gnu) echo powerpc64le-unknown-linux-gnu;;
+ powerpc64le*musl) echo powerpc64le-unknown-linux-musl;;
+ powerpc64*gnu) echo powerpc64-unknown-linux-gnu;;
+ powerpc64*musl) echo powerpc64-unknown-linux-musl;;
+ powerpc*gnu) echo powerpc-unknown-linux-gnu;;
+ powerpc*musl) echo powerpc-unknown-linux-musl;;
+ riscv64*gnu) echo riscv64gc-unknown-linux-gnu;;
+ riscv64*musl) echo riscv64gc-unknown-linux-musl;;
+ s390x*) echo s390x-unknown-linux-gnu;;
+ sparc64*gnu) echo sparc64-unknown-linux-gnu;;
+ x86_64*gnu) echo x86_64-unknown-linux-gnu;;
+ x86_64*musl) echo x86_64-unknown-linux-musl;;
+ *) echo ${CTARGET};;
esac
}
@@ -88,29 +92,27 @@ rust_arch_uri() {
rust_all_arch_uris()
{
echo "
- abi_x86_32? ( $(rust_arch_uri i686-unknown-linux-gnu "$@") )
+ abi_x86_32? ( elibc_glibc? ( $(rust_arch_uri i686-unknown-linux-gnu "$@") ) )
abi_x86_64? (
elibc_glibc? ( $(rust_arch_uri x86_64-unknown-linux-gnu "$@") )
elibc_musl? ( $(rust_arch_uri x86_64-unknown-linux-musl "$@") )
)
- arm? (
+ arm? ( elibc_glibc? (
$(rust_arch_uri arm-unknown-linux-gnueabi "$@")
$(rust_arch_uri arm-unknown-linux-gnueabihf "$@")
$(rust_arch_uri armv7-unknown-linux-gnueabihf "$@")
- )
+ ) )
arm64? (
elibc_glibc? ( $(rust_arch_uri aarch64-unknown-linux-gnu "$@") )
elibc_musl? ( $(rust_arch_uri aarch64-unknown-linux-musl "$@") )
)
- ppc? ( $(rust_arch_uri powerpc-unknown-linux-gnu "$@") )
+ ppc? ( elibc_glibc? ( $(rust_arch_uri powerpc-unknown-linux-gnu "$@") ) )
ppc64? (
- big-endian? ( $(rust_arch_uri powerpc64-unknown-linux-gnu "$@") )
- !big-endian? ( $(rust_arch_uri powerpc64le-unknown-linux-gnu "$@") )
- )
- riscv? (
- elibc_glibc? ( $(rust_arch_uri riscv64gc-unknown-linux-gnu "$@") )
+ big-endian? ( elibc_glibc? ( $(rust_arch_uri powerpc64-unknown-linux-gnu "$@") ) )
+ !big-endian? ( elibc_glibc? ( $(rust_arch_uri powerpc64le-unknown-linux-gnu "$@") ) )
)
- s390? ( $(rust_arch_uri s390x-unknown-linux-gnu "$@") )
+ riscv? ( elibc_glibc? ( $(rust_arch_uri riscv64gc-unknown-linux-gnu "$@") ) )
+ s390? ( elibc_glibc? ( $(rust_arch_uri s390x-unknown-linux-gnu "$@") ) )
"
# Upstream did not gain support for loong until v1.71.0.
@@ -119,7 +121,7 @@ rust_all_arch_uris()
local arg_version="${1##*-}"
arg_version="${arg_version:-$PV}"
if ver_test "${arg_version}" -ge 1.71.0; then
- echo "loong? ( $(rust_arch_uri loongarch64-unknown-linux-gnu "$@") )"
+ echo "loong? ( elibc_glibc? ( $(rust_arch_uri loongarch64-unknown-linux-gnu "$@") ) )"
fi
# until https://github.com/rust-lang/rust/pull/113274 is resolved, there
diff --git a/eclass/savedconfig.eclass b/eclass/savedconfig.eclass
index cc5748543078..65a1f3bfd800 100644
--- a/eclass/savedconfig.eclass
+++ b/eclass/savedconfig.eclass
@@ -1,10 +1,10 @@
-# Copyright 1999-2023 Gentoo Authors
+# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: savedconfig.eclass
# @MAINTAINER:
# base-system@gentoo.org
-# @SUPPORTED_EAPIS: 6 7 8
+# @SUPPORTED_EAPIS: 7 8
# @BLURB: common API for saving/restoring complex configuration files
# @DESCRIPTION:
# It is not uncommon to come across a package which has a very fine
@@ -31,7 +31,7 @@
# build.
case ${EAPI} in
- 6|7|8) ;;
+ 7|8) ;;
*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
esac
@@ -60,12 +60,12 @@ save_config() {
if [[ $# -eq 1 && -f $1 ]] ; then
# Just one file, so have the ${configfile} be that config file
dodir "${configfile%/*}"
- cp "$@" "${ED%/}/${configfile}" || die "failed to save $*"
+ cp "$@" "${ED}/${configfile}" || die "failed to save $*"
else
# A dir, or multiple files, so have the ${configfile} be a dir
# with all the saved stuff below it
dodir "${configfile}"
- treecopy "$@" "${ED%/}/${configfile}" || die "failed to save $*"
+ treecopy "$@" "${ED}/${configfile}" || die "failed to save $*"
fi
elog "Your configuration for ${CATEGORY}/${PF} has been saved in "
@@ -150,7 +150,7 @@ savedconfig_pkg_postinst() {
# are worse :/.
if use savedconfig ; then
- find "${EROOT%/}/etc/portage/savedconfig/${CATEGORY}/${PF}" \
+ find "${EROOT}/etc/portage/savedconfig/${CATEGORY}/${PF}" \
-exec touch {} + 2>/dev/null
fi
}
diff --git a/eclass/secureboot.eclass b/eclass/secureboot.eclass
index a9ba514cb7a0..4459b0341845 100644
--- a/eclass/secureboot.eclass
+++ b/eclass/secureboot.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2023 Gentoo Authors
+# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: secureboot.eclass
@@ -44,7 +44,12 @@ case ${EAPI} in
esac
IUSE="secureboot"
-BDEPEND="secureboot? ( app-crypt/sbsigntools )"
+BDEPEND="
+ secureboot? (
+ app-crypt/sbsigntools
+ dev-libs/openssl
+ )
+"
# @ECLASS_VARIABLE: SECUREBOOT_SIGN_KEY
# @USER_VARIABLE
@@ -75,12 +80,19 @@ _secureboot_die_if_unset() {
if [[ -z ${SECUREBOOT_SIGN_KEY} || -z ${SECUREBOOT_SIGN_CERT} ]]; then
die "USE=secureboot enabled but SECUREBOOT_SIGN_KEY and/or SECUREBOOT_SIGN_CERT not set."
fi
- if [[ ! ${SECUREBOOT_SIGN_KEY} == pkcs11:* && ! -r ${SECUREBOOT_SIGN_KEY} ]]; then
- die "SECUREBOOT_SIGN_KEY=${SECUREBOOT_SIGN_KEY} not found or not readable!"
- fi
- if [[ ! -r ${SECUREBOOT_SIGN_CERT} ]]; then
- die "SECUREBOOT_SIGN_CERT=${SECUREBOOT_SIGN_CERT} not found or not readable!"
+
+ # Sanity check: fail early if key/cert in DER format or does not exist
+ local openssl_args=(
+ -inform PEM -in "${SECUREBOOT_SIGN_CERT}"
+ -noout -nocert
+ )
+ if [[ ${SECUREBOOT_SIGN_KEY} == pkcs11:* ]]; then
+ openssl_args+=( -engine pkcs11 -keyform ENGINE -key "${SECUREBOOT_SIGN_KEY}" )
+ else
+ openssl_args+=( -keyform PEM -key "${SECUREBOOT_SIGN_KEY}" )
fi
+ openssl x509 "${openssl_args[@]}" ||
+ die "Secure Boot signing certificate or key not found or not PEM format."
}
# @FUNCTION: secureboot_pkg_setup
diff --git a/eclass/tests/Makefile b/eclass/tests/Makefile
index 99e824dea86d..23027aed6b66 100644
--- a/eclass/tests/Makefile
+++ b/eclass/tests/Makefile
@@ -1,5 +1,5 @@
SH_FILES := $(wildcard *.sh)
-TEST_FILES := $(filter-out tests-common.sh version-funcs.sh, $(SH_FILES))
+TEST_FILES := $(filter-out tests-common.sh, $(SH_FILES))
TEST_OK_FILES := $(patsubst %.sh, .%.sh.ok,$ $(TEST_FILES))
# !!! _All_ recipe lines for each target will be provided to a single
diff --git a/eclass/tests/dist-kernel-utils.sh b/eclass/tests/dist-kernel-utils.sh
index 50ba001f8e9c..28c8f7213a53 100755
--- a/eclass/tests/dist-kernel-utils.sh
+++ b/eclass/tests/dist-kernel-utils.sh
@@ -20,9 +20,68 @@ test_PV_to_KV() {
tend $?
}
+test_compressed_module_cleanup() {
+ mkdir -p "${tmpdir}/source" || die
+ pushd "${tmpdir}" >/dev/null || die
+
+ local module option fail=0
+ for option in NONE GZIP XZ ZSTD; do
+ tbegin "CONFIG_MODULE_COMPRESS_${option}"
+ echo "CONFIG_MODULE_COMPRESS_${option}=y" > source/.config
+
+ touch a.ko b.ko.gz c.ko.xz d.ko.gz e.ko f.ko.xz || die
+ # ensure some files are older
+ touch -d "2 hours ago" d.ko e.ko.xz f.ko.gz || die
+
+ IUSE=modules-compress dist-kernel_compressed_module_cleanup .
+
+ local to_keep=( a.ko b.ko.gz c.ko.xz )
+ local to_remove=()
+
+ case ${option} in
+ NONE)
+ to_keep+=( d.ko e.ko f.ko.xz )
+ to_remove+=( d.ko.gz e.ko.xz f.ko.gz )
+ ;;
+ GZIP)
+ to_keep+=( d.ko.gz e.ko f.ko.gz )
+ to_remove+=( d.ko e.ko.xz f.ko.xz )
+ ;;
+ XZ)
+ to_keep+=( d.ko.gz e.ko.xz f.ko.xz )
+ to_remove+=( d.ko e.ko f.ko.gz )
+ ;;
+ ZSTD)
+ to_keep+=( d.ko.gz e.ko f.ko.xz )
+ to_remove+=( d.ko e.ko.xz f.ko.gz )
+ ;;
+ esac
+
+ for module in "${to_keep[@]}"; do
+ if [[ ! -f ${module} ]]; then
+ eerror "Module ${module} was removed"
+ fail=1
+ fi
+ done
+
+ for module in "${to_remove[@]}"; do
+ if [[ -f ${module} ]]; then
+ eerror "Module ${module} was not removed"
+ fail=1
+ fi
+ done
+ tend ${fail}
+ done
+
+ popd >/dev/null || die
+}
+
+
test_PV_to_KV 6.0_rc1 6.0.0-rc1
test_PV_to_KV 6.0 6.0.0
test_PV_to_KV 6.0.1_rc1 6.0.1-rc1
test_PV_to_KV 6.0.1 6.0.1
+test_compressed_module_cleanup
+
texit
diff --git a/eclass/tests/eapi7-ver.sh b/eclass/tests/eapi7-ver.sh
deleted file mode 100755
index ee7e6d728ef7..000000000000
--- a/eclass/tests/eapi7-ver.sh
+++ /dev/null
@@ -1,174 +0,0 @@
-#!/bin/bash
-# Copyright 1999-2024 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-source tests-common.sh || exit
-source version-funcs.sh || exit
-
-teq() {
- local expected=${1}; shift
-
- tbegin "${*} -> ${expected}"
- local got=$("${@}")
- [[ ${got} == ${expected} ]]
- tend ${?} "returned: ${got}"
-}
-
-teqr() {
- local expected=$1; shift
- tbegin "$* -> ${expected}"
- "$@"
- local ret=$?
- [[ ${ret} -eq ${expected} ]]
- tend $? "returned: ${ret}"
-}
-
-txf() {
- tbegin "XFAIL: ${*}"
- local got=$("${@}" 2>&1)
- [[ ${got} == die:* ]]
- tend ${?} "function did not die"
-}
-
-teq 1 ver_cut 1 1.2.3
-teq 1 ver_cut 1-1 1.2.3
-teq 1.2 ver_cut 1-2 1.2.3
-teq 2.3 ver_cut 2- 1.2.3
-teq 1.2.3 ver_cut 1- 1.2.3
-teq 3b ver_cut 3-4 1.2.3b_alpha4
-teq alpha ver_cut 5 1.2.3b_alpha4
-teq 1.2 ver_cut 1-2 .1.2.3
-teq .1.2 ver_cut 0-2 .1.2.3
-teq 2.3 ver_cut 2-3 1.2.3.
-teq 2.3. ver_cut 2- 1.2.3.
-teq 2.3. ver_cut 2-4 1.2.3.
-
-teq 1-2.3 ver_rs 1 - 1.2.3
-teq 1.2-3 ver_rs 2 - 1.2.3
-teq 1-2-3.4 ver_rs 1-2 - 1.2.3.4
-teq 1.2-3-4 ver_rs 2- - 1.2.3.4
-teq 1.2.3 ver_rs 2 . 1.2-3
-teq 1.2.3.a ver_rs 3 . 1.2.3a
-teq 1.2-alpha-4 ver_rs 2-3 - 1.2_alpha4
-teq 1.23-b_alpha4 ver_rs 3 - 2 "" 1.2.3b_alpha4
-teq a1b_2-c-3-d4e5 ver_rs 3-5 _ 4-6 - a1b2c3d4e5
-teq .1-2.3 ver_rs 1 - .1.2.3
-teq -1.2.3 ver_rs 0 - .1.2.3
-
-# truncating range
-teq 1.2 ver_cut 0-2 1.2.3
-teq 2.3 ver_cut 2-5 1.2.3
-teq "" ver_cut 4 1.2.3
-teq "" ver_cut 0 1.2.3
-teq "" ver_cut 4- 1.2.3
-teq 1.2.3 ver_rs 0 - 1.2.3
-teq 1.2.3 ver_rs 3 . 1.2.3
-teq 1.2.3 ver_rs 3- . 1.2.3
-teq 1.2.3 ver_rs 3-5 . 1.2.3
-
-txf ver_cut foo 1.2.3
-txf ver_rs -3 _ a1b2c3d4e5
-txf ver_rs 5-3 _ a1b2c3d4e5
-
-# Tests from Portage's test_vercmp.py
-teqr 0 ver_test 6.0 -gt 5.0
-teqr 0 ver_test 5.0 -gt 5
-teqr 0 ver_test 1.0-r1 -gt 1.0-r0
-teqr 0 ver_test 999999999999999999 -gt 999999999999999998 # 18 digits
-teqr 0 ver_test 1.0.0 -gt 1.0
-teqr 0 ver_test 1.0.0 -gt 1.0b
-teqr 0 ver_test 1b -gt 1
-teqr 0 ver_test 1b_p1 -gt 1_p1
-teqr 0 ver_test 1.1b -gt 1.1
-teqr 0 ver_test 12.2.5 -gt 12.2b
-teqr 0 ver_test 4.0 -lt 5.0
-teqr 0 ver_test 5 -lt 5.0
-teqr 0 ver_test 1.0_pre2 -lt 1.0_p2
-teqr 0 ver_test 1.0_alpha2 -lt 1.0_p2
-teqr 0 ver_test 1.0_alpha1 -lt 1.0_beta1
-teqr 0 ver_test 1.0_beta3 -lt 1.0_rc3
-teqr 0 ver_test 1.001000000000000001 -lt 1.001000000000000002
-teqr 0 ver_test 1.00100000000 -lt 1.001000000000000001
-teqr 0 ver_test 999999999999999998 -lt 999999999999999999
-teqr 0 ver_test 1.01 -lt 1.1
-teqr 0 ver_test 1.0-r0 -lt 1.0-r1
-teqr 0 ver_test 1.0 -lt 1.0-r1
-teqr 0 ver_test 1.0 -lt 1.0.0
-teqr 0 ver_test 1.0b -lt 1.0.0
-teqr 0 ver_test 1_p1 -lt 1b_p1
-teqr 0 ver_test 1 -lt 1b
-teqr 0 ver_test 1.1 -lt 1.1b
-teqr 0 ver_test 12.2b -lt 12.2.5
-teqr 0 ver_test 4.0 -eq 4.0
-teqr 0 ver_test 1.0 -eq 1.0
-teqr 0 ver_test 1.0-r0 -eq 1.0
-teqr 0 ver_test 1.0 -eq 1.0-r0
-teqr 0 ver_test 1.0-r0 -eq 1.0-r0
-teqr 0 ver_test 1.0-r1 -eq 1.0-r1
-teqr 1 ver_test 1 -eq 2
-teqr 1 ver_test 1.0_alpha -eq 1.0_pre
-teqr 1 ver_test 1.0_beta -eq 1.0_alpha
-teqr 1 ver_test 1 -eq 0.0
-teqr 1 ver_test 1.0-r0 -eq 1.0-r1
-teqr 1 ver_test 1.0-r1 -eq 1.0-r0
-teqr 1 ver_test 1.0 -eq 1.0-r1
-teqr 1 ver_test 1.0-r1 -eq 1.0
-teqr 1 ver_test 1.0 -eq 1.0.0
-teqr 1 ver_test 1_p1 -eq 1b_p1
-teqr 1 ver_test 1b -eq 1
-teqr 1 ver_test 1.1b -eq 1.1
-teqr 1 ver_test 12.2b -eq 12.2
-
-# A subset of tests from Paludis
-teqr 0 ver_test 1.0_alpha -gt 1_alpha
-teqr 0 ver_test 1.0_alpha -gt 1
-teqr 0 ver_test 1.0_alpha -lt 1.0
-teqr 0 ver_test 1.2.0.0_alpha7-r4 -gt 1.2_alpha7-r4
-teqr 0 ver_test 0001 -eq 1
-teqr 0 ver_test 01 -eq 001
-teqr 0 ver_test 0001.1 -eq 1.1
-teqr 0 ver_test 01.01 -eq 1.01
-teqr 0 ver_test 1.010 -eq 1.01
-teqr 0 ver_test 1.00 -eq 1.0
-teqr 0 ver_test 1.0100 -eq 1.010
-teqr 0 ver_test 1-r00 -eq 1-r0
-
-# Additional tests
-teqr 0 ver_test 0_rc99 -lt 0
-teqr 0 ver_test 011 -eq 11
-teqr 0 ver_test 019 -eq 19
-teqr 0 ver_test 1.2 -eq 001.2
-teqr 0 ver_test 1.2 -gt 1.02
-teqr 0 ver_test 1.2a -lt 1.2b
-teqr 0 ver_test 1.2_pre1 -gt 1.2_pre1_beta2
-teqr 0 ver_test 1.2_pre1 -lt 1.2_pre1_p2
-teqr 0 ver_test 1.00 -lt 1.0.0
-teqr 0 ver_test 1.010 -eq 1.01
-teqr 0 ver_test 1.01 -lt 1.1
-teqr 0 ver_test 1.2_pre08-r09 -eq 1.2_pre8-r9
-teqr 0 ver_test 0 -lt 576460752303423488 # 2**59
-teqr 0 ver_test 0 -lt 9223372036854775808 # 2**63
-
-# Bad number or ordering of arguments
-txf ver_test 1
-txf ver_test 1 -lt 2 3
-txf ver_test -lt 1 2
-
-# Bad operators
-txf ver_test 1 "<" 2
-txf ver_test 1 lt 2
-txf ver_test 1 -foo 2
-
-# Malformed versions
-txf ver_test "" -ne 1
-txf ver_test 1. -ne 1
-txf ver_test 1ab -ne 1
-txf ver_test b -ne 1
-txf ver_test 1-r1_pre -ne 1
-txf ver_test 1-pre1 -ne 1
-txf ver_test 1_foo -ne 1
-txf ver_test 1_pre1.1 -ne 1
-txf ver_test 1-r1.0 -ne 1
-txf ver_test cvs.9999 -ne 9999
-
-texit
diff --git a/eclass/tests/llvm-r1.sh b/eclass/tests/llvm-r1.sh
index 9958f5bba420..8583fd6c799b 100755
--- a/eclass/tests/llvm-r1.sh
+++ b/eclass/tests/llvm-r1.sh
@@ -121,22 +121,30 @@ test_fix_tool_path() {
tend ${?}
}
+# full range
+test_globals '14 15 16 17 18 19' \
+ "+llvm_slot_18 llvm_slot_15 llvm_slot_16 llvm_slot_17 llvm_slot_19" \
+ "^^ ( llvm_slot_15 llvm_slot_16 llvm_slot_17 llvm_slot_18 llvm_slot_19 )" \
+ "llvm_slot_15(-)?,llvm_slot_16(-)?,llvm_slot_17(-)?,llvm_slot_18(-)?,llvm_slot_19(-)?"
test_globals '14 15 16 17 18' \
- "+llvm_slot_17 llvm_slot_15 llvm_slot_16 llvm_slot_18" \
+ "+llvm_slot_18 llvm_slot_15 llvm_slot_16 llvm_slot_17" \
"^^ ( llvm_slot_15 llvm_slot_16 llvm_slot_17 llvm_slot_18 )" \
"llvm_slot_15(-)?,llvm_slot_16(-)?,llvm_slot_17(-)?,llvm_slot_18(-)?"
+# older than stable
test_globals '14 15 16' \
"+llvm_slot_16 llvm_slot_15" \
"^^ ( llvm_slot_15 llvm_slot_16 )" \
"llvm_slot_15(-)?,llvm_slot_16(-)?"
-test_globals '15 18' \
- "+llvm_slot_15 llvm_slot_18" \
- "^^ ( llvm_slot_15 llvm_slot_18 )" \
- "llvm_slot_15(-)?,llvm_slot_18(-)?"
-test_globals '18' \
- "+llvm_slot_18" \
- "^^ ( llvm_slot_18 )" \
- "llvm_slot_18(-)?"
+# old + newer than current stable
+test_globals '15 19' \
+ "+llvm_slot_15 llvm_slot_19" \
+ "^^ ( llvm_slot_15 llvm_slot_19 )" \
+ "llvm_slot_15(-)?,llvm_slot_19(-)?"
+# newer than current stable
+test_globals '19' \
+ "+llvm_slot_19" \
+ "^^ ( llvm_slot_19 )" \
+ "llvm_slot_19(-)?"
LLVM_COMPAT=( {14..18} )
inherit llvm-r1
diff --git a/eclass/tests/tests-common.sh b/eclass/tests/tests-common.sh
index 45b1e20b933a..f4e18f38fee9 100644
--- a/eclass/tests/tests-common.sh
+++ b/eclass/tests/tests-common.sh
@@ -55,6 +55,8 @@ has() {
}
use() { has "$1" ${IUSE} ; }
+in_iuse() { use "$@" ; }
+
die() {
echo "die: $*" 1>&2
exit 1
diff --git a/eclass/tests/toolchain-funcs.sh b/eclass/tests/toolchain-funcs.sh
index ee10ddf50c1e..0d6745862148 100755
--- a/eclass/tests/toolchain-funcs.sh
+++ b/eclass/tests/toolchain-funcs.sh
@@ -210,6 +210,36 @@ if type -P gcc &>/dev/null; then
tbegin "tc-get-c-rtlib (gcc)"
[[ $(CC=gcc tc-get-c-rtlib) == libgcc ]]
tend $?
+
+ tbegin "tc-is-lto (gcc, -fno-lto)"
+ CC=gcc CFLAGS=-fno-lto tc-is-lto
+ [[ $? -eq 1 ]]
+ tend $?
+
+ tbegin "tc-is-lto (gcc, -flto)"
+ CC=gcc CFLAGS=-flto tc-is-lto
+ [[ $? -eq 0 ]]
+ tend $?
+
+ case $(gcc -dumpmachine) in
+ i*86*-gnu*|arm*-gnu*|powerpc-*-gnu)
+ tbegin "tc-has-64bit-time_t (_TIME_BITS=32)"
+ CC=gcc CFLAGS="-U_TIME_BITS -D_TIME_BITS=32" tc-has-64bit-time_t
+ [[ $? -eq 1 ]]
+ tend $?
+
+ tbegin "tc-has-64bit-time_t (_TIME_BITS=64)"
+ CC=gcc CFLAGS="-U_FILE_OFFSET_BITS -U_TIME_BITS -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64" tc-has-64bit-time_t
+ [[ $? -eq 0 ]]
+ tend $?
+ ;;
+ *)
+ tbegin "tc-has-64bit-time_t"
+ CC=gcc tc-has-64bit-time_t
+ [[ $? -eq 0 ]]
+ tend $?
+ ;;
+ esac
fi
if type -P clang &>/dev/null; then
@@ -232,6 +262,16 @@ if type -P clang &>/dev/null; then
[[ $(CC=clang CFLAGS="--rtlib=${rtlib}" tc-get-c-rtlib) == ${rtlib} ]]
tend $?
done
+
+ tbegin "tc-is-lto (clang, -fno-lto)"
+ CC=clang CFLAGS=-fno-lto tc-is-lto
+ [[ $? -eq 1 ]]
+ tend $?
+
+ tbegin "tc-is-lto (clang, -flto)"
+ CC=clang CFLAGS=-flto tc-is-lto
+ [[ $? -eq 0 ]]
+ tend $?
fi
texit
diff --git a/eclass/tests/version-funcs.sh b/eclass/tests/version-funcs.sh
index 6e83c01666f0..cb2a92342c65 100644..100755
--- a/eclass/tests/version-funcs.sh
+++ b/eclass/tests/version-funcs.sh
@@ -300,3 +300,177 @@ ver_test() {
_ver_compare "${va}" "${vb}"
test $? "${op}" 2
}
+
+# Return if we are being sourced
+return 2>/dev/null
+
+
+source tests-common.sh || exit
+
+teq() {
+ local expected=${1}; shift
+
+ tbegin "${*} -> ${expected}"
+ local got=$("${@}")
+ [[ ${got} == ${expected} ]]
+ tend ${?} "returned: ${got}"
+}
+
+teqr() {
+ local expected=$1; shift
+ tbegin "$* -> ${expected}"
+ "$@"
+ local ret=$?
+ [[ ${ret} -eq ${expected} ]]
+ tend $? "returned: ${ret}"
+}
+
+txf() {
+ tbegin "XFAIL: ${*}"
+ local got=$("${@}" 2>&1)
+ [[ ${got} == die:* ]]
+ tend ${?} "function did not die"
+}
+
+teq 1 ver_cut 1 1.2.3
+teq 1 ver_cut 1-1 1.2.3
+teq 1.2 ver_cut 1-2 1.2.3
+teq 2.3 ver_cut 2- 1.2.3
+teq 1.2.3 ver_cut 1- 1.2.3
+teq 3b ver_cut 3-4 1.2.3b_alpha4
+teq alpha ver_cut 5 1.2.3b_alpha4
+teq 1.2 ver_cut 1-2 .1.2.3
+teq .1.2 ver_cut 0-2 .1.2.3
+teq 2.3 ver_cut 2-3 1.2.3.
+teq 2.3. ver_cut 2- 1.2.3.
+teq 2.3. ver_cut 2-4 1.2.3.
+
+teq 1-2.3 ver_rs 1 - 1.2.3
+teq 1.2-3 ver_rs 2 - 1.2.3
+teq 1-2-3.4 ver_rs 1-2 - 1.2.3.4
+teq 1.2-3-4 ver_rs 2- - 1.2.3.4
+teq 1.2.3 ver_rs 2 . 1.2-3
+teq 1.2.3.a ver_rs 3 . 1.2.3a
+teq 1.2-alpha-4 ver_rs 2-3 - 1.2_alpha4
+teq 1.23-b_alpha4 ver_rs 3 - 2 "" 1.2.3b_alpha4
+teq a1b_2-c-3-d4e5 ver_rs 3-5 _ 4-6 - a1b2c3d4e5
+teq .1-2.3 ver_rs 1 - .1.2.3
+teq -1.2.3 ver_rs 0 - .1.2.3
+
+# truncating range
+teq 1.2 ver_cut 0-2 1.2.3
+teq 2.3 ver_cut 2-5 1.2.3
+teq "" ver_cut 4 1.2.3
+teq "" ver_cut 0 1.2.3
+teq "" ver_cut 4- 1.2.3
+teq 1.2.3 ver_rs 0 - 1.2.3
+teq 1.2.3 ver_rs 3 . 1.2.3
+teq 1.2.3 ver_rs 3- . 1.2.3
+teq 1.2.3 ver_rs 3-5 . 1.2.3
+
+txf ver_cut foo 1.2.3
+txf ver_rs -3 _ a1b2c3d4e5
+txf ver_rs 5-3 _ a1b2c3d4e5
+
+# Tests from Portage's test_vercmp.py
+teqr 0 ver_test 6.0 -gt 5.0
+teqr 0 ver_test 5.0 -gt 5
+teqr 0 ver_test 1.0-r1 -gt 1.0-r0
+teqr 0 ver_test 999999999999999999 -gt 999999999999999998 # 18 digits
+teqr 0 ver_test 1.0.0 -gt 1.0
+teqr 0 ver_test 1.0.0 -gt 1.0b
+teqr 0 ver_test 1b -gt 1
+teqr 0 ver_test 1b_p1 -gt 1_p1
+teqr 0 ver_test 1.1b -gt 1.1
+teqr 0 ver_test 12.2.5 -gt 12.2b
+teqr 0 ver_test 4.0 -lt 5.0
+teqr 0 ver_test 5 -lt 5.0
+teqr 0 ver_test 1.0_pre2 -lt 1.0_p2
+teqr 0 ver_test 1.0_alpha2 -lt 1.0_p2
+teqr 0 ver_test 1.0_alpha1 -lt 1.0_beta1
+teqr 0 ver_test 1.0_beta3 -lt 1.0_rc3
+teqr 0 ver_test 1.001000000000000001 -lt 1.001000000000000002
+teqr 0 ver_test 1.00100000000 -lt 1.001000000000000001
+teqr 0 ver_test 999999999999999998 -lt 999999999999999999
+teqr 0 ver_test 1.01 -lt 1.1
+teqr 0 ver_test 1.0-r0 -lt 1.0-r1
+teqr 0 ver_test 1.0 -lt 1.0-r1
+teqr 0 ver_test 1.0 -lt 1.0.0
+teqr 0 ver_test 1.0b -lt 1.0.0
+teqr 0 ver_test 1_p1 -lt 1b_p1
+teqr 0 ver_test 1 -lt 1b
+teqr 0 ver_test 1.1 -lt 1.1b
+teqr 0 ver_test 12.2b -lt 12.2.5
+teqr 0 ver_test 4.0 -eq 4.0
+teqr 0 ver_test 1.0 -eq 1.0
+teqr 0 ver_test 1.0-r0 -eq 1.0
+teqr 0 ver_test 1.0 -eq 1.0-r0
+teqr 0 ver_test 1.0-r0 -eq 1.0-r0
+teqr 0 ver_test 1.0-r1 -eq 1.0-r1
+teqr 1 ver_test 1 -eq 2
+teqr 1 ver_test 1.0_alpha -eq 1.0_pre
+teqr 1 ver_test 1.0_beta -eq 1.0_alpha
+teqr 1 ver_test 1 -eq 0.0
+teqr 1 ver_test 1.0-r0 -eq 1.0-r1
+teqr 1 ver_test 1.0-r1 -eq 1.0-r0
+teqr 1 ver_test 1.0 -eq 1.0-r1
+teqr 1 ver_test 1.0-r1 -eq 1.0
+teqr 1 ver_test 1.0 -eq 1.0.0
+teqr 1 ver_test 1_p1 -eq 1b_p1
+teqr 1 ver_test 1b -eq 1
+teqr 1 ver_test 1.1b -eq 1.1
+teqr 1 ver_test 12.2b -eq 12.2
+
+# A subset of tests from Paludis
+teqr 0 ver_test 1.0_alpha -gt 1_alpha
+teqr 0 ver_test 1.0_alpha -gt 1
+teqr 0 ver_test 1.0_alpha -lt 1.0
+teqr 0 ver_test 1.2.0.0_alpha7-r4 -gt 1.2_alpha7-r4
+teqr 0 ver_test 0001 -eq 1
+teqr 0 ver_test 01 -eq 001
+teqr 0 ver_test 0001.1 -eq 1.1
+teqr 0 ver_test 01.01 -eq 1.01
+teqr 0 ver_test 1.010 -eq 1.01
+teqr 0 ver_test 1.00 -eq 1.0
+teqr 0 ver_test 1.0100 -eq 1.010
+teqr 0 ver_test 1-r00 -eq 1-r0
+
+# Additional tests
+teqr 0 ver_test 0_rc99 -lt 0
+teqr 0 ver_test 011 -eq 11
+teqr 0 ver_test 019 -eq 19
+teqr 0 ver_test 1.2 -eq 001.2
+teqr 0 ver_test 1.2 -gt 1.02
+teqr 0 ver_test 1.2a -lt 1.2b
+teqr 0 ver_test 1.2_pre1 -gt 1.2_pre1_beta2
+teqr 0 ver_test 1.2_pre1 -lt 1.2_pre1_p2
+teqr 0 ver_test 1.00 -lt 1.0.0
+teqr 0 ver_test 1.010 -eq 1.01
+teqr 0 ver_test 1.01 -lt 1.1
+teqr 0 ver_test 1.2_pre08-r09 -eq 1.2_pre8-r9
+teqr 0 ver_test 0 -lt 576460752303423488 # 2**59
+teqr 0 ver_test 0 -lt 9223372036854775808 # 2**63
+
+# Bad number or ordering of arguments
+txf ver_test 1
+txf ver_test 1 -lt 2 3
+txf ver_test -lt 1 2
+
+# Bad operators
+txf ver_test 1 "<" 2
+txf ver_test 1 lt 2
+txf ver_test 1 -foo 2
+
+# Malformed versions
+txf ver_test "" -ne 1
+txf ver_test 1. -ne 1
+txf ver_test 1ab -ne 1
+txf ver_test b -ne 1
+txf ver_test 1-r1_pre -ne 1
+txf ver_test 1-pre1 -ne 1
+txf ver_test 1_foo -ne 1
+txf ver_test 1_pre1.1 -ne 1
+txf ver_test 1-r1.0 -ne 1
+txf ver_test cvs.9999 -ne 9999
+
+texit
diff --git a/eclass/texlive-common.eclass b/eclass/texlive-common.eclass
index 072581dde78e..36b90a327fde 100644
--- a/eclass/texlive-common.eclass
+++ b/eclass/texlive-common.eclass
@@ -42,6 +42,13 @@ _TEXLIVE_COMMON_ECLASS=1
# @CODE
: "${CTAN_MIRROR_URL:="https://mirrors.ctan.org"}"
+# @ECLASS_VARIABLE: TEXLIVE_SCRIPTS_W_FILE_EXT
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# If set, contains a space separated list of script names that should be
+# linked including their file extensions, i.e., without stripping
+# potentially existing filename extensions from the link's name.
+
# @FUNCTION: texlive-common_handle_config_files
# @DESCRIPTION:
# Has to be called in src_install after having installed the files in ${D}
@@ -160,8 +167,17 @@ etexlinks() {
# Called by app-text/epspdf and texlive-module.eclass.
dobin_texmf_scripts() {
while [[ ${#} -gt 0 ]] ; do
- local trg
- trg=$(basename "${1}" | sed 's,\.[^/]*$,,' | tr '[:upper:]' '[:lower:]')
+ # -l: TexLive target links are always lowercase.
+ local -l trg
+
+ # Get the basename of the script.
+ trg="${1##*/}"
+
+ # Only strip the filename extensions if trg is not listed in TEXLIVE_SCRIPTS_W_FILE_EXT.
+ if ! has "${trg}" ${TEXLIVE_SCRIPTS_W_FILE_EXT}; then
+ trg="${trg%.*}"
+ fi
+
einfo "Installing ${1} as ${trg} bin wrapper"
[[ -x ${ED}/usr/share/${1} ]] || die "Trying to install a non existing or non executable symlink to /usr/bin: ${1}"
dosym "../share/${1}" "/usr/bin/${trg}"
diff --git a/eclass/toolchain-funcs.eclass b/eclass/toolchain-funcs.eclass
index cde84e6f34c8..50eb310b4bf1 100644
--- a/eclass/toolchain-funcs.eclass
+++ b/eclass/toolchain-funcs.eclass
@@ -1,4 +1,4 @@
-# Copyright 2002-2023 Gentoo Authors
+# Copyright 2002-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: toolchain-funcs.eclass
@@ -251,7 +251,7 @@ tc-detect-is-softfloat() {
case ${CTARGET:-${CHOST}} in
# Avoid autodetection for bare-metal targets. bug #666896
- *-newlib|*-elf|*-eabi)
+ *-newlib|*-elf|*-eabi|arm64-apple-darwin*)
return 1 ;;
# arm-unknown-linux-gnueabi is ambiguous. We used to treat it as
@@ -295,6 +295,8 @@ tc-tuple-is-softfloat() {
# bare-metal targets have their defaults. bug #666896
*-newlib|*-elf|*-eabi)
echo "no" ;;
+ arm64-apple-darwin*)
+ echo "no" ;;
arm*)
echo "yes" ;;
*)
@@ -626,7 +628,14 @@ tc-has-tls() {
-*) die "Usage: tc-has-tls [-c|-l] [toolchain prefix]";;
esac
- : "${flags:=-fPIC -shared -Wl,-z,defs}"
+ case "${CHOST}" in
+ *-darwin*)
+ # bug #612370
+ : ${flags:=-dynamiclib}
+ ;;
+ *)
+ : ${flags:=-fPIC -shared -Wl,-z,defs}
+ esac
[[ $1 == -* ]] && shift
$(tc-getCC "$@") ${flags} "${base}.c" -o "${base}" >&/dev/null
local ret=$?
@@ -645,6 +654,7 @@ tc-ninja_magic_to_arch() {
[[ -z ${host} ]] && host=${CTARGET:-${CHOST}}
case ${host} in
+ arm64*) echo arm64;;
aarch64*) echo arm64;;
alpha*) echo alpha;;
arc*) echo arc;;
@@ -1032,6 +1042,7 @@ gen_usr_ldscript() {
[[ -z ${ED+set} ]] && local ED=${D%/}${EPREFIX}/
tc-is-static-only && return
+ use prefix && return
# We only care about stuffing / for the native ABI, bug #479448
if [[ $(type -t multilib_is_native_abi) == "function" ]] ; then
@@ -1234,6 +1245,7 @@ tc-get-build-ptr-size() {
# @RETURN: Shell true if we are using LTO, shell false otherwise
tc-is-lto() {
local f="${T}/test-lto.o"
+ local ret=1
case $(tc-get-compiler-type) in
clang)
@@ -1241,14 +1253,25 @@ tc-is-lto() {
# If LTO is used, clang will output bytecode and llvm-bcanalyzer
# will run successfully. Otherwise, it will output plain object
# file and llvm-bcanalyzer will exit with error.
- llvm-bcanalyzer "${f}" &>/dev/null && return 0
+ llvm-bcanalyzer "${f}" &>/dev/null && ret=0
;;
gcc)
$(tc-getCC) ${CFLAGS} -c -o "${f}" -x c - <<<"" || die
- [[ $($(tc-getREADELF) -S "${f}") == *.gnu.lto* ]] && return 0
+ [[ $($(tc-getREADELF) -S "${f}") == *.gnu.lto* ]] && ret=0
;;
esac
- return 1
+ rm -f "${f}" || die
+ return "${ret}"
+}
+
+# @FUNCTION: tc-has-64bit-time_t
+# @RETURN: Shell true if time_t is at least 64 bits long, false otherwise
+tc-has-64bit-time_t() {
+ $(tc-getCC) ${CFLAGS} ${CPPFLAGS} -c -x c - -o /dev/null <<-EOF &>/dev/null
+ #include <sys/types.h>
+ int test[sizeof(time_t) >= 8 ? 1 : -1];
+ EOF
+ return $?
}
fi
diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass
index c7c366a37ad0..ac236f3127f9 100644
--- a/eclass/toolchain.eclass
+++ b/eclass/toolchain.eclass
@@ -1214,7 +1214,14 @@ toolchain_src_configure() {
# - https://git.musl-libc.org/cgit/musl/tree/INSTALL
# - bug #704784
# - https://gcc.gnu.org/PR93157
- [[ ${CTARGET} == powerpc64-*-musl ]] && confgcc+=( --with-abi=elfv2 )
+ # musl additionally does not support libquadmath. See:
+ # - https://gcc.gnu.org/PR116007
+ [[ ${CTARGET} == powerpc64-*-musl ]] && confgcc+=(
+ --with-abi=elfv2
+ --disable-libquadmath
+ --disable-libquadmath-support
+ --with-long-double-128=no
+ )
if in_iuse ieee-long-double; then
# musl requires 64-bit long double, not IBM double-double or IEEE quad.
@@ -1654,9 +1661,6 @@ gcc_do_filter_flags() {
# New in GCC 14.
filter-flags -Walloc-size
- else
- # Makes things painfully slow and no real benefit for the compiler.
- append-flags $(test-flags-CC -fno-harden-control-flow-redundancy)
fi
# Please use USE=lto instead (bug #906007).
@@ -1894,7 +1898,6 @@ gcc_do_make() {
#---->> src_test <<----
# TODO: add JIT testing
-# TODO: add multilib testing
toolchain_src_test() {
# GCC's testsuite is a special case.
#
@@ -1917,11 +1920,79 @@ toolchain_src_test() {
local -x LD_PRELOAD=
# Controls running expensive tests in e.g. the torture testsuite.
+ # Note that 'TEST', not 'TESTS', is correct here as it's a GCC
+ # testsuite variable, not ours.
local -x GCC_TEST_RUN_EXPENSIVE=1
- # nonfatal here as we die if the comparison below fails. Also, note that
- # the exit code of targets other than 'check' may be unreliable.
- nonfatal emake -C "${WORKDIR}"/build -k "${GCC_TESTS_CHECK_TARGET}" RUNTESTFLAGS="${GCC_TESTS_RUNTESTFLAGS}"
+ # Use a subshell to allow meddling with flags just for the testsuite
+ (
+ # Workaround our -Wformat-security default which breaks
+ # various tests as it adds unexpected warning output.
+ GCC_TESTS_CFLAGS+=" -Wno-format-security -Wno-format"
+ GCC_TESTS_CXXFLAGS+=" -Wno-format-security -Wno-format"
+
+ # Workaround our -Wtrampolines default which breaks
+ # tests too.
+ GCC_TESTS_CFLAGS+=" -Wno-trampolines"
+ GCC_TESTS_CXXFLAGS+=" -Wno-trampolines"
+ # A handful of Ada (and objc++?) tests need an executable stack
+ GCC_TESTS_LDFLAGS+=" -Wl,--no-warn-execstack"
+ # Avoid confusing tests like Fortran/C interop ones where
+ # CFLAGS are used.
+ GCC_TESTS_CFLAGS+=" -Wno-complain-wrong-lang"
+ GCC_TESTS_CXXFLAGS+=" -Wno-complain-wrong-lang"
+
+ # Issues with Ada tests:
+ # gnat.dg/align_max.adb
+ # gnat.dg/trampoline4.adb
+ #
+ # A handful of Ada tests use -fstack-check and conflict
+ # with -fstack-clash-protection.
+ #
+ # TODO: This isn't ideal given it obv. affects codegen
+ # and we want to be sure it works.
+ GCC_TESTS_CFLAGS+=" -fno-stack-clash-protection"
+ GCC_TESTS_CXXFLAGS+=" -fno-stack-clash-protection"
+
+ # configure defaults to '-O2 -g' and some tests expect it
+ # accordingly.
+ GCC_TESTS_CFLAGS+=" -g"
+
+ # TODO: Does this handle s390 (-m31) correctly?
+ # TODO: What if there are multiple ABIs like x32 too?
+ # XXX: Disabled until validate_failures.py can handle 'variants'
+ # XXX: https://gcc.gnu.org/PR116260
+ #is_multilib && GCC_TESTS_RUNTESTFLAGS+=" --target_board=unix{,-m32}"
+
+ # nonfatal here as we die if the comparison below fails. Also, note that
+ # the exit code of targets other than 'check' may be unreliable.
+ #
+ # CFLAGS and so on are repeated here because of tests vs building test
+ # deps like libbacktrace.
+ #
+ # TODO: Should we try pass in the regular user flags for the non-RUNTESTFLAGS
+ # instances below for building e.g. libbacktrace?
+ nonfatal emake -C "${WORKDIR}"/build -k "${GCC_TESTS_CHECK_TARGET}" \
+ RUNTESTFLAGS=" \
+ ${GCC_TESTS_RUNTESTFLAGS} \
+ CFLAGS_FOR_TARGET='${GCC_TESTS_CFLAGS_FOR_TARGET:-${GCC_TESTS_CFLAGS}}' \
+ CXXFLAGS_FOR_TARGET='${GCC_TESTS_CXXFLAGS_FOR_TARGET:-${GCC_TESTS_CXXFLAGS}}' \
+ LDFLAGS_FOR_TARGET='${TEST_LDFLAGS_FOR_TARGET:-${GCC_TESTS_LDFLAGS}}' \
+ CFLAGS='${GCC_TESTS_CFLAGS}' \
+ CXXFLAGS='${GCC_TESTS_CXXFLAGS}' \
+ FCFLAGS='${GCC_TESTS_FCFLAGS}' \
+ FFLAGS='${GCC_TESTS_FFLAGS}' \
+ LDFLAGS='${GCC_TESTS_LDFLAGS}' \
+ " \
+ CFLAGS_FOR_TARGET="${GCC_TESTS_CFLAGS_FOR_TARGET:-${GCC_TESTS_CFLAGS}}" \
+ CXXFLAGS_FOR_TARGET="${GCC_TESTS_CXXFLAGS_FOR_TARGET:-${GCC_TESTS_CXXFLAGS}}" \
+ LDFLAGS_FOR_TARGET="${GCC_TESTS_LDFLAGS_FOR_TARGET:-${GCC_TESTS_LDFLAGS}}" \
+ CFLAGS="${GCC_TESTS_CFLAGS}" \
+ CXXFLAGS="${GCC_TESTS_CXXFLAGS}" \
+ FCFLAGS="${GCC_TESTS_FCFLAGS}" \
+ FFLAGS="${GCC_TESTS_FFLAGS}" \
+ LDFLAGS="${GCC_TESTS_LDFLAGS}"
+ )
# Produce an updated failure manifest.
einfo "Generating a new failure manifest ${T}/${CHOST}.xfail"
@@ -1975,7 +2046,7 @@ toolchain_src_test() {
eerror "GCC_TESTS_IGNORE_NO_BASELINE is set, ignoring test result and creating a new baseline..."
elif [[ -n ${GCC_TESTS_REGEN_BASELINE} ]] ; then
eerror "GCC_TESTS_REGEN_BASELINE is set, ignoring test result and creating using a new baseline..."
- elif [[ ${ret} != 0 ]]; then
+ elif [[ ${ret} != 0 ]] ; then
eerror "(Set GCC_TESTS_IGNORE_NO_BASELINE=1 to make this non-fatal and generate a baseline.)"
die "Tests failed (failures occurred with no reference data)"
fi
diff --git a/eclass/tree-sitter-grammar.eclass b/eclass/tree-sitter-grammar.eclass
index 24473fb98b1f..10f29b8a0835 100644
--- a/eclass/tree-sitter-grammar.eclass
+++ b/eclass/tree-sitter-grammar.eclass
@@ -47,7 +47,7 @@ for _BINDING in "${TS_BINDINGS[@]}"; do
DISTUTILS_EXT=1
DISTUTILS_OPTIONAL=1
DISTUTILS_USE_PEP517=setuptools
- PYTHON_COMPAT=( python3_{10..12} )
+ PYTHON_COMPAT=( python3_{10..13} )
inherit distutils-r1
IUSE+=" python"
@@ -162,6 +162,8 @@ tree-sitter-grammar_src_compile() {
if [[ -f "${S}/pyproject.toml" ]]; then
sed -e "/SONAME_MINOR :=/s/:=.*$/:= $(_get_tsg_abi_ver)/" -i "${S}/Makefile" || die
emake \
+ CC="$(tc-getCC)" \
+ AR="$(tc-getAR)" \
STRIP="" \
PREFIX="${EPREFIX}/usr" \
LIBDIR="${EPREFIX}/usr/$(get_libdir)"
diff --git a/eclass/unpacker.eclass b/eclass/unpacker.eclass
index 2957ca02d3f4..91520a36d16a 100644
--- a/eclass/unpacker.eclass
+++ b/eclass/unpacker.eclass
@@ -4,7 +4,7 @@
# @ECLASS: unpacker.eclass
# @MAINTAINER:
# base-system@gentoo.org
-# @SUPPORTED_EAPIS: 6 7 8
+# @SUPPORTED_EAPIS: 7 8
# @BLURB: helpers for extraneous file formats and consistent behavior across EAPIs
# @DESCRIPTION:
# Some extraneous file formats are not part of PMS, or are only in certain
@@ -16,7 +16,7 @@
# - support partial unpacks?
case ${EAPI} in
- 6|7|8) ;;
+ 7|8) ;;
*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
esac
@@ -430,10 +430,7 @@ _unpacker_get_decompressor() {
echo "xz -T$(makeopts_jobs) -dc" ;;
*.lz)
find_lz_unpacker() {
- local has_version_arg="-b"
-
- [[ ${EAPI} == 6 ]] && has_version_arg="--host-root"
- if has_version "${has_version_arg}" ">=app-arch/xz-utils-5.4.0" ; then
+ if has_version -b ">=app-arch/xz-utils-5.4.0" ; then
echo xz
return
fi
@@ -537,7 +534,7 @@ _unpacker() {
esac
# 7z, rar and lha/lzh are handled by package manager in EAPI < 8
- if [[ ${EAPI} != [67] ]]; then
+ if [[ ${EAPI} != 7 ]]; then
case ${m} in
*.7z)
arch="unpack_7z" ;;
diff --git a/eclass/vcs-snapshot.eclass b/eclass/vcs-snapshot.eclass
index 1b7299b92a3b..0279e89ec3ab 100644
--- a/eclass/vcs-snapshot.eclass
+++ b/eclass/vcs-snapshot.eclass
@@ -1,10 +1,10 @@
-# Copyright 1999-2022 Gentoo Authors
+# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: vcs-snapshot.eclass
# @MAINTAINER:
# mgorny@gentoo.org
-# @SUPPORTED_EAPIS: 6 7 8
+# @SUPPORTED_EAPIS: 7 8
# @BLURB: support eclass for unpacking VCS snapshot tarballs
# @DESCRIPTION:
# THIS ECLASS IS NOT NECESSARY FOR MODERN GITHUB AND GITLAB SNAPSHOTS.
@@ -43,7 +43,6 @@
# in ${WORKDIR}/${P} and ${WORKDIR}/${P}-otherstuff respectively.
case ${EAPI} in
- 6) inherit eqawarn ;;
7|8) ;;
*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
esac
@@ -103,13 +102,10 @@ vcs-snapshot_src_unpack() {
done
if [[ ! ${renamed_any} ]]; then
- local w=eerror
- [[ ${EAPI} == 6 ]] && w=eqawarn
- "${w}" "${FUNCNAME} did not find any archives that needed renaming."
- "${w}" "Please verify that its usage is really necessary, and remove"
- "${w}" "the inherit if it is not."
-
- [[ ${w} == eerror ]] && die "${FUNCNAME}: Unnecessary usage detected"
+ eerror "${FUNCNAME} did not find any archives that needed renaming."
+ eerror "Please verify that its usage is really necessary, and remove"
+ eerror "the inherit if it is not."
+ die "${FUNCNAME}: Unnecessary usage detected"
fi
}