diff options
Diffstat (limited to 'eclass')
37 files changed, 1415 insertions, 348 deletions
diff --git a/eclass/Manifest.gz b/eclass/Manifest.gz Binary files differindex 22772e8d05a5..656450fb3b53 100644 --- a/eclass/Manifest.gz +++ b/eclass/Manifest.gz diff --git a/eclass/autotools.eclass b/eclass/autotools.eclass index 1545b88bc426..f37b8482781f 100644 --- a/eclass/autotools.eclass +++ b/eclass/autotools.eclass @@ -598,7 +598,7 @@ autotools_run_tool() { done if [[ ${EBUILD_PHASE_FUNC} != "src_prepare" ]] ; then - eqawarn "Running '${1}' in ${EBUILD_PHASE_FUNC} phase" + eqawarn "QA Notice: Running '${1}' in ${EBUILD_PHASE_FUNC} phase" fi if ${missing_ok} && ! type -P ${1} >/dev/null ; then diff --git a/eclass/cargo.eclass b/eclass/cargo.eclass index d93ae1723470..247d1bf535b9 100644 --- a/eclass/cargo.eclass +++ b/eclass/cargo.eclass @@ -245,6 +245,16 @@ ECARGO_VENDOR="${ECARGO_HOME}/gentoo" # @DESCRIPTION: # List of URIs to put in SRC_URI created from CRATES variable. +# @FUNCTION: _cargo_check_initialized +# @INTERNAL +# @DESCRIPTION: +# Checks if rust_pkg_setup has been run. +_cargo_check_initialized() { + if [[ -z "${CARGO}" ]]; then + die "CARGO is not set; was rust_pkg_setup run?" + fi +} + # @FUNCTION: _cargo_set_crate_uris # @USAGE: <crates> # @DESCRIPTION: @@ -468,9 +478,7 @@ cargo_target_dir() { cargo_update_crates () { debug-print-function ${FUNCNAME} "$@" - if [[ -z ${CARGO} ]]; then - die "CARGO is not set; was rust_pkg_setup run?" - fi + _cargo_check_initialized local path=${1:-"${S}/Cargo.toml"} if [[ $# -gt 1 ]]; then @@ -534,7 +542,7 @@ cargo_src_unpack() { popd >/dev/null || die if [[ ${#crates[@]} -ge 300 ]]; then - eqawarn "This package uses a very large number of CRATES. Please provide" + eqawarn "QA Notice: This package uses a very large number of CRATES. Please provide" eqawarn "a crate tarball instead and fetch it via SRC_URI. You can use" eqawarn "'pycargoebuild --crate-tarball' to create one." fi @@ -553,6 +561,8 @@ cargo_live_src_unpack() { [[ "${PV}" == *9999* ]] || die "${FUNCNAME} only allowed in live/9999 ebuilds" [[ "${EBUILD_PHASE}" == unpack ]] || die "${FUNCNAME} only allowed in src_unpack" + _cargo_check_initialized + mkdir -p "${S}" || die mkdir -p "${ECARGO_VENDOR}" || die mkdir -p "${ECARGO_HOME}" || die @@ -778,9 +788,7 @@ cargo_env() { cargo_src_compile() { debug-print-function ${FUNCNAME} "$@" - if [[ -z "${CARGO}" ]]; then - die "CARGO is not set; was rust_pkg_setup run?" - fi + _cargo_check_initialized set -- "${CARGO}" build $(usex debug "" --release) ${ECARGO_ARGS[@]} "$@" einfo "${@}" @@ -796,9 +804,7 @@ cargo_src_compile() { cargo_src_install() { debug-print-function ${FUNCNAME} "$@" - if [[ -z "${CARGO}" ]]; then - die "CARGO is not set; was rust_pkg_setup run?" - fi + _cargo_check_initialized set -- "${CARGO}" install $(has --path ${@} || echo --path ./) \ --root "${ED}/usr" \ @@ -818,9 +824,7 @@ cargo_src_install() { cargo_src_test() { debug-print-function ${FUNCNAME} "$@" - if [[ -z "${CARGO}" ]]; then - die "CARGO is not set; was rust_pkg_setup run?" - fi + _cargo_check_initialized set -- "${CARGO}" test $(usex debug "" --release) ${ECARGO_ARGS[@]} "$@" einfo "${@}" diff --git a/eclass/chromium-2.eclass b/eclass/chromium-2.eclass index 0831f1f17aa5..e8f471e2178f 100644 --- a/eclass/chromium-2.eclass +++ b/eclass/chromium-2.eclass @@ -1,4 +1,4 @@ -# Copyright 1999-2023 Gentoo Authors +# Copyright 1999-2025 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 # @ECLASS: chromium-2.eclass @@ -83,7 +83,7 @@ chromium_remove_language_paks() { # Look for missing pak files. for lang in ${CHROMIUM_LANGS}; do if [[ ! -e ${lang}.pak ]]; then - eqawarn "L10N warning: no .pak file for ${lang} (${lang}.pak not found)" + eqawarn "QA Notice: L10N warning: no .pak file for ${lang} (${lang}.pak not found)" fi done @@ -101,7 +101,7 @@ chromium_remove_language_paks() { fi if ! has ${lang} ${CHROMIUM_LANGS}; then - eqawarn "L10N warning: no ${lang} in LANGS" + eqawarn "QA Notice: L10N warning: no ${lang} in LANGS" continue fi diff --git a/eclass/cmake.eclass b/eclass/cmake.eclass index e1bad4cbd16f..c97f74e8a2ed 100644 --- a/eclass/cmake.eclass +++ b/eclass/cmake.eclass @@ -303,7 +303,7 @@ _cmake_check_build_dir() { # TODO: For EAPI > 8, we should ban S=WORKDIR for CMake. # See bug #889420. if [[ ${S} == "${WORKDIR}" && ${BUILD_DIR} == "${WORKDIR}_build" ]] ; then - eqawarn "QA notice: S=WORKDIR is deprecated for cmake.eclass." + eqawarn "QA Notice: S=WORKDIR is deprecated for cmake.eclass." eqawarn "Please relocate the sources in src_unpack." BUILD_DIR="${WORKDIR}"/${P}_build fi diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass index e1672dd3c3b0..62e092b6231f 100644 --- a/eclass/distutils-r1.eclass +++ b/eclass/distutils-r1.eclass @@ -134,13 +134,20 @@ # # - sip - sipbuild backend # -# - standalone - standalone build systems without external deps -# (used for bootstrapping). +# - standalone - standalone/local build systems # # - uv-build - uv-build backend (using dev-python/uv) # -# The variable needs to be set before the inherit line. The eclass -# adds appropriate build-time dependencies and verifies the value. +# The variable needs to be set before the inherit line. If another +# value than "standalone" and "no" is used, The eclass adds appropriate +# build-time dependencies, verifies the value and calls the appropriate +# modern entry point for the backend. With DISTUTILS_UPSTREAM_PEP517, +# this variable can be used to override the upstream build backend. +# +# The value of "standalone" indicates that upstream is using a custom, +# local build backend. In this mode, the eclass does not add any +# dependencies, disables build backend verification and uses the exact +# entry point listed in pyproject.toml. # # The special value "no" indicates that the package has no build system. # This is not equivalent to unset DISTUTILS_USE_PEP517 (legacy mode). @@ -154,18 +161,24 @@ # will be merged into ${D}. # @ECLASS_VARIABLE: DISTUTILS_UPSTREAM_PEP517 +# @DEFAULT_UNSET # @DESCRIPTION: # Specifies the PEP517 build backend used upstream. It is used # by the eclass to verify the correctness of DISTUTILS_USE_PEP517, -# and matches DISTUTILS_USE_PEP517 by default. However, it can be +# and defaults to ${DISTUTILS_USE_PEP517}. However, it can be # overriden to workaround the eclass check, when it is desirable # to build the wheel using other backend than the one used upstream. # +# When using it, ideally it should list the build backend actually used +# upstream, so the eclass will throw an error if that backend changes +# (and therefore overrides may need to change as well). As a special +# case, setting it to "standalone" disables the check entirely (while +# still forcing the backend, unlike DISTUTILS_USE_PEP517=standalone). +# # Please note that even in packages using PEP621 metadata, there can # be subtle differences between the behavior of different PEP517 build # backends, for example regarding finding package files. When using # this option, please make sure that the package is installed correctly. -: "${DISTUTILS_UPSTREAM_PEP517:=${DISTUTILS_USE_PEP517}}" # @ECLASS_VARIABLE: DISTUTILS_USE_SETUPTOOLS # @DEFAULT_UNSET @@ -215,7 +228,7 @@ # 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} +: "${DISTUTILS_ALLOW_WHEEL_REUSE=1}" # @ECLASS_VARIABLE: BUILD_DIR # @OUTPUT_VARIABLE @@ -322,7 +335,7 @@ _distutils_set_globals() { ;; setuptools) bdep+=' - >=dev-python/setuptools-75.8.2[${PYTHON_USEDEP}] + >=dev-python/setuptools-78.1.0[${PYTHON_USEDEP}] ' ;; sip) @@ -347,7 +360,7 @@ _distutils_set_globals() { eqawarn "is enabled." fi else - local setuptools_dep='>=dev-python/setuptools-75.8.2[${PYTHON_USEDEP}]' + local setuptools_dep='>=dev-python/setuptools-78.1.0[${PYTHON_USEDEP}]' case ${DISTUTILS_USE_SETUPTOOLS:-bdepend} in no|manual) @@ -388,6 +401,11 @@ _distutils_set_globals() { DISTUTILS_DEPS=${bdep} readonly DISTUTILS_DEPS fi + else + eqawarn "QA Notice: distutils-r1.eclass legacy mode is deprecated and will be removed." + eqawarn "Please migrate your ebuilds to use DISTUTILS_USE_PEP517 (common values" + eqawarn "are 'setuptools' for packages using setuptools/distutils," + eqawarn "and 'no' for packages using non-PEP517 build systems)." fi if [[ ! ${DISTUTILS_OPTIONAL} ]]; then @@ -599,7 +617,7 @@ distutils_enable_sphinx() { # # - pytest: dev-python/pytest # -# - setup.py: setup.py test (no deps included) +# - setup.py: setup.py test (no deps included; deprecated) # # - unittest: for built-in Python unittest module # @@ -645,14 +663,10 @@ distutils_enable_tests() { fi ;; setup.py) + eqawarn "QA Notice: 'distutils_enable_tests setup.py' is deprecated and will be removed." + eqawarn "Please use unittest or pytest instead." ;; unittest) - # unittest-or-fail is needed in py<3.12 - local test_pkgs="$(python_gen_cond_dep ' - dev-python/unittest-or-fail[${PYTHON_USEDEP}] - ' 3.10 3.11 - )" - [[ -n ${test_pkgs} ]] && test_deps+=" ${test_pkgs}" ;; *) die "${FUNCNAME}: unsupported argument: ${1}" @@ -981,15 +995,6 @@ distutils-r1_python_prepare_all() { if [[ ! ${DISTUTILS_USE_PEP517} ]]; then _distutils-r1_disable_ez_setup _distutils-r1_handle_pyproject_toml - - case ${DISTUTILS_USE_SETUPTOOLS} in - no) - eqawarn "Non-PEP517 builds are deprecated for ebuilds using plain distutils." - eqawarn "Please migrate to DISTUTILS_USE_PEP517=setuptools." - eqawarn "Please see Python Guide for more details:" - eqawarn " https://projects.gentoo.org/python/guide/distutils.html" - ;; - esac fi if [[ ${DISTUTILS_IN_SOURCE_BUILD} && ! ${DISTUTILS_SINGLE_IMPL} ]] @@ -1158,13 +1163,28 @@ _distutils-r1_get_backend() { fi fi + # if DISTUTILS_USE_PEP517 is "standalone", we respect the exact + # backend used in pyproject.toml; otherwise we force the backend + # based on DISTUTILS_USE_PEP517 if [[ ${DISTUTILS_USE_PEP517} == standalone ]]; then echo "${build_backend}" return fi + # we can output it early, even if we die below + echo "$(_distutils-r1_key_to_backend "${DISTUTILS_USE_PEP517}")" + + # skip backend verification if DISTUTILS_UPSTREAM_PEP517 + # is "standalone" + if [[ ${DISTUTILS_UPSTREAM_PEP517} == standalone ]]; then + return + fi + # verify that the ebuild correctly specifies the build backend - local expected_backend=$(_distutils-r1_key_to_backend "${DISTUTILS_UPSTREAM_PEP517}") + local expected_backend=$( + _distutils-r1_key_to_backend \ + "${DISTUTILS_UPSTREAM_PEP517:-${DISTUTILS_USE_PEP517}}" + ) if [[ ${expected_backend} != ${build_backend} ]]; then # special-case deprecated backends case ${build_backend} in @@ -1188,14 +1208,12 @@ _distutils-r1_get_backend() { # if we didn't die, we're dealing with a deprecated backend if [[ ! -f ${T}/.distutils_deprecated_backend_warned ]]; then - eqawarn "${build_backend} backend is deprecated. Please see:" + eqawarn "QA Notice: ${build_backend} backend is deprecated. Please see:" eqawarn "https://projects.gentoo.org/python/guide/qawarn.html#deprecated-pep-517-backends" eqawarn "The project should use ${expected_backend} instead." > "${T}"/.distutils_deprecated_backend_warned || die fi fi - - echo "$(_distutils-r1_key_to_backend "${DISTUTILS_USE_PEP517}")" } # @FUNCTION: distutils_wheel_install @@ -1667,7 +1685,8 @@ distutils-r1_python_install() { # let's explicitly verify these assumptions # remove files that we've created explicitly - rm "${reg_scriptdir}"/{"${EPYTHON}",python3,python,pyvenv.cfg} || die + rm "${reg_scriptdir}"/{"${EPYTHON}",python3,python} || die + rm "${reg_scriptdir}"/../pyvenv.cfg || die # Automagically do the QA check to avoid issues when bootstrapping # prefix. @@ -1722,7 +1741,6 @@ distutils-r1_python_install() { # python likes to compile any module it sees, which triggers sandbox # failures if some packages haven't compiled their modules yet. addpredict "${EPREFIX}/usr/lib/${EPYTHON}" - addpredict "${EPREFIX}/usr/lib/pypy3.10" addpredict "${EPREFIX}/usr/local" # bug 498232 if [[ ! ${DISTUTILS_SINGLE_IMPL} ]]; then @@ -1996,7 +2014,7 @@ _distutils-r1_compare_installed_files() { --exclude="*$(get_modname)" \ "${_DISTUTILS_PREVIOUS_SITE}" "${sitedir}" if [[ ${?} -ne 0 ]]; then - eqawarn "Package creating at least one pure Python wheel installs different" + eqawarn "QA Notice: Package creating at least one pure Python wheel installs different" eqawarn "Python files between implementations. See diff in build log, above" eqawarn "this message." fi @@ -2036,7 +2054,12 @@ _distutils-r1_post_python_compile() { ln -s "${PYTHON}" "${bindir}/${EPYTHON}" || die ln -s "${EPYTHON}" "${bindir}/python3" || die ln -s "${EPYTHON}" "${bindir}/python" || die - cat > "${bindir}"/pyvenv.cfg <<-EOF || die + # python3.14 changed venv logic so that: + # 1) pyvenv.cfg location explicitly determines prefix + # (i.e. we no longer can be put in bin/) + # 2) "home =" key must be present + cat > "${bindir}"/../pyvenv.cfg <<-EOF || die + home = ${EPREFIX}/usr/bin include-system-site-packages = true EOF @@ -2187,7 +2210,7 @@ _distutils-r1_post_python_install() { if [[ ! ${DISTUTILS_EXT} && ! ${_DISTUTILS_EXT_WARNED} ]]; then if [[ $(find "${sitedir}" -name "*$(get_modname)" | head -n 1) ]] then - eqawarn "Python extension modules (*$(get_modname)) found installed. Please set:" + eqawarn "QA Notice: Python extension modules (*$(get_modname)) found installed. Please set:" eqawarn " DISTUTILS_EXT=1" eqawarn "in the ebuild." _DISTUTILS_EXT_WARNED=1 diff --git a/eclass/dot-a.eclass b/eclass/dot-a.eclass new file mode 100644 index 000000000000..f82e5da5be89 --- /dev/null +++ b/eclass/dot-a.eclass @@ -0,0 +1,119 @@ +# Copyright 2025 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +# @ECLASS: dot-a.eclass +# @MAINTAINER: +# Toolchain Ninjas <toolchain@gentoo.org> +# @AUTHOR: +# Sam James <sam@gentoo.org> +# Eli Schwartz <eschwartz@gentoo.org> +# @SUPPORTED_EAPIS: 8 +# @BLURB: Functions to handle stripping LTO bytecode out of static archives. +# @DESCRIPTION: +# This eclass provides functions to strip LTO bytecode out of static archives +# (.a files). +# +# Static libraries when built with LTO will contain LTO bytecode which is +# not portable across compiler versions or compiler vendors. To avoid pessimising +# the library and always filtering LTO, we can build it with -ffat-lto-objects +# instead, which builds some components twice. The installed part will then +# have the LTO contents stripped out, leaving the regular objects in the +# static archive. +# +# Use should be passing calling lto-guarantee-fat before configure-time +# and calling strip-lto-bytecode after installation. +# +# Most packages installing static libraries should be using this eclass, +# though it's not strictly necessary if the package filters LTO. +# +# @EXAMPLE: +# @CODE +# +# inherit dot-a +# +# src_configure() { +# lto-guarantee-fat +# econf +# } +# +# src_install() { +# default +# strip-lto-bytecode +# } +case ${EAPI} in + 8) ;; + *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;; +esac + +if [[ -z ${_DOT_A_ECLASS} ]] ; then +_DOT_A_ECLASS=1 + +inherit flag-o-matic toolchain-funcs + +# TODO: QA check + +# @FUNCTION: lto-guarantee-fat +# @DESCRIPTION: +# If LTO is enabled, appends -ffat-lto-objects or any other flags needed +# to provide fat LTO objects. +lto-guarantee-fat() { + tc-is-lto || return + + # We add this for all languages as LTO obviously can't be done + # if different compilers are used for e.g. C vs C++ anyway. + append-flags $(test-flags-CC -ffat-lto-objects) +} + +# @FUNCTION: strip-lto-bytecode +# @USAGE: [library|directory] [...] +# @DESCRIPTION: +# Strips LTO bytecode from libraries (static archives) passed as arguments. +# Defaults to operating on ${ED} as a whole if no arguments are passed. +# +# As an optimisation, if USE=static-libs exists for a package and is disabled, +# the default-searching behaviour with no arguments is suppressed. +strip-lto-bytecode() { + tc-is-lto || return + + local files=() + + if [[ ${#} -eq 0 ]]; then + if ! in_iuse static-libs || use static-libs ; then + # maybe we are USE=static-libs. Alternatively, maybe the ebuild doesn't + # offer such a choice. In both cases, the user specified the function, + # so we expect to be called on *something*, but nothing was explicitly + # passed. Try scanning ${ED} automatically. + set -- "${ED}" + else + return + fi + fi + + mapfile -t -d '' files < <(find -H "${@}" -type f \( -name '*.a' -or -name '*.o' \) -print0) + + toolchain_type= + tc-is-gcc && toolchain_type=gnu + tc-is-clang && toolchain_type=llvm + + local file + for file in "${files[@]}" ; do + case ${toolchain_type} in + gnu) + $(tc-getSTRIP) \ + -R .gnu.lto_* \ + -R .gnu.debuglto_* \ + -N __gnu_lto_v1 \ + "${file}" || die "Stripping bytecode in ${file} failed" + ;; + llvm) + llvm-bitcode-strip \ + -r "${file}" \ + -o "${file}" || die "Stripping bytecode in ${file} failed" + ;; + *) + ;; + esac + done +} + +fi diff --git a/eclass/ecm.eclass b/eclass/ecm.eclass index 9caaf59cb3fa..7a3d51c9913a 100644 --- a/eclass/ecm.eclass +++ b/eclass/ecm.eclass @@ -498,7 +498,7 @@ if [[ ${EAPI} == 8 ]]; then # Determine if the current GCC version is acceptable, otherwise die. _ecm_deprecated_check_gcc_version() { if ver_test ${KFMIN} -ge 6.9; then - eqawarn "QA notice: ecm_pkg_${1} has become a no-op." + eqawarn "QA Notice: ecm_pkg_${1} has become a no-op." eqawarn "It is no longer being exported with KFMIN >=6.9.0." else [[ ${MERGE_TYPE} != binary && -v KDE_GCC_MINIMAL ]] && @@ -592,7 +592,7 @@ ecm_src_prepare() { diff -Naur ${f}.old ${f} 1>>${pf} rm ${f}.old || die "Failed to clean up" done - eqawarn "QA notice: Build system modified by ECM_TEST=forceoptional-recursive." + eqawarn "QA Notice: Build system modified by ECM_TEST=forceoptional-recursive." eqawarn "Unified diff file ready for pickup in:" eqawarn " ${pf}" eqawarn "Push it upstream to make this message go away." @@ -780,7 +780,7 @@ if [[ ${EAPI} == 8 ]]; then # Carryall for ecm_pkg_preinst, ecm_pkg_postinst and ecm_pkg_postrm. _ecm_nongui_deprecated() { if ver_test ${KFMIN} -ge 6.9; then - eqawarn "QA notice: ecm_pkg_${1} has become a no-op." + eqawarn "QA Notice: ecm_pkg_${1} has become a no-op." eqawarn "It is no longer being exported with KFMIN >=6.9.0." else case ${ECM_NONGUI} in diff --git a/eclass/edo.eclass b/eclass/edo.eclass index 5fd77a676a8b..a308851aca7f 100644 --- a/eclass/edo.eclass +++ b/eclass/edo.eclass @@ -1,4 +1,4 @@ -# Copyright 2022-2024 Gentoo Authors +# Copyright 2022-2025 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 # @ECLASS: edo.eclass @@ -36,8 +36,26 @@ _EDO_ECLASS=1 # Executes a short 'command' with any given arguments and exits on failure # unless called under 'nonfatal'. edo() { - einfo "$@" - "$@" || die -n "Failed to run command: $@" + # list of special characters taken from sh_contains_shell_metas + # in shquote.c (bash-5.2) + local a out regex='[] '\''"\|&;()<>!{}*[?^$`]|^[#~]|[=:]~' + + [[ $# -ge 1 ]] || die "edo: at least one argument needed" + + if [[ ${EAPI} = 7 ]]; then + # no @Q in bash-4.2 + out=" $*" + else + for a; do + # quote if (and only if) necessary + [[ ${a} =~ ${regex} || ! ${a} =~ ^[[:print:]]+$ ]] && a=${a@Q} + out+=" ${a}" + done + fi + + einfon + printf '%s\n' "${out:1}" >&2 + "$@" || die -n "Failed to run command: ${1}" } # @FUNCTION: edob diff --git a/eclass/elisp-common.eclass b/eclass/elisp-common.eclass index 117544e94b35..654b302bb39a 100644 --- a/eclass/elisp-common.eclass +++ b/eclass/elisp-common.eclass @@ -1,4 +1,4 @@ -# Copyright 1999-2024 Gentoo Authors +# Copyright 1999-2025 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 # @ECLASS: elisp-common.eclass @@ -626,12 +626,12 @@ elisp-modules-install() { elisp-site-file-install() { local sf="${1##*/}" my_pn="${2:-${PN}}" modules ret - local add_header="1 { - # Find first non-empty line - :x; /^\$/ { n; bx; } - # Insert a header, unless we already look at one - /^;.*${PN}/I! s/^/;;; ${PN} site-lisp configuration\n\n/ - 1 s/^/\n/ + local add_header="0,/\S/ { + # Delete any leading blank lines + /\S/! d + # Insert a header, unless we are already looking at one + /^;.*${PN}/I! \ + i ;;; ${PN} site-lisp configuration -*-lexical-binding:t-*-\n }" [[ ${sf} == [0-9][0-9]*-gentoo*.el ]] \ @@ -711,11 +711,15 @@ elisp-site-regen() { ;; DO NOT EDIT THIS FILE ;;; Code: + EOF - # Use sed instead of cat here, since files may miss a trailing newline. - sed '$q' "${sflist[@]}" </dev/null >>"${T}"/site-gentoo.el || ret=$? + # Concatenate all site initialisation files. + # 1{/^;/s/\s*-\*-.*-\*-//} deletes file-local-var cookies from line 1. + # /\S/,$!d deletes any leading blank lines. + # $G inserts a blank line after each file. + sed -s '1{/^;/s/\s*-\*-.*-\*-//};/\S/,$!d;$G' "${sflist[@]}" \ + </dev/null >>"${T}"/site-gentoo.el || ret=$? cat <<-EOF >>"${T}"/site-gentoo.el || ret=$? - ${page} (provide 'site-gentoo) diff --git a/eclass/ffmpeg-compat.eclass b/eclass/ffmpeg-compat.eclass index 1835a8c7e95a..ce8878d10c55 100644 --- a/eclass/ffmpeg-compat.eclass +++ b/eclass/ffmpeg-compat.eclass @@ -10,7 +10,7 @@ # @BLURB: Helper functions to link with slotted ffmpeg-compat libraries # @DESCRIPTION: # To use this, run ``ffmpeg_compat_setup <slot>`` before packages use -# pkg-config, depend on media-video/ffmpeg-compat:<slot>=, and ensure +# pkg-config, depend on media-video/ffmpeg-compat:<slot>, and ensure # usage of both pkg-config --cflags and --libs (which adds -Wl,-rpath # to find libraries at runtime). Always verify that it is linked with # the right libraries after. diff --git a/eclass/flag-o-matic.eclass b/eclass/flag-o-matic.eclass index 4765809e9118..f22854c646c7 100644 --- a/eclass/flag-o-matic.eclass +++ b/eclass/flag-o-matic.eclass @@ -24,7 +24,7 @@ inherit toolchain-funcs # @DESCRIPTION: # Return all the flag variables that our high level functions operate on. all-flag-vars() { - echo {ADA,C,CPP,CXX,CCAS,F,FC,LD}FLAGS + echo {ADA,C,CPP,CXX,CCAS,F,FC,GDC,LD}FLAGS } # @FUNCTION: setup-allowed-flags @@ -46,7 +46,7 @@ setup-allowed-flags() { _setup-allowed-flags() { ALLOWED_FLAGS=( -pipe -O '-O[123szg]' '-mcpu=*' '-march=*' '-mtune=*' '-mfpmath=*' - -flto '-flto=*' -fno-lto + -flto '-flto=*' -fno-lto -ffat-lto-objects # Hardening flags '-fstack-protector*' diff --git a/eclass/gear.kde.org.eclass b/eclass/gear.kde.org.eclass index 2ae40dfbc708..9e216e7e02be 100644 --- a/eclass/gear.kde.org.eclass +++ b/eclass/gear.kde.org.eclass @@ -63,7 +63,7 @@ elif [[ -z ${KDE_ORG_COMMIT} ]]; then SRC_URI="${_KDE_SRC_URI}${KDE_ORG_TAR_PN}-${PV}.tar.xz" fi -# list of applications ported to KF6 in SLOT=6 having to block SLOT=5 +# list of applications ported to KF6 having to block SLOT=5 if $(ver_test -gt 24.01.75); then case ${PN} in akonadi | \ @@ -248,7 +248,7 @@ if $(ver_test -gt 24.01.75); then esac fi -# list of applications ported to KF6 post-24.02 in SLOT=6 having to block SLOT=5 +# list of applications ported to KF6 post-24.02 having to block SLOT=5 if $(ver_test -gt 24.04.75); then case ${PN} in audex | \ @@ -262,7 +262,7 @@ 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 +# list of applications ported to KF6 post-24.05 having to block SLOT=5 if $(ver_test -gt 24.07.75); then case ${PN} in k3b | \ @@ -285,7 +285,7 @@ if $(ver_test -gt 24.07.75); then esac fi -# list of applications ported to KF6 post-24.08 in SLOT=6 having to block SLOT=5 +# list of applications ported to KF6 post-24.08 having to block SLOT=5 if $(ver_test -gt 24.11.75); then case ${PN} in cantor | \ @@ -300,4 +300,13 @@ if $(ver_test -gt 24.11.75); then esac fi +# list of applications ported to KF6 post-25.04 having to block SLOT=5 +if $(ver_test -gt 25.07.50); then + case ${PN} in + artikulate) + RDEPEND+=" !${CATEGORY}/${PN}:5" ;; + *) ;; + esac +fi + fi diff --git a/eclass/go-module.eclass b/eclass/go-module.eclass index 73e9ee51c7d5..14e0aad9dd2a 100644 --- a/eclass/go-module.eclass +++ b/eclass/go-module.eclass @@ -1,4 +1,4 @@ -# Copyright 2019-2024 Gentoo Authors +# Copyright 2019-2025 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 # @ECLASS: go-module.eclass @@ -371,7 +371,7 @@ go-module_src_unpack() { fi GOFLAGS="${GOFLAGS} -p=$(makeopts_jobs)" if [[ "${#EGO_SUM[@]}" -gt 0 ]]; then - eqawarn "This ebuild uses EGO_SUM which is deprecated" + eqawarn "QA Notice: This ebuild uses EGO_SUM which is deprecated" eqawarn "Please migrate to a dependency tarball" eqawarn "This will become a fatal error in the future" _go-module_src_unpack_gosum diff --git a/eclass/gstreamer-meson.eclass b/eclass/gstreamer-meson.eclass index 15b0a6390a42..1f43749baed3 100644 --- a/eclass/gstreamer-meson.eclass +++ b/eclass/gstreamer-meson.eclass @@ -35,7 +35,7 @@ case "${EAPI:-0}" in ;; esac -PYTHON_COMPAT=( python3_{10..12} ) +PYTHON_COMPAT=( python3_{10..13} ) [[ ${EAPI} == 8 ]] && inherit python-any-r1 # multilib-minimal goes last diff --git a/eclass/haskell-cabal.eclass b/eclass/haskell-cabal.eclass index 7895d9256eba..bb73c0e4881d 100644 --- a/eclass/haskell-cabal.eclass +++ b/eclass/haskell-cabal.eclass @@ -1,4 +1,4 @@ -# Copyright 1999-2023 Gentoo Authors +# Copyright 1999-2025 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 # @ECLASS: haskell-cabal.eclass @@ -342,7 +342,7 @@ cabal-bootstrap() { elif [[ -f "${S}/Setup.hs" ]]; then setupmodule="${S}/Setup.hs" else - eqawarn "No Setup.lhs or Setup.hs found. Either add Setup.hs to package or call cabal-mksetup from ebuild" + eqawarn "QA Notice: No Setup.lhs or Setup.hs found. Either add Setup.hs to package or call cabal-mksetup from ebuild" cabal-mksetup setupmodule="${S}/Setup.hs" fi @@ -661,6 +661,23 @@ cabal-is-dummy-lib() { return 1 } +# @FUNCTION: cabal-check-cache +# @DESCRIPTION: +# Check the state of the GHC cache by running 'ghc-pkg check' and looking +# for the string "WARNING: cache is out of date". If the string is not found, +# the cache is considered valid and the function returns 0. If it is found, +# the cache is considered invalid and the function returns 1. +cabal-check-cache() { + if $(ghc-getghcpkg) check 2>&1 \ + | grep -q 'WARNING: cache is out of date' + then + ewarn 'GHC cache is out of date!' + return 1 + else + return 0 + fi +} + # exported function: check if cabal is correctly installed for # the currently active ghc (we cannot guarantee this with portage) haskell-cabal_pkg_setup() { @@ -672,6 +689,13 @@ haskell-cabal_pkg_setup() { fi if cabal-is-dummy-lib; then einfo "${P} is included in ghc-${CABAL_CORE_LIB_GHC_PV}, nothing to install." + else + # bug 916785 + if ! cabal-check-cache; then + # avoid running ghc-recache-db so as not to set _GHC_RECACHE_CALLED + einfo "Recaching GHC package DB" + $(ghc-getghcpkg) recache + fi fi } @@ -711,6 +735,8 @@ haskell-cabal_src_prepare() { } haskell-cabal_src_configure() { + einfo "GHC version: $(ghc-version) $(ghc-pm-version)" + cabal-is-dummy-lib && return pushd "${S}" > /dev/null || die diff --git a/eclass/java-pkg-simple.eclass b/eclass/java-pkg-simple.eclass index f3f67e7de408..0cce6a2cdfa8 100644 --- a/eclass/java-pkg-simple.eclass +++ b/eclass/java-pkg-simple.eclass @@ -654,7 +654,7 @@ java-pkg-simple_src_compile() { JAVA_PKG_WANT_SOURCE=${tmp_source} JAVA_PKG_WANT_TARGET=${tmp_target} else - eqawarn "Need at least JDK 9 to compile module-info.java in src_compile." + eqawarn "QA Notice: Need at least JDK 9 to compile module-info.java in src_compile." eqawarn "Please adjust DEPEND accordingly. See https://bugs.gentoo.org/796875#c3" fi fi diff --git a/eclass/kernel-build.eclass b/eclass/kernel-build.eclass index ee4cf1413a60..b4e29a58bc48 100644 --- a/eclass/kernel-build.eclass +++ b/eclass/kernel-build.eclass @@ -36,7 +36,7 @@ esac if [[ -z ${_KERNEL_BUILD_ECLASS} ]]; then _KERNEL_BUILD_ECLASS=1 -PYTHON_COMPAT=( python3_{10..13} ) +PYTHON_COMPAT=( python3_{11..13} ) if [[ ${KERNEL_IUSE_MODULES_SIGN} ]]; then inherit secureboot fi diff --git a/eclass/llvm-r2.eclass b/eclass/llvm-r2.eclass index 4dda9aedc7c6..5370e5dbd8d5 100644 --- a/eclass/llvm-r2.eclass +++ b/eclass/llvm-r2.eclass @@ -1,4 +1,4 @@ -# Copyright 2024 Gentoo Authors +# Copyright 2024-2025 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 # @ECLASS: llvm-r2.eclass @@ -54,7 +54,7 @@ esac if [[ -z ${_LLVM_R2_ECLASS} ]]; then _LLVM_R2_ECLASS=1 -inherit llvm-utils +inherit llvm-utils multilib # == internal control knobs == diff --git a/eclass/llvm.org.eclass b/eclass/llvm.org.eclass index 16802e37cd66..a1c252f2cbf7 100644 --- a/eclass/llvm.org.eclass +++ b/eclass/llvm.org.eclass @@ -72,17 +72,17 @@ if [[ -z ${_LLVM_SOURCE_TYPE+1} ]]; then _LLVM_SOURCE_TYPE=snapshot case ${PV} in - 21.0.0_pre20250405) - EGIT_COMMIT=f3e6473df46fd920e09e06e57a5549eb8e3a8bd3 + 21.0.0_pre20250510) + EGIT_COMMIT=fcb4bda9dcfcdb64d8b069e8416c75d7a1a62e52 ;; - 21.0.0_pre20250329) - EGIT_COMMIT=21eeca3db0341fef4ab4a6464ffe38b2eba5810c + 21.0.0_pre20250503) + EGIT_COMMIT=d1e38eab95b07b422194427474521623916bbf29 ;; - 21.0.0_pre20250322) - EGIT_COMMIT=1d133420dc512487e2be0e9d86755f2a7c3497a7 + 21.0.0_pre20250426) + EGIT_COMMIT=b9e32749d273a957e60170d6e7ef205fd1fb1834 ;; - 21.0.0_pre20250317) - EGIT_COMMIT=1c3a9a853ce68c3c539e7cab21380b9d8b18f426 + 21.0.0_pre20250420) + EGIT_COMMIT=ac8fc09688e10e983b99224b5dc5cbbeeedb1879 ;; *) die "Unknown snapshot: ${PV}" diff --git a/eclass/python-r1.eclass b/eclass/python-r1.eclass index 02d7215320a2..7be8b5ac8d45 100644 --- a/eclass/python-r1.eclass +++ b/eclass/python-r1.eclass @@ -620,7 +620,7 @@ python_foreach_impl() { [[ ! ${_DISTUTILS_CALLING_FOREACH_IMPL} && ! ${_DISTUTILS_FOREACH_IMPL_WARNED} ]] then - eqawarn "python_foreach_impl has been called directly while using distutils-r1." + eqawarn "QA Notice: python_foreach_impl has been called directly while using distutils-r1." eqawarn "Please redefine python_*() phase functions to meet your expectations" eqawarn "instead." _DISTUTILS_FOREACH_IMPL_WARNED=1 diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass index affb8e55a50d..a1ca388ab730 100644 --- a/eclass/python-utils-r1.eclass +++ b/eclass/python-utils-r1.eclass @@ -39,9 +39,9 @@ inherit multiprocessing toolchain-funcs # @DESCRIPTION: # All supported Python implementations, most preferred last. _PYTHON_ALL_IMPLS=( - pypy3 pypy3_11 - python3_13t - python3_{10..13} + pypy3_11 + python3_{13..14}t + python3_{11..14} ) readonly _PYTHON_ALL_IMPLS @@ -51,9 +51,9 @@ readonly _PYTHON_ALL_IMPLS # All historical Python implementations that are no longer supported. _PYTHON_HISTORICAL_IMPLS=( jython2_7 - pypy pypy1_{8,9} pypy2_0 + pypy pypy1_{8,9} pypy2_0 pypy3 python2_{5..7} - python3_{1..9} + python3_{1..10} ) readonly _PYTHON_HISTORICAL_IMPLS @@ -81,7 +81,7 @@ _python_verify_patterns() { local impl pattern for pattern; do case ${pattern} in - -[23]|3.[89]|3.1[0-3]) + -[23]|3.[89]|3.1[0-4]) continue ;; esac @@ -137,9 +137,9 @@ _python_set_impls() { # please keep them in sync with _PYTHON_ALL_IMPLS # and _PYTHON_HISTORICAL_IMPLS case ${i} in - pypy3|pypy3_11|python3_9|python3_1[0-3]|python3_13t) + pypy3_11|python3_9|python3_1[1-4]|python3_1[3-4]t) ;; - jython2_7|pypy|pypy1_[89]|pypy2_0|python2_[5-7]|python3_[1-9]) + jython2_7|pypy|pypy1_[89]|pypy2_0|pypy3|python2_[5-7]|python3_[1-9]|python3_10) obsolete+=( "${i}" ) ;; *) @@ -208,6 +208,8 @@ _python_impl_matches() { local impl=${1/./_} pattern shift + # note: do not add "return 1" below, the function is supposed + # to iterate until it matches something for pattern; do case ${pattern} in -2|python2*|pypy) @@ -228,11 +230,7 @@ _python_impl_matches() { fi return 0 ;; - 3.10) - [[ ${impl} == python${pattern/./_} || ${impl} == pypy3 ]] && - return 0 - ;; - 3.8|3.9|3.1[1-3]) + 3.[89]|3.1[0-4]) [[ ${impl%t} == python${pattern/./_} || ${impl} == pypy${pattern/./_} ]] && return 0 ;; @@ -449,9 +447,6 @@ _python_export() { python*) PYTHON_PKG_DEP="dev-lang/python:${impl#python}${PYTHON_REQ_USE:+[${PYTHON_REQ_USE}]}" ;; - pypy3) - PYTHON_PKG_DEP="dev-lang/pypy:3.10=[symlink${PYTHON_REQ_USE:+,${PYTHON_REQ_USE}}]" - ;; pypy3.*) PYTHON_PKG_DEP="dev-lang/pypy:${impl#pypy}=${PYTHON_REQ_USE:+[${PYTHON_REQ_USE}]}" ;; @@ -629,29 +624,11 @@ python_optimize() { local jobs=$(makeopts_jobs) local d for d; do - # make sure to get a nice path without // - local instpath=${d#${D}} - instpath=/${instpath##/} - einfo "Optimize Python modules for ${instpath}" - case "${EPYTHON}" in - python3.8) - # both levels of optimization are separate since 3.5 - "${PYTHON}" -m compileall -j "${jobs}" -q -f -d "${instpath}" "${d}" - "${PYTHON}" -O -m compileall -j "${jobs}" -q -f -d "${instpath}" "${d}" - "${PYTHON}" -OO -m compileall -j "${jobs}" -q -f -d "${instpath}" "${d}" - ;; - python*|pypy3*) - # Python 3.9+ - "${PYTHON}" -m compileall -j "${jobs}" -o 0 -o 1 -o 2 --hardlink-dupes -q -f -d "${instpath}" "${d}" - ;; - pypy|jython2.7) - "${PYTHON}" -m compileall -q -f -d "${instpath}" "${d}" - ;; - *) - die "${FUNCNAME}: unexpected EPYTHON=${EPYTHON}" - ;; - esac + # NB: '-s' makes the path relative, so we need '-p /' to make it + # absolute again; https://github.com/python/cpython/issues/133503 + "${PYTHON}" -m compileall -j "${jobs}" -o 0 -o 1 -o 2 \ + --hardlink-dupes -q -f -s "${D}" -p / "${d}" done } @@ -1279,7 +1256,7 @@ _python_check_occluded_packages() { ) if [[ -n ${diff} ]]; then - eqawarn "The directory ${fn} occludes package installed for ${EPYTHON}." + eqawarn "QA Notice: The directory ${fn} occludes package installed for ${EPYTHON}." eqawarn "The installed package includes additional files:" eqawarn while IFS= read -r l; do @@ -1481,7 +1458,7 @@ epytest() { # @FUNCTION: eunittest # @USAGE: [<args>...] # @DESCRIPTION: -# Run unit tests using dev-python/unittest-or-fail, passing the standard +# Run unit tests using unittest, passing the standard # set of options, followed by user-specified options. # # This command dies on failure and respects nonfatal. @@ -1492,11 +1469,7 @@ eunittest() { _python_check_occluded_packages # unittest fails with "no tests" correctly since Python 3.12 - local runner=unittest - if _python_impl_matches "${EPYTHON}" 3.{9..11}; then - runner=unittest_or_fail - fi - set -- "${EPYTHON}" -m "${runner}" discover -v "${@}" + set -- "${EPYTHON}" -m unittest discover -v "${@}" echo "${@}" >&2 "${@}" || die -n "Tests failed with ${EPYTHON}" diff --git a/eclass/qt5-build.eclass b/eclass/qt5-build.eclass index 1a0335b9d2b6..7f79cd8e4063 100644 --- a/eclass/qt5-build.eclass +++ b/eclass/qt5-build.eclass @@ -1,4 +1,4 @@ -# Copyright 1999-2024 Gentoo Authors +# Copyright 1999-2025 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 # @ECLASS: qt5-build.eclass @@ -679,10 +679,10 @@ qt5_base_configure() { # link-time code generation is not something we want to enable by default -no-ltcg - # reduced relocations cause major breakage on at least arm and ppc, so - # don't specify anything and let the configure figure out if they are - # supported; see also https://bugreports.qt.io/browse/QTBUG-36129 - #-reduce-relocations + # Qt 5 doesn't support -mno-direct-extern-access, so uses + # -Bsymbolic, which causes issues for consumers if not linking + # corectly (bug #754021). + -no-reduce-relocations # use the system linker (gold will be selected automagically otherwise) $(tc-ld-is-gold && echo -use-gold-linker || echo -no-use-gold-linker) diff --git a/eclass/rpm.eclass b/eclass/rpm.eclass index c9c21aa6ebbd..e00332e55ca0 100644 --- a/eclass/rpm.eclass +++ b/eclass/rpm.eclass @@ -1,4 +1,4 @@ -# Copyright 1999-2024 Gentoo Authors +# Copyright 1999-2025 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 # @ECLASS: rpm.eclass @@ -31,9 +31,9 @@ rpm_unpack() { if [[ ${a} == ./* ]] ; then : # nothing to do -- path is local elif [[ ${a} == "${DISTDIR}"/* ]] ; then - eqawarn 'do not use ${DISTDIR} with rpm_unpack -- it is added for you' + eqawarn 'QA Notice: do not use ${DISTDIR} with rpm_unpack -- it is added for you' elif [[ ${a} == /* ]] ; then - eqawarn 'do not use full paths with rpm_unpack -- use ./ paths instead' + eqawarn 'QA Notice: do not use full paths with rpm_unpack -- use ./ paths instead' else a="${DISTDIR}/${a}" fi diff --git a/eclass/ruby-ng.eclass b/eclass/ruby-ng.eclass index f3745b5d3eab..c7425aae434c 100644 --- a/eclass/ruby-ng.eclass +++ b/eclass/ruby-ng.eclass @@ -1,4 +1,4 @@ -# Copyright 1999-2024 Gentoo Authors +# Copyright 1999-2025 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 # @ECLASS: ruby-ng.eclass @@ -110,7 +110,7 @@ _ruby_get_all_impls() { for i in ${USE_RUBY}; do case ${i} in # removed implementations - ruby19|ruby2[0-7]|ruby30|jruby) + ruby19|ruby2[0-7]|ruby3[0-1]|jruby) ;; *) found_valid_impl=1 @@ -725,7 +725,7 @@ ruby-ng_rspec() { fi if [[ "${DEPEND}${BDEPEND}" != *"dev-ruby/rspec"* ]]; then - eqawarn "Missing test dependency dev-ruby/rspec" + eqawarn "QA Notice: Missing test dependency dev-ruby/rspec" fi local rspec_params= diff --git a/eclass/ruby-utils.eclass b/eclass/ruby-utils.eclass index 4bd3e6ba1292..f55fcb29af74 100644 --- a/eclass/ruby-utils.eclass +++ b/eclass/ruby-utils.eclass @@ -1,4 +1,4 @@ -# Copyright 1999-2024 Gentoo Authors +# Copyright 1999-2025 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 # @ECLASS: ruby-utils.eclass @@ -33,7 +33,7 @@ esac # provide for a better first installation experience. # All stable RUBY_TARGETS -RUBY_TARGETS_PREFERENCE="ruby32 ruby31 " +RUBY_TARGETS_PREFERENCE="ruby32 " # All other active ruby targets RUBY_TARGETS_PREFERENCE+="ruby33 ruby34" diff --git a/eclass/rust.eclass b/eclass/rust.eclass index ae590284db33..e99fca94ac3d 100644 --- a/eclass/rust.eclass +++ b/eclass/rust.eclass @@ -68,7 +68,8 @@ fi # Definitive list of Rust slots and the associated LLVM slot, newest first. declare -A -g -r _RUST_LLVM_MAP=( ["9999"]=20 - ["1.86"]=19 + ["1.87.0"]=20 + ["1.86.0"]=19 ["1.85.1"]=19 ["1.85.0"]=19 ["1.84.1"]=19 @@ -83,7 +84,6 @@ declare -A -g -r _RUST_LLVM_MAP=( ["1.76.0"]=17 ["1.75.0"]=17 ["1.74.1"]=17 - ["1.71.1"]=16 ) # @ECLASS_VARIABLE: _RUST_SLOTS_ORDERED @@ -94,7 +94,8 @@ declare -A -g -r _RUST_LLVM_MAP=( # this array is used to store the Rust slots in a more convenient order for iteration. declare -a -g -r _RUST_SLOTS_ORDERED=( "9999" - "1.86" + "1.87.0" + "1.86.0" "1.85.1" "1.85.0" "1.84.1" @@ -109,7 +110,6 @@ declare -a -g -r _RUST_SLOTS_ORDERED=( "1.76.0" "1.75.0" "1.74.1" - "1.71.1" ) # == user control knobs == diff --git a/eclass/systemd.eclass b/eclass/systemd.eclass index f908ad688d9d..f0b4b79d9c32 100644 --- a/eclass/systemd.eclass +++ b/eclass/systemd.eclass @@ -1,4 +1,4 @@ -# Copyright 2011-2024 Gentoo Authors +# Copyright 2011-2025 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 # @ECLASS: systemd.eclass @@ -77,7 +77,7 @@ _systemd_unprefix() { systemd_get_systemunitdir() { debug-print-function ${FUNCNAME} "$@" - _systemd_get_dir systemdsystemunitdir /lib/systemd/system + _systemd_get_dir systemdsystemunitdir /usr/lib/systemd/system } # @FUNCTION: systemd_get_userunitdir @@ -99,7 +99,7 @@ systemd_get_userunitdir() { systemd_get_utildir() { debug-print-function ${FUNCNAME} "$@" - _systemd_get_dir systemdutildir /lib/systemd + _systemd_get_dir systemdutildir /usr/lib/systemd } # @FUNCTION: systemd_get_systemgeneratordir @@ -109,7 +109,7 @@ systemd_get_utildir() { systemd_get_systemgeneratordir() { debug-print-function ${FUNCNAME} "$@" - _systemd_get_dir systemdsystemgeneratordir /lib/systemd/system-generators + _systemd_get_dir systemdsystemgeneratordir /usr/lib/systemd/system-generators } # @FUNCTION: systemd_get_systempresetdir @@ -119,7 +119,7 @@ systemd_get_systemgeneratordir() { systemd_get_systempresetdir() { debug-print-function ${FUNCNAME} "$@" - _systemd_get_dir systemdsystempresetdir /lib/systemd/system-preset + _systemd_get_dir systemdsystempresetdir /usr/lib/systemd/system-preset } # @FUNCTION: systemd_get_sleepdir @@ -127,7 +127,7 @@ systemd_get_systempresetdir() { # Output the path for the system sleep directory. systemd_get_sleepdir() { debug-print-function ${FUNCNAME} "$@" - _systemd_get_dir systemdsleepdir /lib/systemd/system-sleep + _systemd_get_dir systemdsleepdir /usr/lib/systemd/system-sleep } # @FUNCTION: systemd_dounit diff --git a/eclass/tests/dot-a.sh b/eclass/tests/dot-a.sh new file mode 100755 index 000000000000..6a01ce5798b8 --- /dev/null +++ b/eclass/tests/dot-a.sh @@ -0,0 +1,466 @@ +#!/bin/bash +# Copyright 2025 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +source tests-common.sh || exit +source version-funcs.sh || exit + +inherit dot-a + +_create_test_progs() { + cat <<-EOF > a.c + int foo(); + + int foo() { + return 42; + } + EOF + + cat <<-EOF > main.c + #include <stdio.h> + int foo(); + + int main() { + printf("Got magic number: %d\n", foo()); + return 0; + } + EOF +} + +test_lto_guarantee_fat() { + # Check whether lto-guarantee-fat adds -ffat-lto-objects and it + # results in a successful link (and a failed link without it). + LDFLAGS="-fuse-ld=${linker}" + + $(tc-getCC) ${CFLAGS} -flto a.c -o a.o -c || die + $(tc-getCC) ${CFLAGS} ${LDFLAGS} -flto main.c a.o -o main || die + if ./main | grep -q "Got magic number: 42" ; then + :; + else + die "Pure LTO check failed" + fi + + tbegin "lto-guarantee-fat (CC=$(tc-getCC), linker=${linker}): check linking w/ fat LTO object w LTO" + ret=0 + ( + export CFLAGS="-O2 -flto" + lto-guarantee-fat + + $(tc-getCC) ${CFLAGS} a.c -o a.o -c 2>/dev/null || return 1 + $(tc-getCC) ${CFLAGS} ${LDFLAGS} main.c a.o 2>/dev/null || return 1 + ) || ret=1 + tend ${ret} "Linking LTO executable w/ fat object failed" + + tbegin "lto-guarantee-fat (CC=$(tc-getCC), linker=${linker}): check linking w/ fat LTO object w/o LTO" + ret=0 + ( + export CFLAGS="-O2 -flto" + lto-guarantee-fat + + # Linking here will fail if a.o isn't a fat object, as there's nothing + # to fall back on with -fno-lto. + $(tc-getCC) ${CFLAGS} a.c -o a.o -c 2>/dev/null || return 1 + $(tc-getCC) ${CFLAGS} ${LDFLAGS} -fno-lto main.c a.o 2>/dev/null || return 1 + ) || ret=1 + tend ${ret} "Linking non-LTO executable w/ fat object failed" + + tbegin "lto-guarantee-fat (CC=$(tc-getCC), linker=${linker}): check linking w/ fat LTO archive w LTO" + ret=0 + ( + export CFLAGS="-O2 -flto" + lto-guarantee-fat + + rm test.a 2>/dev/null + + $(tc-getCC) ${CFLAGS} a.c -o a.o -c 2>/dev/null || return 1 + $(tc-getAR) r test.a a.o 2>/dev/null || return 1 + $(tc-getCC) ${CFLAGS} ${LDFLAGS} main.c test.a 2>/dev/null || return 1 + ) || ret=1 + tend ${ret} "Linking LTO executable w/ fat archive failed" + + tbegin "lto-guarantee-fat (CC=$(tc-getCC), linker=${linker}): check linking w/ fat LTO archive w/o LTO" + ret=0 + ( + export CFLAGS="-O2 -flto" + lto-guarantee-fat + + rm test.a 2>/dev/null + + # Linking here will fail if a.o (-> test.a) isn't a fat object, as there's nothing + # to fall back on with -fno-lto. + $(tc-getCC) ${CFLAGS} a.c -o a.o -c 2>/dev/null || return 1 + $(tc-getAR) r test.a a.o 2>/dev/null || return 1 + $(tc-getCC) ${CFLAGS} ${LDFLAGS} -fno-lto main.c test.a 2>/dev/null || return 1 + ) || ret=1 + tend ${ret} "Linking non-LTO executable w/ fat archive failed" +} + +test_strip_lto_bytecode() { + # Check whether strip-lto-bytecode does its job on a single argument, but + # focus of this test is more basic, not checking all possible option + # handling. + # + # i.e. If we use strip-lto-bytecode, does it remove the LTO bytecode + # and allow linking? If we use it w/o -ffat-lto-objects, do we get + # a failed link as we expect? + LDFLAGS="-fuse-ld=${linker}" + + tbegin "strip-lto-bytecode (CC=$(tc-getCC), linker=${linker}): check that linking w/ stripped non-fat object breaks" + ret=0 + ( + export CFLAGS="-O2 -flto" + + # strip-lto-bytecode will error out early with LLVM, + # so stop the test here. + tc-is-clang && return 0 + + $(tc-getCC) ${CFLAGS} a.c -o a.o -c 2>/dev/null || return 1 + + # This should corrupt a.o and make linking below fail. + strip-lto-bytecode a.o + + $(tc-getCC) ${CFLAGS} ${LDFLAGS} main.c a.o -o main 2>/dev/null && return 1 + + return 0 + ) || ret=1 + tend ${ret} "Linking corrupted non-fat object unexpectedly worked" + + tbegin "strip-lto-bytecode (CC=$(tc-getCC), linker=${linker}): check that linking w/ stripped fat object works" + ret=0 + ( + export CFLAGS="-O2 -flto" + + lto-guarantee-fat + + $(tc-getCC) ${CFLAGS} a.c -o a.o -c 2>/dev/null || return 1 + + # This should NOT corrupt a.o, so linking below should succeed. + strip-lto-bytecode a.o + + $(tc-getCC) ${CFLAGS} ${LDFLAGS} main.c a.o -o main 2>/dev/null || return 1 + ) || ret=1 + tend ${ret} "Linking stripped fat object failed" + + tbegin "strip-lto-bytecode (CC=$(tc-getCC), linker=${linker}): check that linking w/ stripped non-fat archive breaks" + ret=0 + ( + export CFLAGS="-O2 -flto" + + rm test.a 2>/dev/null + + # strip-lto-bytecode will error out early with LLVM, + # so stop the test here. + tc-is-clang && return 0 + + $(tc-getCC) ${CFLAGS} a.c -o a.o -c 2>/dev/null || return 1 + $(tc-getAR) q test.a a.o 2>/dev/null || return 1 + + # This should corrupt a.o and make linking below fail. + strip-lto-bytecode test.a + + $(tc-getCC) ${CFLAGS} ${LDFLAGS} main.c test.a -o main 2>/dev/null && return 1 + + return 0 + ) || ret=1 + tend ${ret} "Linking corrupted non-fat object unexpectedly worked" + + tbegin "strip-lto-bytecode (CC=$(tc-getCC), linker=${linker}): check that linking w/ stripped fat archive works" + ret=0 + ( + export CFLAGS="-O2 -flto" + + rm test.a 2>/dev/null + + lto-guarantee-fat + + $(tc-getCC) ${CFLAGS} a.c -o a.o -c 2>/dev/null || return 1 + $(tc-getAR) q test.a a.o 2>/dev/null || return 1 + + # This should NOT corrupt a.o, so linking below should succeed. + strip-lto-bytecode test.a + + $(tc-getCC) ${CFLAGS} ${LDFLAGS} main.c test.a -o main 2>/dev/null || return 1 + ) || ret=1 + tend ${ret} "Linking stripped fat archive failed" +} + +test_mixed_objects_after_stripping() { + # Check whether mixing objects from two compilers (${CC_1} and ${CC_2}) + # fails without lto-guarantee-fat and strip-lto-bytecode and works + # once they're used. + LDFLAGS="-fuse-ld=${linker}" + + tbegin "strip-lto-bytecode (CC_1=${CC_1}, CC_2=${CC_2}, linker=${linker}): check that unstripped LTO objects from ${CC_1} fail w/ ${CC_2}" + ret=0 + ( + export CFLAGS="-O2 -flto" + + ${CC_1} ${CFLAGS} a.c -o a.o -c 2>/dev/null || return 1 + # Using CC_1 IR with CC_2 should fail. + ${CC_2} ${CFLAGS} ${LDFLAGS} main.c a.o -o main 2>/dev/null && return 1 + + return 0 + ) || ret=1 + tend ${ret} "Mixing unstripped objects unexpectedly worked" + + tbegin "strip-lto-bytecode (CC_1=${CC_1}, CC_2=${CC_2}, linker=${linker}): check that unstripped LTO objects from ${CC_2} fail w/ ${CC_1}" + ret=0 + ( + export CFLAGS="-O2 -flto" + + ${CC_2} ${CFLAGS} a.c -o a.o -c 2>/dev/null || return 1 + # Using CC_2 IR with CC_1 should fail. + ${CC_1} ${CFLAGS} ${LDFLAGS} main.c a.o -o main 2>/dev/null && return 1 + + return 0 + ) || ret=1 + tend ${ret} "Mixing unstripped objects unexpectedly worked" + + tbegin "strip-lto-bytecode (CC_1=${CC_1}, CC_2=${CC_2}, linker=${linker}): check that stripped LTO objects from ${CC_1} work w/ ${CC_2}" + ret=0 + ( + export CFLAGS="-O2 -flto" + + lto-guarantee-fat + ${CC_1} ${CFLAGS} a.c -o a.o -c 2>/dev/null || return 1 + # The object should now be "vendor-neutral" and work. + CC=${CC_1} strip-lto-bytecode a.o + ${CC_2} ${CFLAGS} ${LDFLAGS} main.c a.o -o main 2>/dev/null || return 1 + ) || ret=1 + tend ${ret} "Mixing stripped objects failed" + + tbegin "strip-lto-bytecode (CC_1=${CC_1}, CC_2=${CC_2}, linker=${linker}): check that stripped LTO objects from ${CC_2} work w/ ${CC_1}" + ret=0 + ( + export CFLAGS="-O2 -flto" + + lto-guarantee-fat + ${CC_2} ${CFLAGS} a.c -o a.o -c 2>/dev/null || return 1 + # The object should now be "vendor-neutral" and work. + CC=${CC_2} strip-lto-bytecode a.o + ${CC_1} ${CFLAGS} ${LDFLAGS} main.c a.o -o main 2>/dev/null || return 1 + ) || ret=1 + tend ${ret} "Mixing stripped objects failed" +} + +test_mixed_archives_after_stripping() { + # Check whether mixing archives from two compilers (${CC_1} and ${CC_2}) + # fails without lto-guarantee-fat and strip-lto-bytecode and works + # once they're used. + LDFLAGS="-fuse-ld=${linker}" + + tbegin "strip-lto-bytecode (CC_1=${CC_1}, CC_2=${CC_2}, linker=${linker}): check that unstripped LTO archives from ${CC_1} fail w/ ${CC_2}" + ret=0 + ( + export CFLAGS="-O2 -flto" + + rm test.a 2>/dev/null + + ${CC_1} ${CFLAGS} a.c -o a.o -c 2>/dev/null || return 1 + ${AR_1} r test.a a.o 2>/dev/null || return 1 + # Using CC_1 IR with CC_2 should fail. + ${CC_2} ${CFLAGS} ${LDFLAGS} main.c test.a -o main 2>/dev/null && return 1 + + return 0 + ) || ret=1 + tend ${ret} "Mixing unstripped archives unexpectedly worked" + + tbegin "strip-lto-bytecode (CC_1=${CC_1}, CC_2=${CC_2}, linker=${linker}): check that unstripped LTO archives from ${CC_2} fail w/ ${CC_1}" + ret=0 + ( + export CFLAGS="-O2 -flto" + + rm test.a 2>/dev/null + + ${CC_2} ${CFLAGS} a.c -o a.o -c 2>/dev/null || return 1 + ${AR_2} r test.a a.o 2>/dev/null || return 1 + # Using CC_2 IR with CC_1 should fail. + ${CC_1} ${CFLAGS} ${LDFLAGS} main.c test.a -o main 2>/dev/null && return 1 + + return 0 + ) || ret=1 + tend ${ret} "Mixing unstripped archives unexpectedly worked" + + tbegin "strip-lto-bytecode (CC_1=${CC_1}, CC_2=${CC_2}, linker=${linker}): check that stripped LTO archives from ${CC_1} work w/ ${CC_2}" + ret=0 + ( + export CFLAGS="-O2 -flto" + + rm test.a 2>/dev/null + + lto-guarantee-fat + ${CC_1} ${CFLAGS} a.c -o a.o -c 2>/dev/null || return 1 + ${AR_1} r test.a a.o 2>/dev/null || return 1 + # The object should now be "vendor-neutral" and work. + CC=${CC_1} strip-lto-bytecode test.a + ${CC_2} ${CFLAGS} ${LDFLAGS} main.c test.a -o main 2>/dev/null || return 1 + ) || ret=1 + tend ${ret} "Mixing stripped archives failed" + + tbegin "strip-lto-bytecode (CC_1=${CC_1}, CC_2=${CC_2}, linker=${linker}): check that stripped LTO archives from ${CC_2} work w/ ${CC_1}" + ret=0 + ( + export CFLAGS="-O2 -flto" + + rm test.a 2>/dev/null + + lto-guarantee-fat + ${CC_2} ${CFLAGS} a.c -o a.o -c 2>/dev/null || return 1 + ${AR_2} r test.a a.o 2>/dev/null || return 1 + # The object should now be "vendor-neutral" and work. + CC=${CC_2} strip-lto-bytecode test.a + ${CC_1} ${CFLAGS} ${LDFLAGS} main.c test.a -o main 2>/dev/null || return 1 + ) || ret=1 + tend ${ret} "Mixing stripped archives failed" +} + +_check_if_lto_object() { + # Adapted from tc-is-lto + local ret=1 + case $(tc-get-compiler-type) in + clang) + # 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 "$1" &>/dev/null && ret=0 + ;; + gcc) + [[ $($(tc-getREADELF) -S "$1") == *.gnu.lto* ]] && ret=0 + ;; + esac + return "${ret}" +} + +test_search_recursion() { + # Test whether the argument handling and logic of strip-lto-bytecode + # works as expected. + tbegin "whether default search behaviour of \${ED} works" + ret=0 + ( + CC=gcc + CFLAGS="-O2 -flto" + + rm foo.a 2>/dev/null + + _create_test_progs + lto-guarantee-fat + $(tc-getCC) ${CFLAGS} a.c -o a.o -c 2>/dev/null || return 1 + $(tc-getAR) q foo.a a.o 2>/dev/null || return 1 + + _check_if_lto_object "${tmpdir}/lto/foo.a" || return 1 + # It should search ${ED} if no arguments are passed, find + # the LTO'd foo.o, and strip it. + ED="${tmpdir}/lto" strip-lto-bytecode + # foo.a should be a regular object here. + _check_if_lto_object "${tmpdir}/lto/foo.a" && return 1 + + return 0 + ) || ret=1 + tend ${ret} "Unexpected LTO object found" + + tbegin "whether a single file argument works" + ret=0 + ( + CC=gcc + CFLAGS="-O2 -flto" + + rm foo.a 2>/dev/null + + _create_test_progs + lto-guarantee-fat + $(tc-getCC) ${CFLAGS} a.c -o a.o -c 2>/dev/null || return 1 + $(tc-getAR) r foo.a a.o 2>/dev/null || return 1 + + _check_if_lto_object "${tmpdir}/lto/foo.a" || return 1 + # It should search ${ED} if no arguments are passed, find + # the LTO'd foo.o, and strip it. + ED="${tmpdir}/lto" strip-lto-bytecode "${tmpdir}/lto/foo.a" + # foo.a should be a regular object here. + _check_if_lto_object "${tmpdir}/lto/foo.a" && return 1 + + return 0 + ) || ret=1 + tend ${ret} "Unexpected LTO object found" + + tbegin "whether a directory and file argument works" + ret=0 + ( + mkdir "${tmpdir}"/lto2 || die + + CC=gcc + CFLAGS="-O2 -flto" + + rm foo.a 2>/dev/null + + _create_test_progs + lto-guarantee-fat + $(tc-getCC) ${CFLAGS} "${tmpdir}"/lto/a.c -o "${tmpdir}"/lto/a.o -c 2>/dev/null || return 1 + $(tc-getAR) q foo.a a.o 2>/dev/null || return 1 + $(tc-getAR) q "${tmpdir}"/lto2/foo.a a.o 2>/dev/null || return 1 + + _check_if_lto_object "${tmpdir}/lto/foo.a" || return 1 + _check_if_lto_object "${tmpdir}/lto2/foo.a" || return 1 + # It should search ${ED} if no arguments are passed, find + # the LTO'd foo.o, and strip it. + ED="${tmpdir}/lto" strip-lto-bytecode "${tmpdir}/lto/foo.a" "${tmpdir}/lto2/foo.a" + # foo.a should be a regular object here. + _check_if_lto_object "${tmpdir}/lto/foo.a" && return 1 + _check_if_lto_object "${tmpdir}/lto2/foo.a" && return 1 + + return 0 + ) || ret=1 + tend ${ret} "Unexpected LTO object found" +} + +_repeat_tests_with_compilers() { + # Call test_lto_guarantee_fat and test_strip_lto_bytecode with + # various compilers and linkers. + for toolchain in gcc:ar clang:llvm-ar ; do + CC=${toolchain%:*} + AR=${toolchain#*:} + type -P ${CC} &>/dev/null || continue + type -P ${AR} &>/dev/null || continue + + for linker in gold bfd lld mold gold ; do + # lld doesn't support GCC LTO: https://github.com/llvm/llvm-project/issues/41791 + [[ ${CC} == gcc && ${linker} == lld ]] && continue + # Make sure the relevant linker is actually installed and usable. + LDFLAGS="-fuse-ld=${linker}" tc-ld-is-${linker} || continue + LDFLAGS="-fuse-ld=${linker}" test-compile 'c+ld' 'int main() { return 0; }' || continue + + test_lto_guarantee_fat + test_strip_lto_bytecode + done + done +} + +_repeat_mixed_tests_with_linkers() { + # Call test_mixed_objects_after_stripping with various linkers. + # + # Needs both GCC and Clang to test mixing their outputs. + if type -P gcc &>/dev/null && type -P clang &>/dev/null ; then + for linker in bfd lld mold gold ; do + # lld doesn't support GCC LTO: https://github.com/llvm/llvm-project/issues/41791 + [[ ${CC} == gcc && ${linker} == lld ]] && continue + # Make sure the relevant linker is actually installed and usable. + LDFLAGS="-fuse-ld=${linker}" tc-ld-is-${linker} || continue + LDFLAGS="-fuse-ld=${linker}" test-compile 'c+ld' 'int main() { return 0; }' || continue + + CC_1=gcc AR_1=ar + CC_2=clang AR_2=llvm-ar + test_mixed_objects_after_stripping + test_mixed_archives_after_stripping + done + fi +} + +# TODO: maybe test several files +mkdir -p "${tmpdir}/lto" || die +pushd "${tmpdir}/lto" >/dev/null || die +_create_test_progs +_repeat_tests_with_compilers +_repeat_mixed_tests_with_linkers +test_search_recursion +texit diff --git a/eclass/tests/edo.sh b/eclass/tests/edo.sh index cac03e0401ba..1fa8a7a9a026 100755 --- a/eclass/tests/edo.sh +++ b/eclass/tests/edo.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 1999-2024 Gentoo Authors +# Copyright 1999-2025 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 EAPI=8 @@ -13,6 +13,18 @@ make_some_noise() { echo "EoN" } +test_edo() { + local exp_ret=${1} exp_out=${2} cmd=("${@:3}") + local have_ret have_out + tbegin "edo -> ret: ${exp_ret}, out: ${exp_out}" + have_out=$(edo "${cmd[@]}" 2>&1) + have_ret=$? + have_out=${have_out%%$'\n'*} + have_out=${have_out# \* } + [[ ${have_ret} -eq ${exp_ret} && ${have_out} == "${exp_out}" ]] + tend $? "returned: ${have_ret}, output: ${have_out}" +} + test_edob_simple() { tbegin "edob with output test" ( @@ -105,6 +117,17 @@ test_edob_failure() { tend $? "Unexpected output, found \"${fourth_line_of_edob_out}\", expected \"quz\"" } +test_edo 0 "/bin/true foo" /bin/true foo +test_edo 1 "/bin/false bar" /bin/false bar +test_edo 0 "make_some_noise baz" make_some_noise baz +test_edo 0 ": 'foo bar' 'baz quux'" : 'foo bar' 'baz quux' +test_edo 0 ": @%:+,-=._ '\$'" : '@%:+,-=._' '$' +test_edo 0 ": 'foo;bar' 'baz*quux'" : 'foo;bar' 'baz*quux' +test_edo 0 ": '#foo' bar#baz 'qu=~ux'" : '#foo' 'bar#baz' 'qu=~ux' +test_edo 0 ": '\"' \\' 'foo'\\''bar'" : '"' "'" "foo'bar" +test_edo 0 ": '' ' ' \$'\\t' \$'\\001'" : '' ' ' $'\t' $'\x01' +test_edo 0 ": äöü" : 'äöü' + test_edob_simple test_edob_explicit_log_name test_edob_explicit_message diff --git a/eclass/tests/python-utils-r1.sh b/eclass/tests/python-utils-r1.sh index 4969da103566..17fd4bc24de7 100755 --- a/eclass/tests/python-utils-r1.sh +++ b/eclass/tests/python-utils-r1.sh @@ -62,9 +62,9 @@ test_fix_shebang() { tmpfile=$(mktemp) -inherit python-utils-r1 +inherit multilib python-utils-r1 -for minor in {10..13} 13t; do +for minor in {11..14} {13..14}t; do ebegin "Testing python3.${minor}" eindent test_var EPYTHON "python3_${minor}" "python3.${minor}" @@ -119,19 +119,6 @@ for minor in {10..13} 13t; do eoutdent done -ebegin "Testing pypy3" -eindent -test_var EPYTHON pypy3 pypy3 -test_var PYTHON pypy3 /usr/bin/pypy3 -if [[ -x /usr/bin/pypy3 ]]; then - test_var PYTHON_SITEDIR pypy3 "/usr/lib*/pypy3.*/site-packages" - test_var PYTHON_INCLUDEDIR pypy3 "/usr/include/pypy3.*" -fi -test_var PYTHON_PKG_DEP pypy3 '*dev-lang/pypy*:3.10=\[symlink\]' -PYTHON_REQ_USE=sqlite test_var PYTHON_PKG_DEP pypy3 '*dev-lang/pypy*:3.10=\[symlink,sqlite\]' -test_var PYTHON_SCRIPTDIR pypy3 /usr/lib/python-exec/pypy3 -eoutdent - for minor in 11; do ebegin "Testing pypy3.${minor}" eindent @@ -216,21 +203,40 @@ test_is "_python_impl_matches python3_6 python*" 0 test_is "_python_impl_matches python3_7 python*" 0 test_is "_python_impl_matches pypy3 python*" 1 set +f -test_is "_python_impl_matches python3_10 3.10" 0 -test_is "_python_impl_matches python3_10 3.11" 1 -test_is "_python_impl_matches python3_10 3.12" 1 test_is "_python_impl_matches python3_11 3.10" 1 test_is "_python_impl_matches python3_11 3.11" 0 test_is "_python_impl_matches python3_11 3.12" 1 test_is "_python_impl_matches python3_12 3.10" 1 test_is "_python_impl_matches python3_12 3.11" 1 test_is "_python_impl_matches python3_12 3.12" 0 -test_is "_python_impl_matches pypy3 3.10" 0 -test_is "_python_impl_matches pypy3 3.11" 1 -test_is "_python_impl_matches pypy3 3.12" 1 +test_is "_python_impl_matches python3_13 3.13" 0 +test_is "_python_impl_matches python3_13t 3.13" 0 +test_is "_python_impl_matches python3_13 3.14" 1 +test_is "_python_impl_matches python3_13t 3.14" 1 +test_is "_python_impl_matches python3_14 3.13" 1 +test_is "_python_impl_matches python3_14t 3.13" 1 +test_is "_python_impl_matches python3_14 3.14" 0 +test_is "_python_impl_matches python3_14t 3.14" 0 test_is "_python_impl_matches pypy3_11 3.10" 1 test_is "_python_impl_matches pypy3_11 3.11" 0 test_is "_python_impl_matches pypy3_11 3.12" 1 +# https://bugs.gentoo.org/955213 +test_is "_python_impl_matches python3_11 3.10 3.11" 0 +test_is "_python_impl_matches python3_11 3.11 3.12" 0 +test_is "_python_impl_matches python3_11 3.10 3.12" 1 +test_is "_python_impl_matches python3_11 3.10 3.11 3.12" 0 +test_is "_python_impl_matches python3_12 3.10 3.11" 1 +test_is "_python_impl_matches python3_12 3.11 3.12" 0 +test_is "_python_impl_matches python3_12 3.10 3.12" 0 +test_is "_python_impl_matches python3_12 3.10 3.11 3.12" 0 +test_is "_python_impl_matches python3_11 python3_10 python3_11" 0 +test_is "_python_impl_matches python3_11 python3_11 python3_12" 0 +test_is "_python_impl_matches python3_11 python3_10 python3_12" 1 +test_is "_python_impl_matches python3_11 python3_10 python3_11 python3_12" 0 +test_is "_python_impl_matches python3_12 python3_10 python3_11" 1 +test_is "_python_impl_matches python3_12 python3_11 python3_12" 0 +test_is "_python_impl_matches python3_12 python3_10 python3_12" 0 +test_is "_python_impl_matches python3_12 python3_10 python3_11 python3_12" 0 eoutdent rm "${tmpfile}" diff --git a/eclass/tests/systemd.sh b/eclass/tests/systemd.sh index f870df4b7a12..3b735c95bf6a 100755 --- a/eclass/tests/systemd.sh +++ b/eclass/tests/systemd.sh @@ -35,11 +35,11 @@ test_systemd_unprefix() { tend $? } -test_system_dir /lib/systemd/system systemd_get_systemunitdir -test_system_dir /lib/systemd systemd_get_utildir -test_system_dir /lib/systemd/system-generators systemd_get_systemgeneratordir -test_system_dir /lib/systemd/system-preset systemd_get_systempresetdir -test_system_dir /lib/systemd/system-sleep systemd_get_sleepdir +test_system_dir /usr/lib/systemd/system systemd_get_systemunitdir +test_system_dir /usr/lib/systemd systemd_get_utildir +test_system_dir /usr/lib/systemd/system-generators systemd_get_systemgeneratordir +test_system_dir /usr/lib/systemd/system-preset systemd_get_systempresetdir +test_system_dir /usr/lib/systemd/system-sleep systemd_get_sleepdir test_user_dir /usr/lib/systemd/user systemd_get_userunitdir diff --git a/eclass/toolchain-funcs.eclass b/eclass/toolchain-funcs.eclass index 754d23f91c06..baf032bbd4ec 100644 --- a/eclass/toolchain-funcs.eclass +++ b/eclass/toolchain-funcs.eclass @@ -21,8 +21,6 @@ case ${EAPI} in *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;; esac -inherit multilib - # tc-getPROG <VAR [search vars]> <default> [tuple] _tc-getPROG() { local tuple=$1 @@ -1147,139 +1145,6 @@ tc-enables-ssp-all() { tc-cpp-is-true "defined(__SSP_ALL__)" ${CPPFLAGS} ${CFLAGS} ${CXXFLAGS} } - -# @FUNCTION: gen_usr_ldscript -# @USAGE: [-a] <list of libs to create linker scripts for> -# @DESCRIPTION: -# This function is deprecated. Use the version from -# usr-ldscript.eclass instead. -gen_usr_ldscript() { - ewarn "${FUNCNAME}: Please migrate to usr-ldscript.eclass" - - local lib libdir=$(get_libdir) output_format="" auto=false suffix=$(get_libname) - - 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 - multilib_is_native_abi || return 0 - fi - - # Eventually we'd like to get rid of this func completely, bug #417451 - case ${CTARGET:-${CHOST}} in - *-darwin*) ;; - *-android*) return 0 ;; - *linux*) use prefix && return 0 ;; - *) return 0 ;; - esac - - # Just make sure it exists - dodir /usr/${libdir} - - if [[ $1 == "-a" ]] ; then - auto=true - shift - dodir /${libdir} - fi - - # OUTPUT_FORMAT gives hints to the linker as to what binary format - # is referenced ... makes multilib saner - local flags=( ${CFLAGS} ${LDFLAGS} -Wl,--verbose ) - if $(tc-getLD) --version | grep -q 'GNU gold' ; then - # If they're using gold, manually invoke the old bfd, bug #487696 - local d="${T}/bfd-linker" - mkdir -p "${d}" - ln -sf $(type -P ${CHOST}-ld.bfd) "${d}"/ld - flags+=( -B"${d}" ) - fi - output_format=$($(tc-getCC) "${flags[@]}" 2>&1 | sed -n 's/^OUTPUT_FORMAT("\([^"]*\)",.*/\1/p') - [[ -n ${output_format} ]] && output_format="OUTPUT_FORMAT ( ${output_format} )" - - for lib in "$@" ; do - local tlib - if ${auto} ; then - lib="lib${lib}${suffix}" - else - # Ensure /lib/${lib} exists to avoid dangling scripts/symlinks. - # This especially is for AIX where $(get_libname) can return ".a", - # so /lib/${lib} might be moved to /usr/lib/${lib} (by accident). - [[ -r ${ED}/${libdir}/${lib} ]] || continue - #TODO: better die here? - fi - - case ${CTARGET:-${CHOST}} in - *-darwin*) - if ${auto} ; then - tlib=$(scanmacho -qF'%S#F' "${ED}"/usr/${libdir}/${lib}) - else - tlib=$(scanmacho -qF'%S#F' "${ED}"/${libdir}/${lib}) - fi - [[ -z ${tlib} ]] && die "unable to read install_name from ${lib}" - tlib=${tlib##*/} - - if ${auto} ; then - mv "${ED}"/usr/${libdir}/${lib%${suffix}}.*${suffix#.} "${ED}"/${libdir}/ || die - # some install_names are funky: they encode a version - if [[ ${tlib} != ${lib%${suffix}}.*${suffix#.} ]] ; then - mv "${ED}"/usr/${libdir}/${tlib%${suffix}}.*${suffix#.} "${ED}"/${libdir}/ || die - fi - rm -f "${ED}"/${libdir}/${lib} - fi - - # Mach-O files have an id, which is like a soname, it tells how - # another object linking against this lib should reference it. - # Since we moved the lib from usr/lib into lib this reference is - # wrong. Hence, we update it here. We don't configure with - # libdir=/lib because that messes up libtool files. - # Make sure we don't lose the specific version, so just modify the - # existing install_name - if [[ ! -w "${ED}/${libdir}/${tlib}" ]] ; then - chmod u+w "${ED}${libdir}/${tlib}" # needed to write to it - local nowrite=yes - fi - install_name_tool \ - -id "${EPREFIX}"/${libdir}/${tlib} \ - "${ED}"/${libdir}/${tlib} || die "install_name_tool failed" - [[ -n ${nowrite} ]] && chmod u-w "${ED}${libdir}/${tlib}" - # Now as we don't use GNU binutils and our linker doesn't - # understand linker scripts, just create a symlink. - pushd "${ED}/usr/${libdir}" > /dev/null - ln -snf "../../${libdir}/${tlib}" "${lib}" - popd > /dev/null - ;; - *) - if ${auto} ; then - tlib=$(scanelf -qF'%S#F' "${ED}"/usr/${libdir}/${lib}) - [[ -z ${tlib} ]] && die "unable to read SONAME from ${lib}" - mv "${ED}"/usr/${libdir}/${lib}* "${ED}"/${libdir}/ || die - # some SONAMEs are funky: they encode a version before the .so - if [[ ${tlib} != ${lib}* ]] ; then - mv "${ED}"/usr/${libdir}/${tlib}* "${ED}"/${libdir}/ || die - fi - rm -f "${ED}"/${libdir}/${lib} - else - tlib=${lib} - fi - cat > "${ED}/usr/${libdir}/${lib}" <<-END_LDSCRIPT - /* GNU ld script - Since Gentoo has critical dynamic libraries in /lib, and the static versions - in /usr/lib, we need to have a "fake" dynamic lib in /usr/lib, otherwise we - run into linking problems. This "fake" dynamic lib is a linker script that - redirects the linker to the real lib. And yes, this works in the cross- - compiling scenario as the sysroot-ed linker will prepend the real path. - - See bug https://bugs.gentoo.org/4411 for more info. - */ - ${output_format} - GROUP ( ${EPREFIX}/${libdir}/${tlib} ) - END_LDSCRIPT - ;; - esac - fperms a+x "/usr/${libdir}/${lib}" || die "could not change perms on ${lib}" - done -} - # @FUNCTION: tc-get-cxx-stdlib # @DESCRIPTION: # Attempt to identify the C++ standard library used by the compiler. @@ -1291,7 +1156,12 @@ gen_usr_ldscript() { # # If the library is not recognized, the function returns 1. tc-get-cxx-stdlib() { - local code='#include <ciso646> + local code=' +#if __cplusplus >= 202002L + #include <version> +#else + #include <ciso646> +#endif #if defined(_LIBCPP_VERSION) HAVE_LIBCXX diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass index bf883c5370fc..2d903f992b17 100644 --- a/eclass/toolchain.eclass +++ b/eclass/toolchain.eclass @@ -1139,6 +1139,15 @@ toolchain_setup_ada() { ! tc-is-cross-compiler && _toolchain_make_gnat_wrappers export CC="$(tc-getCC) -specs=${T}/ada.spec" + + if ver_test ${PV} -lt 13 && [[ ${CTARGET} == hppa* ]] ; then + # For HPPA, the ada-bootstrap binaries seem to default + # to -fstack-protector still (maybe because of cross-building) + # so we need to override it for <13 (which ignores -fstack-protector) + # as SSP doesn't exist there. The GNAT configure test gets confused + # by GCC warning about this otherwise. + CC+=" -fno-stack-protector" + fi } # @FUNCTION: toolchain_setup_d @@ -1191,7 +1200,25 @@ toolchain_src_configure() { local flag for flag in $(all-flag-vars) ; do - einfo "${flag}=\"${!flag}\"" + [[ -n ${!flag} ]] && einfo "${flag}=\"${!flag}\"" + + local stage_flag="STAGE1_${flag}" + [[ -n ${!stage_flag} ]] && einfo "${stage_flag}=\"${!stage_flag}\"" + + stage_flag="STAGE2_${flag}" + [[ -n ${!stage_flag} ]] && einfo "${stage_flag}=\"${!stage_flag}\"" + + stage_flag="STAGE3_${flag}" + [[ -n ${!stage_flag} ]] && einfo "${stage_flag}=\"${!stage_flag}\"" + + local boot_flag="BOOT_${flag}" + [[ -n ${!boot_flag} ]] && einfo "${boot_flag}=\"${!boot_flag}\"" + + local target_flag="${flag}_FOR_TARGET" + [[ -n ${!target_flag} ]] && einfo "${target_flag}=\"${!target_flag}\"" + + local build_flag="${flag}_FOR_BUILD" + [[ -n ${!build_flag} ]] && einfo "${build_flag}=\"${!build_flag}\"" done local confgcc=( --host=${CHOST} ) @@ -1834,7 +1861,7 @@ toolchain_src_configure() { fi if [[ ${CTARGET} != *-darwin* ]] && tc_version_is_at_least 14.1 ; then - # This allows passing -stdlib-=libc++ at runtime. + # This allows passing -stdlib=libc++ at runtime. confgcc+=( --with-gxx-libcxx-include-dir="${ESYSROOT}"/usr/include/c++/v1 ) fi @@ -1842,7 +1869,7 @@ toolchain_src_configure() { if [[ ${PV} == *_p* && -f "${S}"/gcc/doc/gcc.info ]] ; then # Safeguard against https://gcc.gnu.org/PR106899 being fixed # without corresponding ebuild changes. - eqawarn "Snapshot release with pre-generated info pages found!" + eqawarn "QA Notice: Snapshot release with pre-generated info pages found!" eqawarn "The BDEPEND in the ebuild should be updated to drop texinfo." fi @@ -1915,16 +1942,24 @@ toolchain_src_configure() { --disable-systemtap --enable-host-shared - --enable-languages=jit # Might be used for the just-built GCC. Easier to just # respect USE=graphite here in case the user passes some # graphite flags rather than try strip them out. $(use_with graphite isl) - $(use_with zstd) --with-system-zlib ) + if is_jit ; then + confgcc_jit+=( --enable-languages=jit ) + else + confgcc_jit+=( --enable-languages=c,c++ ) + fi + + if tc_has_feature zstd ; then + confgcc_jit+=( $(use_with zstd) ) + fi + if tc_version_is_at_least 15.0.0_pre20241124 ${PV} ; then confgcc_jit+=( $(use_enable libgdiagnostics) ) fi @@ -2122,8 +2157,6 @@ gcc_do_filter_flags() { -fharden-control-flow-redundancy -fno-harden-control-flow-redundancy \ -fhardcfr-skip-leaf -fhardcfr-check-exceptions \ -fhardcfr-check-returning-calls '-fhardcfr-check-noreturn-calls=*' - - # New in GCC 14. filter-flags -Walloc-size fi @@ -2132,10 +2165,9 @@ gcc_do_filter_flags() { filter-flags -fdiagnostics-set-output=text:experimental-nesting=yes fi - if is_d ; then - # bug #940750 - filter-flags -Warray-bounds - fi + # Ada: PR116226 + # D: PR117002 (bug #940750) + filter-flags -Warray-bounds # Please use USE=lto instead (bug #906007). filter-lto @@ -2309,15 +2341,19 @@ gcc_do_make() { # to keep this bound somewhat fresh just to avoid problems. Ultimately, # using not-O0 is just a build-time speed improvement anyway. if ! tc-is-gcc || ver_test $(gcc-fullversion) -lt 10 ; then + einfo "Resetting STAGE1_*FLAGS to -O0 because of old or non-GCC bootstrap compiler" STAGE1_CFLAGS="-O0" STAGE1_CXXFLAGS="-O0" + STAGE1_GDCFLAGS="-O0" # We have a very good host compiler but it may be a bit too good, and # know about flags that the version we are compiling does not know # about. In principle we could check e.g. which gnat1 we are using as # a bootstrap. It's simpler to do it unconditionally for now. - elif _tc_use_if_iuse ada || _tc_use_if_iuse d; then + elif _tc_use_if_iuse ada || _tc_use_if_iuse d ; then + einfo "Resetting STAGE1_*FLAGS to -O2 for Ada/D bootstrapping" STAGE1_CFLAGS="-O2" STAGE1_CXXFLAGS="-O2" + STAGE1_GDCFLAGS="-O2" fi # We only want to use the system's CFLAGS if not building a @@ -2325,23 +2361,27 @@ gcc_do_make() { STAGE1_CFLAGS=${STAGE1_CFLAGS-"$(get_abi_CFLAGS ${TARGET_DEFAULT_ABI}) ${CFLAGS}"} # multilib.eclass lacks get_abi_CXXFLAGS (bug #940501) STAGE1_CXXFLAGS=${STAGE1_CXXFLAGS-"$(get_abi_CFLAGS ${TARGET_DEFAULT_ABI}) ${CXXFLAGS}"} + # Default to CFLAGS for GDCFLAGS if unset + STAGE1_GDCFLAGS=${STAGE1_GDCFLAGS-"$(get_abi_CFLAGS ${TARGET_DEFAULT_ABI}) ${CFLAGS}"} STAGE1_LDFLAGS=${STAGE1_LDFLAGS-"${abi_ldflags} ${LDFLAGS}"} BOOT_CFLAGS=${BOOT_CFLAGS-"$(get_abi_CFLAGS ${TARGET_DEFAULT_ABI}) ${CFLAGS}"} BOOT_LDFLAGS=${BOOT_LDFLAGS-"${abi_ldflags} ${LDFLAGS}"} LDFLAGS_FOR_TARGET="${LDFLAGS_FOR_TARGET:-${LDFLAGS}}" - # If we need to in future, we could really simplify this - # to just be unconditional for stage1. It doesn't really - # matter there. If we want to go in the other direction - # and make this more conditional, we could check if - # the bootstrap compiler is < GCC 12. See bug #940470. if _tc_use_if_iuse d && use hardened ; then + # If we need to in future, we could really simplify this + # to just be unconditional for stage1. It doesn't really + # matter there. If we want to go in the other direction + # and make this more conditional, we could check if + # the bootstrap compiler is < GCC 12. See bug #940470. + einfo "Adding -U_GLIBCXX_ASSERTIONS workaround to STAGE1_CXXFLAGS for D/hardened" STAGE1_CXXFLAGS+=" -U_GLIBCXX_ASSERTIONS" fi emakeargs+=( STAGE1_CFLAGS="${STAGE1_CFLAGS}" STAGE1_CXXFLAGS="${STAGE1_CXXFLAGS}" + STAGE1_GDCFLAGS="${STAGE1_GDCFLAGS}" STAGE1_LDFLAGS="${STAGE1_LDFLAGS}" BOOT_CFLAGS="${BOOT_CFLAGS}" BOOT_LDFLAGS="${BOOT_LDFLAGS}" @@ -2349,7 +2389,7 @@ gcc_do_make() { ) fi - if is_jit ; then + if is_jit || _tc_use_if_iuse libgdiagnostics ; then # TODO: docs for jit? einfo "Building JIT" emake -C "${WORKDIR}"/build-jit "${emakeargs[@]}" @@ -2551,7 +2591,7 @@ toolchain_src_install() { done < <(find gcc/include*/ -name '*.h') fi - if is_jit ; then + if is_jit || _tc_use_if_iuse libgdiagnostics ; then # See https://gcc.gnu.org/onlinedocs/gcc-11.3.0/jit/internals/index.html#packaging-notes # and bug #843341. # @@ -2749,6 +2789,8 @@ toolchain_src_install() { # Don't scan .gox files for executable stacks - false positives export QA_EXECSTACK="usr/lib*/go/*/*.gox" export QA_WX_LOAD="usr/lib*/go/*/*.gox" + # Workaround bug #793770 + export QA_PRESTRIPPED="usr/lib*/go/*/*/*.gox" # Disable RANDMMAP so PCH works, bug #301299 pax-mark -r "${ED}/libexec/gcc/${CTARGET}/${GCC_CONFIG_VER}/cc1" @@ -2778,9 +2820,16 @@ gcc_movelibs() { # libgccjit gets installed to /usr/lib, not /usr/$(get_libdir). Probably # due to a bug in gcc build system. - if [[ ${PWD} == "${WORKDIR}"/build-jit ]] && is_jit ; then + if [[ ${PWD} == "${WORKDIR}"/build-jit ]] ; then dodir "${LIBPATH#${EPREFIX}}" - mv "${ED}"/usr/lib/libgccjit* "${D}${LIBPATH}" || die + + if is_jit ; then + mv "${ED}"/usr/lib/libgccjit* "${D}${LIBPATH}" || die + fi + + if _tc_use_if_iuse libgdiagnostics ; then + mv "${ED}"/usr/lib/libgdiagnostics* "${D}${LIBPATH}" || die + fi fi # For all the libs that are built for CTARGET, move them into the diff --git a/eclass/wine.eclass b/eclass/wine.eclass new file mode 100644 index 000000000000..1f5885d89c6f --- /dev/null +++ b/eclass/wine.eclass @@ -0,0 +1,477 @@ +# Copyright 2025 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +# @ECLASS: wine.eclass +# @MAINTAINER: +# Wine <wine@gentoo.org> +# @AUTHOR: +# Ionen Wolkens <ionen@gentoo.org> +# @SUPPORTED_EAPIS: 8 +# @BLURB: Common functions for app-emuluation/wine-* ebuilds +# @DESCRIPTION: +# Given the large amount of Wine ebuilds (and variants) that need +# duplicated code, this is used to offload the more complex bits +# (primarily toolchain and slotting) and leave ebuilds to only need +# to deal with dependencies and configure options like any other. +# +# Note to overlays: this can be used to package other variants of +# Wine, but there is currently no garantee that eclass changes may +# not break these ebuilds now and then without real warnings + +case ${EAPI} in + 8) ;; + *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;; +esac + +if [[ -z ${_WINE_ECLASS} ]]; then +_WINE_ECLASS=1 + +inherit autotools flag-o-matic multilib prefix toolchain-funcs wrapper + +# @ECLASS_VARIABLE: WINE_USEDEP +# @DESCRIPTION: +# Meant be used like multilib-build.eclass' MULTILIB_USEDEP. Handled +# specially here given Wine ebuilds are not *really* multilib and are +# abusing abi_x86_* with some specific requirements. +# +# TODO: when the *new* wow64 mode (aka USE=wow64) is mature enough to +# be preferred over abi_x86_32, this should be removed and support for +# 32bit-only-on-64bit be dropped matching how /no-multilib/ handles it +# (USE=wow64 should be enabled by default on amd64 then, but not arm64) +readonly WINE_USEDEP="abi_x86_32(-)?,abi_x86_64(-)?" + +IUSE=" + +abi_x86_32 +abi_x86_64 crossdev-mingw custom-cflags + +mingw +strip wow64 +" +REQUIRED_USE=" + || ( abi_x86_32 abi_x86_64 arm64 ) + crossdev-mingw? ( mingw ) + wow64? ( !arm64? ( abi_x86_64 !abi_x86_32 ) ) +" + +BDEPEND=" + || ( + sys-devel/binutils:* + llvm-core/lld:* + ) + dev-lang/perl + mingw? ( + !crossdev-mingw? ( + wow64? ( dev-util/mingw64-toolchain[abi_x86_32] ) + !wow64? ( dev-util/mingw64-toolchain[${WINE_USEDEP}] ) + ) + ) + !mingw? ( + llvm-core/clang:* + llvm-core/lld:* + strip? ( llvm-core/llvm:* ) + ) +" +IDEPEND=">=app-eselect/eselect-wine-2" + +# @ECLASS_VARIABLE: WINE_SKIP_INSTALL +# @DESCRIPTION: +# Array of files to delete from the installation relative +# to ${ED}, must be set before running wine_src_install. +WINE_SKIP_INSTALL=() + +# @FUNCTION: wine_pkg_pretend +# @DESCRIPTION: +# Verifies if crossdev-mingw is used properly, ignored if +# ``MINGW_BYPASS`` is set. +wine_pkg_pretend() { + [[ ${MERGE_TYPE} == binary ]] && return + + if use crossdev-mingw && [[ ! -v MINGW_BYPASS ]]; then + local arches=( + $(usev abi_x86_64 x86_64) + $(usev abi_x86_32 i686) + $(usev wow64 i686) + $(usev arm64 aarch64) + ) + + local mingw + for mingw in "${arches[@]/%/-w64-mingw32}"; do + if ! type -P ${mingw}-gcc >/dev/null; then + eerror "With USE=crossdev-mingw, you must prepare the MinGW toolchain" + eerror "yourself by installing sys-devel/crossdev then running:" + eerror + eerror " crossdev --target ${mingw}" + eerror + eerror "For more information, please see: https://wiki.gentoo.org/wiki/Mingw" + die "USE=crossdev-mingw is enabled, but ${mingw}-gcc was not found" + fi + done + fi +} + +# @FUNCTION: wine_src_prepare +# @DESCRIPTION: +# Apply various minor adjustments, run eautoreconf, make_requests, and +# perform a version mismatch sanity check if WINE_GECKO and WINE_MONO +# are set. +# +# If need more than make_requests, it should be either handled in +# the ebuild or (for users) optionally through portage hooks, e.g. +# +# @CODE +# echo "post_src_prepare() { tools/make_specfiles || die; }" \ +# > /etc/portage/env/app-emulation/wine-vanilla +# @CODE +wine_src_prepare() { + default + + if [[ ${WINE_GECKO} && ${WINE_MONO} ]]; then + # sanity check, bumping these has a history of oversights + local geckomono=$(sed -En '/^#define (GECKO|MONO)_VER/{s/[^0-9.]//gp}' \ + dlls/appwiz.cpl/addons.c || die) + + if [[ ${WINE_GECKO}$'\n'${WINE_MONO} != "${geckomono}" ]]; then + local gmfatal= + has live ${PROPERTIES} && gmfatal=nonfatal + ${gmfatal} die -n "gecko/mono mismatch in ebuild, has: " ${geckomono} " (please file a bug)" + fi + fi + + if tc-is-clang && use mingw; then + # -mabi=ms was ignored by <clang:16 then turned error in :17 + # if used without --target *-windows, then gets used in install + # phase despite USE=mingw, drop as a quick fix for now + sed -i '/MSVCRTFLAGS=/s/-mabi=ms//' configure.ac || die + fi + + # ensure .desktop calls this variant + slot + sed -i "/^Exec=/s/wine /${P} /" loader/wine.desktop || die + + # needed to find wine-mono on prefix + hprefixify -w /get_mono_path/ dlls/mscoree/metahost.c + + # always update for patches (including user's wrt #432348) + eautoreconf + tools/make_requests || die # perl +} + +# @FUNCTION: wine_src_configure +# @DESCRIPTION: +# Setup toolchain and run ./configure by passing the ``wineconfargs`` +# array. +# +# The following options are handled automatically and do not need +# to be passed: --prefix (and similar), --enable-archs, --enable-win64 +# --with-mingw, and --with-wine64 +# +# Can adjust cross toolchain using CROSSCC, CROSSCC_amd64/x86/arm64, +# CROSS{C,LD}FLAGS, and CROSS{C,LD}FLAGS_amd64/x86/arm64 (variable +# naming is mostly historical because wine itself used to recognize +# CROSSCC). By default it attempts to use same {C,LD}FLAGS as the +# main toolchain but will strip known unsupported flags. +wine_src_configure() { + WINE_PREFIX=/usr/lib/${P} + WINE_DATADIR=/usr/share/${P} + WINE_INCLUDEDIR=/usr/include/${P} + + local conf=( + --prefix="${EPREFIX}"${WINE_PREFIX} + --datadir="${EPREFIX}"${WINE_DATADIR} + --includedir="${EPREFIX}"${WINE_INCLUDEDIR} + --libdir="${EPREFIX}"${WINE_PREFIX} + --mandir="${EPREFIX}"${WINE_DATADIR}/man + ) + + # strip-flags due to being generally fragile + use custom-cflags || strip-flags + + # longstanding failing to build with lto, filter unconditionally + filter-lto + + # may segfault at runtime if used (bug #931329) + filter-flags -Wl,--gc-sections + + # avoid gcc-15's c23 default for now (bug #943849) + # TODO: verify if still needed and limit to old until cleanup + append-cflags -std=gnu17 + + # Wine uses many linker tricks that are unlikely to work + # with anything but bfd or lld (bug #867097) + if ! tc-ld-is-bfd && ! tc-ld-is-lld; then + has_version -b sys-devel/binutils && + append-ldflags -fuse-ld=bfd || + append-ldflags -fuse-ld=lld + strip-unsupported-flags + fi + + # wcc_* variables are used by _wine_flags(), see that + # function if need to adjust *FLAGS only for cross + local wcc_{amd64,x86,arm64}{,_testflags} + # TODO?: llvm-mingw support if ever packaged and wanted + if use mingw; then + conf+=( --with-mingw ) + + use !crossdev-mingw && + ! has_version -b 'dev-util/mingw64-toolchain[bin-symlinks]' && + PATH=${BROOT}/usr/lib/mingw64-toolchain/bin:${PATH} + + wcc_amd64=${CROSSCC:-${CROSSCC_amd64:-x86_64-w64-mingw32-gcc}} + wcc_x86=${CROSSCC:-${CROSSCC_x86:-i686-w64-mingw32-gcc}} + # no mingw64-toolchain ~arm64, but "may" be usable with crossdev + # (aarch64- rather than arm64- given it is what Wine searches for) + wcc_arm64=${CROSSCC:-${CROSSCC_arm64:-aarch64-w64-mingw32-gcc}} + else + conf+=( --with-mingw=clang ) + + # not building for ${CHOST} so $(tc-getCC) is not quite right, but + # *should* support -target *-windows regardless (testflags is only + # used by _wine_flags(), wine handles -target by itself) + tc-is-clang && local clang=$(tc-getCC) || local clang=clang + wcc_amd64=${CROSSCC:-${CROSSCC_amd64:-${clang}}} + wcc_amd64_testflags="-target x86_64-windows" + wcc_x86=${CROSSCC:-${CROSSCC_x86:-${clang}}} + wcc_x86_testflags="-target i386-windows" + wcc_arm64=${CROSSCC:-${CROSSCC_arm64:-${clang}}} + wcc_arm64_testflags="-target aarch64-windows" + + # do not copy from regular LDFLAGS given odds are they all are + # incompatible, and difficult to test linking without llvm-mingw + : "${CROSSLDFLAGS:= }" + fi + + conf+=( + ac_cv_prog_x86_64_CC="${wcc_amd64}" + ac_cv_prog_i386_CC="${wcc_x86}" + ac_cv_prog_aarch64_CC="${wcc_arm64}" + ) + + if ver_test -ge 10; then + # TODO: merge with the av_cv array above when <wine-10 is gone + conf+=( + # if set, use CROSS*FLAGS as-is without filtering + x86_64_CFLAGS="${CROSSCFLAGS_amd64:-${CROSSCFLAGS:-$(_wine_flags c amd64)}}" + x86_64_LDFLAGS="${CROSSLDFLAGS_amd64:-${CROSSLDFLAGS:-$(_wine_flags ld amd64)}}" + i386_CFLAGS="${CROSSCFLAGS_x86:-${CROSSCFLAGS:-$(_wine_flags c x86)}}" + i386_LDFLAGS="${CROSSLDFLAGS_x86:-${CROSSLDFLAGS:-$(_wine_flags ld x86)}}" + aarch64_CFLAGS="${CROSSCFLAGS_arm64:-${CROSSCFLAGS:-$(_wine_flags c arm64)}}" + aarch64_LDFLAGS="${CROSSLDFLAGS_arm64:-${CROSSLDFLAGS:-$(_wine_flags ld arm64)}}" + ) + elif use abi_x86_64; then + conf+=( + # per-arch flags are only respected with >=wine-10, + # do a one-arch best effort fallback + CROSSCFLAGS="${CROSSCFLAGS_amd64:-${CROSSCFLAGS:-$(_wine_flags c amd64)}}" + CROSSLDFLAGS="${CROSSLDFLAGS_amd64:-${CROSSLDFLAGS:-$(_wine_flags ld amd64)}}" + ) + elif use abi_x86_32; then + conf+=( + CROSSCFLAGS="${CROSSCFLAGS_x86:-${CROSSCFLAGS:-$(_wine_flags c x86)}}" + CROSSLDFLAGS="${CROSSLDFLAGS_x86:-${CROSSLDFLAGS:-$(_wine_flags ld x86)}}" + ) + fi + + if use abi_x86_64 && use abi_x86_32 && use !wow64; then + # multilib dual build method for "old" wow64 (must do 64 first) + local bits + for bits in 64 32; do + ( + einfo "Configuring for ${bits}bits in ${WORKDIR}/build${bits} ..." + + mkdir ../build${bits} || die + cd ../build${bits} || die + + if (( bits == 64 )); then + conf+=( --enable-win64 ) + else + conf+=( + --with-wine64=../build64 + TARGETFLAGS=-m32 # for widl + ) + + # optional, but prefer over Wine's auto-detect (+#472038) + multilib_toolchain_setup x86 + fi + + ECONF_SOURCE=${S} econf "${conf[@]}" "${wineconfargs[@]}" + ) + done + else + # new --enable-archs method, or 32bit-only + local archs=( + $(usev abi_x86_64 x86_64) + $(usev wow64 i386) # 32-on-64bit "new" wow64 + $(usev arm64 aarch64) + ) + conf+=( ${archs:+--enable-archs="${archs[*]}"} ) + + econf "${conf[@]}" "${wineconfargs[@]}" + fi +} + +# @FUNCTION: wine_src_compile +# @DESCRIPTION: +# Handle running emake. +wine_src_compile() { + if use abi_x86_64 && use abi_x86_32 && use !wow64; then + emake -C ../build64 # do first + emake -C ../build32 + else + emake + fi +} + +# @FUNCTION: wine_src_install +# @DESCRIPTION: +# Handle running emake install, creating slot wrappers, and +# stripping binaries built for Windows. +wine_src_install() { + if use abi_x86_64 && use abi_x86_32 && use !wow64; then + emake DESTDIR="${D}" -C ../build32 install + emake DESTDIR="${D}" -C ../build64 install # do last + else + emake DESTDIR="${D}" install + fi + + if use abi_x86_64 || use arm64; then + if ver_test -ge 10.2; then + # wine64 was removed, but keep a symlink for old scripts + # TODO: can remove this -e guard eventually, only there to + # avoid overwriting 9999's wine64 if go into <10.2 commits + [[ ! -e ${ED}${WINE_PREFIX}/bin/wine64 ]] && + dosym wine ${WINE_PREFIX}/bin/wine64 + else + # <wine-10.2 did not have a unified wine(1) and could miss + # wine64 or wine depending on USE, ensure both are are there + if [[ -e ${ED}${WINE_PREFIX}/bin/wine64 && ! -e ${ED}${WINE_PREFIX}/bin/wine ]]; then + dosym wine64 ${WINE_PREFIX}/bin/wine + dosym wine64-preloader ${WINE_PREFIX}/bin/wine-preloader + elif [[ ! -e ${ED}${WINE_PREFIX}/bin/wine64 && -e ${ED}${WINE_PREFIX}/bin/wine ]]; then + dosym wine ${WINE_PREFIX}/bin/wine64 + dosym wine-preloader ${WINE_PREFIX}/bin/wine64-preloader + fi + fi + fi + + # delete unwanted files if requested, not done directly in ebuilds + # given must be done after install and before wrappers + if (( ${#WINE_SKIP_INSTALL[@]} )); then + rm -- "${WINE_SKIP_INSTALL[@]/#/${ED}}" || die + fi + + # create variant wrappers for eselect-wine + local bin + for bin in "${ED}"${WINE_PREFIX}/bin/*; do + make_wrapper "${bin##*/}-${P#wine-}" "${bin#"${ED}"}" + done + + # don't let the package manager try to strip Windows files with + # potentially the wrong strip executable and instead handle it here + dostrip -x ${WINE_PREFIX}/wine/{x86_64,i386,aarch64}-windows + + if use strip; then + ebegin "Stripping Windows binaries" + if use mingw; then + : "$(usex arm64 aarch64 $(usex abi_x86_64 x86_64 i686)-w64-mingw32-strip)" + find "${ED}"${WINE_PREFIX}/wine/*-windows -regex '.*\.\(a\|dll\|exe\)' \ + -exec ${_} --strip-unneeded {} + + else + # llvm-strip errors on .a, and CHOST binutils strip could mangle + find "${ED}"${WINE_PREFIX}/wine/*-windows -regex '.*\.\(dll\|exe\)' \ + -exec llvm-strip --strip-unneeded {} + + fi + eend ${?} || die + fi +} + +# @FUNCTION: wine_pkg_postinst +# @DESCRIPTION: +# Provide generic warnings about missing 32bit support, +# and run eselect wine update. +wine_pkg_postinst() { + # on amd64, users sometime disable the default 32bit support due to being + # annoyed by the requirements without realizing that they need it + if use amd64 && use !abi_x86_32 && use !wow64; then + ewarn + ewarn "32bit support is disabled. While 64bit applications themselves will" + ewarn "work, be warned that it is not unusual that installers or other helpers" + ewarn "will attempt to use 32bit and fail. If do not want full USE=abi_x86_32," + ewarn "note the experimental USE=wow64 can allow 32bit without full multilib." + fi + + # difficult to tell what is needed from here, but try to warn anyway + if use abi_x86_32 && { use opengl || use vulkan; }; then + if has_version 'x11-drivers/nvidia-drivers'; then + if has_version 'x11-drivers/nvidia-drivers[-abi_x86_32]'; then + ewarn + ewarn "x11-drivers/nvidia-drivers is installed but is built without" + ewarn "USE=abi_x86_32 (ABI_X86=32), hardware acceleration with 32bit" + ewarn "applications under ${PN} will likely not be usable." + ewarn "Multi-card setups may need this on media-libs/mesa as well." + fi + elif has_version 'media-libs/mesa[-abi_x86_32]'; then + ewarn + ewarn "media-libs/mesa seems to be in use but is built without" + ewarn "USE=abi_x86_32 (ABI_X86=32), hardware acceleration with 32bit" + ewarn "applications under ${PN} will likely not be usable." + fi + fi + + if use arm64 && use wow64; then + ewarn + ewarn "${PN} does not include an x86 emulator, running x86 binaries" + ewarn "with USE=wow64 on arm64 requires manually setting up xtajit.dll" + ewarn "(not packaged) in the Wine prefix." + fi + + eselect wine update --if-unset || die +} + +# @FUNCTION: wine_pkg_postrm +# @DESCRIPTION: +# Run eselect wine update if available. +wine_pkg_postrm() { + if has_version -b app-eselect/eselect-wine; then + eselect wine update --if-unset || die + fi +} + +# @FUNCTION: _wine_flags +# @USAGE: <c|ld> <arch> +# @INTERNAL +# @DESCRIPTION: +# Filter and test current {C,LD}FLAGS for usage with the cross +# toolchain (using ``wcc_*`` variables, see wine_src_configure), +# and echo back working flags. +# +# Note that this ignores checking USE for simplicity, if compiler +# is unusable (e.g. not found) then it will return empty flags +# which is fine. +_wine_flags() { + local -n wcc=wcc_${2} wccflags=wcc_${2}_testflags + + case ${1} in + c) + # many hardening options are unlikely to work right + filter-flags '-fstack-protector*' #870136 + filter-flags '-mfunction-return=thunk*' #878849 + + # bashrc-mv users often do CFLAGS="${LDFLAGS}" and then + # compile-only tests miss stripping unsupported linker flags + filter-flags '-Wl,*' + + # -mavx with mingw-gcc has a history of problems and still see + # users have issues despite Wine's -mpreferred-stack-boundary=2 + use mingw && append-cflags -mno-avx + + # same as strip-unsupported-flags but echos only for CC + CC="${wcc} ${wccflags}" test-flags-CC ${CFLAGS} + ;; + ld) + # let compiler figure out the right linker for cross + filter-flags '-fuse-ld=*' + + CC="${wcc} ${wccflags}" test-flags-CCLD ${LDFLAGS} + ;; + esac +} + +fi + +EXPORT_FUNCTIONS pkg_pretend src_prepare src_configure src_compile src_install pkg_postinst pkg_postrm diff --git a/eclass/wxwidgets.eclass b/eclass/wxwidgets.eclass index 0a58c44bbf40..7afea401a646 100644 --- a/eclass/wxwidgets.eclass +++ b/eclass/wxwidgets.eclass @@ -1,4 +1,4 @@ -# Copyright 1999-2023 Gentoo Authors +# Copyright 1999-2025 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 # @ECLASS: wxwidgets.eclass @@ -69,7 +69,7 @@ setup-wxwidgets() { case ${WX_GTK_VER} in 3.0-gtk3 | 3.2-gtk3) wxtoolkit=gtk3 ;; 3.0) wxtoolkit=gtk2 - eqawarn "This package relies on the deprecated GTK 2 slot, which will go away soon (https://bugs.gentoo.org/618642)" + eqawarn "QA Notice: This package relies on the deprecated GTK 2 slot, which will go away soon (https://bugs.gentoo.org/618642)" ;; esac diff --git a/eclass/xorg-3.eclass b/eclass/xorg-3.eclass index db2d8fa85df9..4947cb86b8b0 100644 --- a/eclass/xorg-3.eclass +++ b/eclass/xorg-3.eclass @@ -429,7 +429,7 @@ xorg-3_src_install() { # Many X11 libraries unconditionally install developer documentation if [[ -d "${D}"/usr/share/man/man3 ]]; then - ! in_iuse doc && eqawarn "ebuild should set XORG_DOC=doc since package installs library documentation" + ! in_iuse doc && eqawarn "QA Notice: ebuild should set XORG_DOC=doc since package installs library documentation" fi if in_iuse doc && ! use doc; then |