diff options
Diffstat (limited to 'eclass')
31 files changed, 604 insertions, 450 deletions
diff --git a/eclass/Manifest.gz b/eclass/Manifest.gz Binary files differindex c002fc2790ad..c9a08dc1e62d 100644 --- a/eclass/Manifest.gz +++ b/eclass/Manifest.gz diff --git a/eclass/ada.eclass b/eclass/ada.eclass index 3d22dd5d2a61..2732b4f57afd 100644 --- a/eclass/ada.eclass +++ b/eclass/ada.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: ada.eclass @@ -49,7 +49,7 @@ _ADA_ECLASS=1 # Example value: # @CODE # ada_target_gcc_12? ( sys-devel/gcc:12[ada] ) -# ada_target_gnat_2021? ( dev-lang/gnat-gps:2021[ada] ) +# ada_target_gcc_13? ( sys-devel/gcc:13[ada] ) # @CODE # @ECLASS_VARIABLE: _ADA_ALL_IMPLS @@ -57,7 +57,7 @@ _ADA_ECLASS=1 # @DESCRIPTION: # All supported Ada implementations, most preferred last. _ADA_ALL_IMPLS=( - gnat_2021 gcc_12 gcc_13 gcc_14 gcc_15 + gcc_12 gcc_13 gcc_14 gcc_15 ) readonly _ADA_ALL_IMPLS @@ -77,7 +77,7 @@ readonly _ADA_ALL_IMPLS # # Example value: # @CODE -# ^^ ( ada_target_gnat_2021 ada_target_gcc_12 ) +# ^^ ( ada_target_gcc_12 ada_target_gcc_13 ) # @CODE # @ECLASS_VARIABLE: ADA_USEDEP @@ -119,7 +119,7 @@ _ada_impl_supported() { # keep in sync with _ADA_ALL_IMPLS! # (not using that list because inline patterns shall be faster) case "${impl}" in - gnat_2021|gcc_12|gcc_13|gcc_14|gcc_15) + gcc_12|gcc_13|gcc_14|gcc_15) return 0 ;; *) @@ -213,7 +213,7 @@ ada_export() { local impl var case "${1}" in - gnat_2021|gcc_12|gcc_13|gcc_14|gcc_15) + gcc_12|gcc_13|gcc_14|gcc_15) impl=${1} shift ;; @@ -229,10 +229,6 @@ ada_export() { local gcc_pv local slot case "${impl}" in - gnat_2021) - gcc_pv=10 - slot=10 - ;; gcc_12) gcc_pv=12 slot=12 @@ -299,9 +295,6 @@ ada_export() { ;; ADA_PKG_DEP) case "${impl}" in - gnat_2021) - ADA_PKG_DEP="dev-lang/gnat-gpl:${slot}[ada]" - ;; gcc_12|gcc_13|gcc_14|gcc_15) ADA_PKG_DEP="sys-devel/gcc:${slot}[ada]" ;; diff --git a/eclass/apache-2.eclass b/eclass/apache-2.eclass index 352337f551d6..c62d19ed6b28 100644 --- a/eclass/apache-2.eclass +++ b/eclass/apache-2.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: apache-2.eclass @@ -6,7 +6,7 @@ # apache-bugs@gentoo.org # @AUTHOR: # polynomial-c@gentoo.org -# @SUPPORTED_EAPIS: 7 +# @SUPPORTED_EAPIS: 7 8 # @BLURB: Provides a common set of functions for apache-2.x ebuilds # @DESCRIPTION: # This eclass handles apache-2.x ebuild functions such as LoadModule generation @@ -19,7 +19,7 @@ inherit autotools flag-o-matic lua-single multilib ssl-cert toolchain-funcs && die "Do not use this eclass with anything else than www-servers/apache ebuilds!" case ${EAPI} in - 7) ;; + 7|8) ;; *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;; esac @@ -132,10 +132,7 @@ _apache2_set_mpms() { _apache2_set_mpms unset -f _apache2_set_mpms -NGHTTP2_VERSION=1.2.1 -if ver_test ${PV} -ge 2.4.55 ; then - NGHTTP2_VERSION=1.50.0 -fi +NGHTTP2_VERSION=1.50.0 # Dependencies RDEPEND=" @@ -412,26 +409,6 @@ generate_load_module() { "${GENTOO_PATCHDIR}"/conf/httpd.conf } -# @FUNCTION: check_upgrade -# @DESCRIPTION: -# This internal function checks if the previous configuration file for built-in -# modules exists in ROOT and prevents upgrade in this case. Users are supposed -# to convert this file to the new APACHE2_MODULES USE_EXPAND variable and remove -# it afterwards. -check_upgrade() { - if [[ -e "${EROOT}"etc/apache2/apache2-builtin-mods ]]; then - eerror "The previous configuration file for built-in modules" - eerror "(${EROOT}etc/apache2/apache2-builtin-mods) exists on your" - eerror "system." - eerror - eerror "Please read https://wiki.gentoo.org/wiki/Project:Apache/Upgrading" - eerror "for detailed information how to convert this file to the new" - eerror "APACHE2_MODULES USE_EXPAND variable." - eerror - die "upgrade not possible with existing ${ROOT}etc/apache2/apache2-builtin-mods" - fi -} - # ============================================================================== # EXPORTED FUNCTIONS # ============================================================================== @@ -442,8 +419,6 @@ check_upgrade() { # creates the apache user and group and informs about CONFIG_SYSVIPC being # needed (we don't depend on kernel sources and therefore cannot check). apache-2_pkg_setup() { - check_upgrade - setup_mpm setup_modules diff --git a/eclass/autotools.eclass b/eclass/autotools.eclass index 518f6addcc50..1545b88bc426 100644 --- a/eclass/autotools.eclass +++ b/eclass/autotools.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: autotools.eclass @@ -32,6 +32,7 @@ case ${EAPI} in esac GNUCONFIG_AUTO_DEPEND=no +LIBTOOL_AUTO_DEPEND=no inherit gnuconfig libtool # @ECLASS_VARIABLE: WANT_AUTOCONF @@ -71,7 +72,7 @@ inherit gnuconfig libtool # 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_AUTOCONF> -_LATEST_AUTOCONF=( 2.72-r1:2.72 2.71-r6:2.71 ) +_LATEST_AUTOCONF=( 2.72-r1:2.72 ) # @ECLASS_VARIABLE: _LATEST_AUTOMAKE # @INTERNAL @@ -109,14 +110,13 @@ if [[ -n ${WANT_AUTOMAKE} ]] ; then unset _automake_atom_tmp ;; *) - _automake_atom="=dev-build/automake-${WANT_AUTOMAKE}*" + _automake_atom="dev-build/automake:${WANT_AUTOMAKE}" ;; esac export WANT_AUTOMAKE fi if [[ -n ${WANT_AUTOCONF} ]] ; then - # TODO: Fix the slot mess here and just have proper PV-as-SLOT? # TODO: Make _LATEST_AUTOCONF an assoc. array and instead iterate over # its keys. case ${WANT_AUTOCONF} in @@ -124,25 +124,13 @@ if [[ -n ${WANT_AUTOCONF} ]] ; then # some packages don't require autoconf at all _autoconf_atom="" ;; - 2.1) - _autoconf_atom=">=dev-build/autoconf-2.13-r7:2.1" - ;; - 2.5) - _autoconf_atom=">=dev-build/autoconf-2.71-r6:2.71" - ;; - 2.69) - _autoconf_atom=">=dev-build/autoconf-2.69-r9:2.69" - ;; - 2.71) - _autoconf_atom=">=dev-build/autoconf-2.71-r6:2.71" - ;; latest) printf -v _autoconf_atom_tmp '>=dev-build/autoconf-%s:%s ' ${_LATEST_AUTOCONF[@]/:/ } _autoconf_atom="|| ( ${_autoconf_atom_tmp} )" unset _autoconf_atom_tmp ;; *) - die "Invalid WANT_AUTOCONF value '${WANT_AUTOCONF}'" + _autoconf_atom="dev-build/autoconf:${WANT_AUTOCONF}" ;; esac export WANT_AUTOCONF @@ -165,6 +153,7 @@ fi # versions in *DEPEND format. AUTOTOOLS_DEPEND=" ${GNUCONFIG_DEPEND} + ${LIBTOOL_DEPEND} ${_automake_atom} ${_autoconf_atom} ${_libtool_atom} diff --git a/eclass/cargo.eclass b/eclass/cargo.eclass index 0bc24feea222..dae2b93f24f3 100644 --- a/eclass/cargo.eclass +++ b/eclass/cargo.eclass @@ -181,7 +181,7 @@ ECARGO_VENDOR="${ECARGO_HOME}/gentoo" # functions will be exported. # # If you enable CARGO_OPTIONAL call at least cargo_gen_config manually -# before using other src_functions or cargo_env of this eclass. +# before using other src_* functions or cargo_env of this eclass. # Note that cargo_gen_config is automatically called by cargo_src_unpack. # @ECLASS_VARIABLE: myfeatures @@ -396,6 +396,9 @@ cargo_gen_config() { jobs = $(makeopts_jobs) incremental = false + [env] + RUST_TEST_THREADS = "$(makeopts_jobs)" + [term] verbose = true $([[ "${NOCOLOR}" = true || "${NOCOLOR}" = yes ]] && echo "color = 'never'") @@ -742,10 +745,15 @@ cargo_env() { # 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. + # + # Rust defaults to static linking (-C target-feature=+crt-static) on musl + # targets. We already patch dev-lang/rust to always prefer dynamic linking, + # but to ensure that behavior with dev-lang/rust-bin, set the opposite option + # (-C target-feature=-crt-static) in RUSTFLAGS. local -x CARGO_BUILD_TARGET=$(rust_abi) local TRIPLE=${CARGO_BUILD_TARGET//-/_} local TRIPLE=${TRIPLE^^} LD_A=( $(tc-getCC) ${LDFLAGS} ) - local -Ix CARGO_TARGET_"${TRIPLE}"_RUSTFLAGS+=" -C strip=none -C linker=${LD_A[0]}" + local -Ix CARGO_TARGET_"${TRIPLE}"_RUSTFLAGS+=" -C strip=none -C linker=${LD_A[0]} -C target-feature=-crt-static" [[ ${#LD_A[@]} -gt 1 ]] && local CARGO_TARGET_"${TRIPLE}"_RUSTFLAGS+="$(printf -- ' -C link-arg=%s' "${LD_A[@]:1}")" local CARGO_TARGET_"${TRIPLE}"_RUSTFLAGS+=" ${RUSTFLAGS}" @@ -776,7 +784,7 @@ cargo_src_compile() { # @FUNCTION: cargo_src_install # @DESCRIPTION: # Installs the binaries generated by cargo. -# In come cases workspaces need an alternative --path parameter. +# In some cases workspaces need an alternative --path parameter. # Defaults to '--path ./' if no path is specified. # '--path ./somedir' can be passed directly to cargo_src_install. cargo_src_install() { diff --git a/eclass/dist-kernel-utils.eclass b/eclass/dist-kernel-utils.eclass index 3d7315e9e94e..49977c18795a 100644 --- a/eclass/dist-kernel-utils.eclass +++ b/eclass/dist-kernel-utils.eclass @@ -66,18 +66,37 @@ dist-kernel_get_image_path() { } # @FUNCTION: dist-kernel_install_kernel -# @USAGE: <version> <image> <system.map> +# @USAGE: [<version>] [<image>] [<system.map>] [<dir>] [<installkernel-args>...] # @DESCRIPTION: -# Install kernel using installkernel tool. <version> specifies -# the kernel version, <image> full path to the image, <system.map> -# full path to System.map. +# Install kernel using installkernel. Takes the following arguments: +# +# <version> -- the target kernel version (default: ${KV_FULL}) +# +# <image> -- the full path to the kernel image (default: the image +# as reported by dist-kernel_get_image_path() in the ${KV_DIR}) +# +# <system.map> -- the full path to the System.map +# (default: ${KV_DIR}/System.map}) +# +# <dir> -- the target directory to install to (default: ${EROOT}/boot) +# +# <installkernel-args> -- extra optional arguments for installkernel +# see man kernel-install and man installkernel. Requires at +# least version 56 of sys-kernel/installkernel. dist-kernel_install_kernel() { debug-print-function ${FUNCNAME} "$@" - [[ ${#} -eq 3 ]] || die "${FUNCNAME}: invalid arguments" - local version=${1} - local image=${2} - local map=${3} + local version=${1:-${KV_FULL}} + local image=${2:-${KV_DIR}/$(dist-kernel_get_image_path)} + local map=${3:-${KV_DIR}/System.map} + local dir=${4:-${EROOT}/boot} + + local installkernel_args=( + "${version}" "${image}" "${map}" "${dir}" + ) + if has_version ">=sys-kernel/installkernel-56"; then + installkernel_args+=( "${@:5}" --verbose ) + fi local success= # not an actual loop but allows error handling with 'break' @@ -107,8 +126,7 @@ dist-kernel_install_kernel() { ebegin "Installing the kernel via installkernel" # note: .config is taken relatively to System.map; # initrd relatively to bzImage - ARCH=$(tc-arch-kernel) installkernel "${version}" "${image}" "${map}" \ - "${EROOT}/boot" || break + ARCH=$(tc-arch-kernel) installkernel "${installkernel_args[@]}" || break eend ${?} || die -n "Installing the kernel failed" success=1 @@ -129,39 +147,49 @@ dist-kernel_install_kernel() { eerror "in the logs above and once you resolve the problems please" eerror "run the equivalent of the following command to try again:" eerror - eerror " emerge --config ${kernel}" + if has --all "${installkernel_args[@]}"; then + eerror " installkernel ${installkernel_args[*]}" + else + eerror " emerge --config ${kernel}" + fi die "Kernel install failed, please fix the problems and run emerge --config" fi } # @FUNCTION: dist-kernel_reinstall_initramfs -# @USAGE: <kv-dir> <kv-full> +# @USAGE: [<kv-dir>] [<kv-full>] [<installkernel-args>...] # @DESCRIPTION: # Rebuild and install initramfs for the specified dist-kernel. -# <kv-dir> is the kernel source directory (${KV_DIR} from linux-info), -# while <kv-full> is the full kernel version (${KV_FULL}). -# The function will determine whether <kernel-dir> is actually -# a dist-kernel, and whether initramfs was used. +# Takes the following arguments: +# +# <kv-dir> -- the full path to the target kernel (default: ${KV_DIR}) +# +# <kv-full> -- the target kernel version (default: ${KV_FULL}) +# +# <installkernel-args> -- extra optional arguments for installkernel +# see man kernel-install and man installkernel. Requires at +# least version 56 of sys-kernel/installkernel. # # This function is to be used in pkg_postinst() of ebuilds installing -# kernel modules that are included in the initramfs. +# kernel modules that are included in the initramfs. In order to +# reinstall *all* distribution kernels currently installed on the +# system add the --all argument (requires installkernel-56 or newer). dist-kernel_reinstall_initramfs() { debug-print-function ${FUNCNAME} "$@" - [[ ${#} -eq 2 ]] || die "${FUNCNAME}: invalid arguments" - local kernel_dir=${1} - local ver=${2} + local kernel_dir=${1:-${KV_DIR}} + local ver=${2:-${KV_FULL}} local image_path=${kernel_dir}/$(dist-kernel_get_image_path) if [[ ! -f ${image_path} ]]; then eerror "Kernel install missing, image not found:" eerror " ${image_path}" - eerror "Initramfs will not be updated. Please reinstall your kernel." + eerror "Initramfs will not be updated. Please reinstall kernel ${ver}." return fi dist-kernel_install_kernel "${ver}" "${image_path}" \ - "${kernel_dir}/System.map" + "${kernel_dir}/System.map" "${EROOT}/boot" "${@:3}" } # @FUNCTION: dist-kernel_PV_to_KV diff --git a/eclass/dotnet.eclass b/eclass/dotnet.eclass index aeaee2f58e94..3a65626032cb 100644 --- a/eclass/dotnet.eclass +++ b/eclass/dotnet.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: dotnet.eclass @@ -6,6 +6,7 @@ # maintainer-needed@gentoo.org # @SUPPORTED_EAPIS: 7 # @BLURB: common settings and functions for mono and dotnet related packages +# @DEPRECATED: none # @DESCRIPTION: # The dotnet eclass contains common environment settings that are useful for # dotnet packages. Currently, it provides no functions, just exports diff --git a/eclass/eapi9-ver.eclass b/eclass/eapi9-ver.eclass new file mode 100644 index 000000000000..9908fec37de8 --- /dev/null +++ b/eclass/eapi9-ver.eclass @@ -0,0 +1,50 @@ +# Copyright 2025 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +# @ECLASS: eapi9-ver.eclass +# @MAINTAINER: +# Ulrich Müller <ulm@gentoo.org> +# @AUTHOR: +# Ulrich Müller <ulm@gentoo.org> +# @SUPPORTED_EAPIS: 7 8 +# @BLURB: Testing implementation of EAPI 9 ver_replacing +# @DESCRIPTION: +# A stand-alone implementation of the ver_replacing function aimed +# for EAPI 9. Intended to be used for wider testing of the proposed +# function and to allow ebuilds to switch to the new model early, with +# minimal change needed for the actual EAPI 9. +# +# @CODE +# if ver_replacing -lt 1.2; then +# elog "The frobnicate command was dropped in version 1.2" +# fi +# @CODE + +case ${EAPI} in + 7|8) ;; + *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;; +esac + +# @FUNCTION: ver_replacing +# @USAGE: <op> <ver> +# @RETURN: 0 if any element of REPLACING_VERSIONS qualifies, 1 otherwise +# @DESCRIPTION: +# Compare each element <v> of REPLACING_VERSIONS with version <ver> +# using ver_test(). Return 0 (true) if any element <v> fulfills +# "ver_test <v> <op> <ver>", 1 (false) otherwise. +# +# Note: If REPLACING_VERSIONS is empty, 1 (false) is returned. +ver_replacing() { + case ${EBUILD_PHASE} in + pretend|setup|preinst|postinst) ;; + *) die "ver_replacing is meaningless in the ${EBUILD_PHASE} phase" ;; + esac + + [[ $# -eq 2 ]] || die "Usage: ver_replacing <op> <ver>" + + local v + for v in ${REPLACING_VERSIONS}; do + ver_test "${v}" "$@" && return 0 + done + return 1 +} diff --git a/eclass/ecm.eclass b/eclass/ecm.eclass index e433952903e8..9caaf59cb3fa 100644 --- a/eclass/ecm.eclass +++ b/eclass/ecm.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: ecm.eclass @@ -334,6 +334,18 @@ DEPEND+=" ${COMMONDEPEND}" RDEPEND+=" ${COMMONDEPEND}" unset COMMONDEPEND +# @FUNCTION: _ecm_handbook_optional +# @DESCRIPTION: +# Use with ECM_HANDBOOK=optional; ticks either -DBUILD_DOC if available, +# or -DCMAKE_DISABLE_FIND_PACKAGE_KF${_KFSLOT}DocTools +_ecm_handbook_optional() { + if grep -Eq "option.*BUILD_DOC" CMakeLists.txt; then + echo "-DBUILD_DOC=$(usex handbook)" + else + echo "-DCMAKE_DISABLE_FIND_PACKAGE_KF${_KFSLOT}DocTools=$(usex !handbook)" + fi +} + # @FUNCTION: _ecm_strip_handbook_translations # @INTERNAL # @DESCRIPTION: @@ -465,7 +477,7 @@ ecm_punt_bogus_dep() { # @DESCRIPTION: # Disables kdoctools_install(po) call. _ecm_punt_kdoctools_install() { - sed -e "s/^ *kdoctools_install.*(po.*)/#& # disabled by ecm.eclass/" \ + sed -e "s/^ *kdoctools_install.*(\s*po.*)/#& # disabled by ecm.eclass/" \ -i CMakeLists.txt || die } @@ -475,7 +487,7 @@ _ecm_punt_kdoctools_install() { # is outsourcing common files to a ${PN}-common split package. ecm_punt_po_install() { _ecm_punt_kdoctools_install - sed -e "s/^ *ki18n_install.*(po.*)/#& # disabled by ecm.eclass/" \ + sed -e "s/^ *ki18n_install.*(\s*po.*)/#& # disabled by ecm.eclass/" \ -i CMakeLists.txt || die } @@ -488,18 +500,9 @@ _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 "It is no longer being exported with KFMIN >=6.9.0." - return - fi - if [[ ${MERGE_TYPE} != binary && -v KDE_GCC_MINIMAL ]] && tc-is-gcc; then - - local version=$(gcc-version) - - debug-print "GCC version check activated" - debug-print "Version detected: ${version}" - debug-print "Version required: ${KDE_GCC_MINIMAL}" - - ver_test ${version} -lt ${KDE_GCC_MINIMAL} && - die "Sorry, but gcc-${KDE_GCC_MINIMAL} or later is required for this package (found ${version})." + else + [[ ${MERGE_TYPE} != binary && -v KDE_GCC_MINIMAL ]] && + tc-check-min_ver gcc ${KDE_GCC_MINIMAL} fi } @@ -630,7 +633,7 @@ ecm_src_configure() { fi if [[ ${ECM_HANDBOOK} = optional ]] ; then - cmakeargs+=( -DCMAKE_DISABLE_FIND_PACKAGE_KF${_KFSLOT}DocTools=$(usex !handbook) ) + cmakeargs+=( $(_ecm_handbook_optional) ) fi if in_iuse designer && [[ ${ECM_DESIGNERPLUGIN} = true ]]; then @@ -692,7 +695,7 @@ ecm_src_test() { fi # KDE_DEBUG stops crash handlers from launching and hanging the test phase - KDE_DEBUG=1 cmake_src_test + KDE_DEBUG=1 cmake_src_test "$@" } local -x QT_QPA_PLATFORM=offscreen @@ -704,9 +707,9 @@ ecm_src_test() { unset DBUS_SESSION_BUS_ADDRESS DBUS_SESSION_BUS_PID if [[ ${EAPI} == 8 ]] && [[ ${VIRTUALX_REQUIRED} = always || ${VIRTUALX_REQUIRED} = test ]]; then - virtx _test_runner + virtx _test_runner "$@" else - _test_runner + _test_runner "$@" fi if [[ -n "${DBUS_SESSION_BUS_PID}" ]] ; then @@ -725,7 +728,7 @@ ecm_src_test() { ecm_src_install() { debug-print-function ${FUNCNAME} "$@" - cmake_src_install + cmake_src_install "$@" local f # bug 621970 @@ -746,18 +749,18 @@ ecm_src_install() { if [[ -n ${_KDE_ORG_ECLASS} && -d "${ED}"/usr/share/metainfo/ ]]; then if [[ ${KDE_ORG_NAME} != ${PN} ]]; then - local ecm_metainfo + local ecm_metainfo mainslot=${SLOT%/*} 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*/} + mv_metainfo ${ecm_metainfo} ${KDE_ORG_NAME} ${PN}${mainslot/0*/} ;; *${KDE_ORG_NAME/-/_}*) - mv_metainfo ${ecm_metainfo} ${KDE_ORG_NAME/-/_} ${PN}${SLOT/0*/} + mv_metainfo ${ecm_metainfo} ${KDE_ORG_NAME/-/_} ${PN}${mainslot/0*/} ;; org.kde.*) - mv_metainfo ${ecm_metainfo} "org.kde." "org.kde.${PN}${SLOT/0*/}-" + mv_metainfo ${ecm_metainfo} "org.kde." "org.kde.${PN}${mainslot/0*/}-" ;; esac done diff --git a/eclass/ffmpeg-compat.eclass b/eclass/ffmpeg-compat.eclass new file mode 100644 index 000000000000..f91fe6eead31 --- /dev/null +++ b/eclass/ffmpeg-compat.eclass @@ -0,0 +1,67 @@ +# Copyright 2025 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +# @ECLASS: ffmpeg-compat.eclass +# @MAINTAINER: +# Ionen Wolkens <ionen@gentoo.org> +# @AUTHOR: +# Ionen Wolkens <ionen@gentoo.org> +# @SUPPORTED_EAPIS: 8 +# @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 +# usage of both pkg-config --cflags and --libs (which adds -Wl,-rpath +# to find libraries at runtime). +# +# This eclass is intended as a quick-to-setup alternative to setting +# an upper bound on ffmpeg for packages broken with the latest version, +# and thus allow users to upgrade their normal ffmpeg. +# +# This should still be a temporary measure, and it is recommended to +# keep migration bugs open rather than consider this eclass as being +# the "fix". +# +# Unlike LLVM_SLOT-style, this does not have USE to select the slot +# and should instead pick only the highest one usable until package +# is fixed and can use non-slotted ffmpeg again. +# +# Do *not* use both like ``|| ( <ffmpeg-<ver> ffmpeg-compat:<slot> )``, +# the package manager cannot know which version it linked against +# without USE flags. Unfortunately means a period where users may +# have two identical versions in stable before the newest major version +# is stabilized, but idea is to not mangle normal ffmpeg with slotting +# logic and make this an isolated temporary deal. + +case ${EAPI} in + 8) ;; + *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;; +esac + +if [[ -z ${_FFMPEG_COMPAT_ECLASS} ]]; then +_FFMPEG_COMPAT_ECLASS=1 + +# @FUNCTION: ffmpeg_compat_get_prefix +# @USAGE: <slot> +# @DESCRIPTION: +# Return prefix of the installed ffmpeg-compat:<slot>. Binaries like +# ffmpeg will be found under <prefix>/bin if needed. +ffmpeg_compat_get_prefix() { + (( ${#} == 1 )) || die "Usage: ${FUNCNAME} <slot>" + + echo "${EPREFIX}/usr/lib/ffmpeg${1}" +} + +# @FUNCTION: ffmpeg_compat_setup +# @USAGE: <slot> +# @DESCRIPTION: +# Add ESYSROOT's ffmpeg-compat:<slot> to PKG_CONFIG_PATH for the +# current ABI. +ffmpeg_compat_setup() { + (( ${#} == 1 )) || die "Usage: ${FUNCNAME} <slot>" + + : "${SYSROOT}$(ffmpeg_compat_get_prefix "${1}")/$(get_libdir)/pkgconfig" + export PKG_CONFIG_PATH=${_}:${PKG_CONFIG_PATH} +} + +fi diff --git a/eclass/flag-o-matic.eclass b/eclass/flag-o-matic.eclass index 3e67e3b4c11f..9590192bb1f4 100644 --- a/eclass/flag-o-matic.eclass +++ b/eclass/flag-o-matic.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: flag-o-matic.eclass @@ -201,7 +201,7 @@ _filter-hardened() { continue fi - is-flagq -fno-stack-protector-all || append-flags $(test-flags -fno-stack-protector-all) + is-flagq -fno-stack-protector || append-flags $(test-flags -fno-stack-protector) ;; -fno-strict-overflow) gcc-specs-nostrict || continue diff --git a/eclass/go-env.eclass b/eclass/go-env.eclass index 11fdf943e774..b2b240b5ef29 100644 --- a/eclass/go-env.eclass +++ b/eclass/go-env.eclass @@ -1,4 +1,4 @@ -# Copyright 2023-2024 Gentoo Authors +# Copyright 2023-2025 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 # @ECLASS: go-env.eclass @@ -40,7 +40,13 @@ go-env_set_compile_environment() { use x86 && export GO386=$(go-env_go386) # XXX: Hack for checking ICE (bug #912152, gcc PR113204) - has_version -b "sys-devel/gcc[debug]" && filter-lto + if tc-is-gcc ; then + # For either USE=debug or an unreleased compiler, non-default + # checking will trigger. + if has_version -b "sys-devel/gcc[debug]" || [[ $(gcc-minor-version) -eq 0 ]] ; then + filter-lto + fi + fi export CGO_CFLAGS="${CGO_CFLAGS:-$CFLAGS}" export CGO_CPPFLAGS="${CGO_CPPFLAGS:-$CPPFLAGS}" diff --git a/eclass/kernel-install.eclass b/eclass/kernel-install.eclass index cf34007844a8..67143278f368 100644 --- a/eclass/kernel-install.eclass +++ b/eclass/kernel-install.eclass @@ -808,6 +808,9 @@ kernel-install_pkg_postrm() { find "${kernel_dir}" -depth -type d -empty -delete eend ${?} fi + + # Clean up dead symlinks + find -L "${EROOT}/lib/modules/${KV_FULL}" -type l -delete } # @FUNCTION: kernel-install_pkg_config diff --git a/eclass/latex-package.eclass b/eclass/latex-package.eclass index dfef7fc2836f..e35da30e1b44 100644 --- a/eclass/latex-package.eclass +++ b/eclass/latex-package.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: latex-package.eclass @@ -60,6 +60,8 @@ esac if [[ -z ${_LATEX_PACKAGE_ECLASS} ]]; then _LATEX_PACKAGE_ECLASS=1 +inherit edo + RDEPEND="virtual/latex-base" BDEPEND="${RDEPEND} >=sys-apps/texinfo-4.2-r5" @@ -77,6 +79,12 @@ TEXMF="/usr/share/texmf-site" # DESCRIPTION above) SUPPLIER="misc" +# @ECLASS_VARIABLE: LATEX_ENGINE +# @DESCRIPTION: +# When compiling documentation (.tex/.dtx), use the specified engine, +# e.g., lualatex, to build the documention. Defaults to pdflatex. +: "${LATEX_ENGINE:=pdflatex}" + # @ECLASS_VARIABLE: LATEX_DOC_ARGUMENTS # @DESCRIPTION: # When compiling documentation (.tex/.dtx), this variable will be passed @@ -138,18 +146,24 @@ latex-package_src_doinstall() { einfo "Making documentation: ${i}" local mypdflatex=( - pdflatex + ${LATEX_ENGINE} ${LATEX_DOC_ARGUMENTS} --halt-on-error --interaction=nonstopmode "${i}" ) + + if [[ ${LATEX_ENGINE} == "lualatex" ]]; then + # bug #950021 + local -x TEXMFCACHE="${T}" TEXMFVAR="${T}" + fi + # some macros need compiler called twice, do it here. - if "${mypdflatex[@]}"; then - "${mypdflatex[@]}" + if nonfatal edo "${mypdflatex[@]}"; then + edo "${mypdflatex[@]}" else einfo "pdflatex failed, trying texi2dvi" - texi2dvi -q -c --language=latex "${i}" || die + edo texi2dvi -q -c --language=latex "${i}" fi done < <(find -maxdepth 1 -type f -name "*.${1}" -print0) fi diff --git a/eclass/libtool.eclass b/eclass/libtool.eclass index 8ffc06d6ff98..18596a922307 100644 --- a/eclass/libtool.eclass +++ b/eclass/libtool.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: libtool.eclass @@ -22,10 +22,23 @@ case ${EAPI} in *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;; esac -BDEPEND=">=app-portage/elt-patches-20240116" - inherit toolchain-funcs +# @ECLASS_VARIABLE: LIBTOOL_DEPEND +# @OUTPUT_VARIABLE +# @DESCRIPTION: +# Contains dependency on app-portage/elt-patches in *DEPEND format. +LIBTOOL_DEPEND=">=app-portage/elt-patches-20250306" + +# @ECLASS_VARIABLE: LIBTOOL_AUTO_DEPEND +# @PRE_INHERIT +# @DESCRIPTION: +# Set to 'no' to disable automatically adding to DEPEND. This lets +# ebuilds form conditional depends by using ${LIBTOOL_DEPEND} in +# their own DEPEND string. +: "${LIBTOOL_AUTO_DEPEND:=yes}" +[[ ${LIBTOOL_AUTO_DEPEND} != "no" ]] && BDEPEND=${LIBTOOL_DEPEND} + # @FUNCTION: elibtoolize # @USAGE: [dirs] [--portage] [--reverse-deps] [--patch-only] [--remove-internal-dep=xxx] [--shallow] [--no-uclibc] # @DESCRIPTION: diff --git a/eclass/llvm.org.eclass b/eclass/llvm.org.eclass index a810027f74f5..f4e2e239d5f8 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=20 +_LLVM_MAIN_MAJOR=21 # @ECLASS_VARIABLE: _LLVM_SOURCE_TYPE # @INTERNAL @@ -72,14 +72,11 @@ if [[ -z ${_LLVM_SOURCE_TYPE+1} ]]; then _LLVM_SOURCE_TYPE=snapshot case ${PV} in - 20.0.0_pre20250111) - EGIT_COMMIT=8af4d206e0f979f68925a08f9dffd60a98ce97e2 + 21.0.0_pre20250311) + EGIT_COMMIT=cb7298f66d62a3548fcf3bd230304067ecf30d17 ;; - 20.0.0_pre20250104) - EGIT_COMMIT=2529a8df53af9bc6cecfd6c83404ffa5e89e3370 - ;; - 20.0.0_pre20241227) - EGIT_COMMIT=ccfe0de0e1e37ed369c9bf89dd0188ba0afb2e9a + 21.0.0_pre20250301) + EGIT_COMMIT=7e8a06cfa4a2951b8ee77e19e34926e6e535b4d1 ;; *) die "Unknown snapshot: ${PV}" @@ -188,14 +185,26 @@ case ${LLVM_MAJOR} in ) ;; *) - ALL_LLVM_EXPERIMENTAL_TARGETS=( - ARC CSKY DirectX M68k SPIRV Xtensa - ) - ALL_LLVM_PRODUCTION_TARGETS=( - AArch64 AMDGPU ARM AVR BPF Hexagon Lanai LoongArch Mips - MSP430 NVPTX PowerPC RISCV Sparc SystemZ VE WebAssembly X86 - XCore - ) + # TODO: limit to < 20 when we remove old snapshots + if ver_test ${PV} -lt 20.0.0_pre20250122; then + ALL_LLVM_EXPERIMENTAL_TARGETS=( + ARC CSKY DirectX M68k SPIRV Xtensa + ) + ALL_LLVM_PRODUCTION_TARGETS=( + AArch64 AMDGPU ARM AVR BPF Hexagon Lanai LoongArch Mips + MSP430 NVPTX PowerPC RISCV Sparc SystemZ VE WebAssembly X86 + XCore + ) + else + ALL_LLVM_EXPERIMENTAL_TARGETS=( + ARC CSKY DirectX M68k Xtensa + ) + ALL_LLVM_PRODUCTION_TARGETS=( + AArch64 AMDGPU ARM AVR BPF Hexagon Lanai LoongArch Mips + MSP430 NVPTX PowerPC RISCV Sparc SPIRV SystemZ VE + WebAssembly X86 XCore + ) + fi ;; esac @@ -303,6 +312,9 @@ llvm.org_set_globals() { 19*) LLVM_MANPAGE_DIST="llvm-19.1.0-manpages.tar.bz2" ;; + 20*) + LLVM_MANPAGE_DIST="llvm-20.1.0-manpages.tar.xz" + ;; esac fi diff --git a/eclass/mono.eclass b/eclass/mono.eclass deleted file mode 100644 index c096acc8c40e..000000000000 --- a/eclass/mono.eclass +++ /dev/null @@ -1,90 +0,0 @@ -# Copyright 1999-2023 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -# @ECLASS: mono.eclass -# @MAINTAINER: -# maintainer-needed@gentoo.org -# @SUPPORTED_EAPIS: 7 -# @BLURB: common settings and functions for mono and dotnet related packages -# @DEPRECATED: mono-env -# @DESCRIPTION: -# The mono eclass contains common environment settings that are useful for -# dotnet packages. Currently, it provides no functions, just exports -# MONO_SHARED_DIR and sets LC_ALL in order to prevent errors during compilation -# of dotnet packages. - -case ${EAPI:-0} in - 7) ;; - *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;; -esac - -if [[ -z ${_MONO_ECLASS} ]] ; then -_MONO_ECLASS=1 - -inherit multilib - -# >=mono-0.92 versions using mcs -pkg:foo-sharp require shared memory, so we set the -# shared dir to ${T} so that ${T}/.wapi can be used during the install process. -export MONO_SHARED_DIR="${T}" - -# Building mono, nant and many other dotnet packages is known to fail if LC_ALL -# variable is not set to C. To prevent this all mono related packages will be -# build with LC_ALL=C (see bugs #146424, #149817) -export LC_ALL=C - -# Monodevelop-using applications need this to be set or they will try to create config -# files in the user's ~ dir. - -export XDG_CONFIG_HOME="${T}" - -# Fix bug 83020: -# "Access Violations Arise When Emerging Mono-Related Packages with MONO_AOT_CACHE" - -unset MONO_AOT_CACHE - -egacinstall() { - gacutil -i "${1}" \ - -root "${ED}"/usr/$(get_libdir) \ - -gacdir /usr/$(get_libdir) \ - -package ${2:-${GACPN:-${PN}}} \ - || die "installing ${1} into the Global Assembly Cache failed" -} - -mono_multilib_comply() { - local dir finddirs=() mv_command=${mv_command:-mv} - if [[ -d "${ED}/usr/lib" && "$(get_libdir)" != "lib" ]] - then - if ! [[ -d "${ED}"/usr/"$(get_libdir)" ]] - then - mkdir "${ED}"/usr/"$(get_libdir)" || die "Couldn't mkdir ${ED}/usr/$(get_libdir)" - fi - ${mv_command} "${ED}"/usr/lib/* "${ED}"/usr/"$(get_libdir)"/ || die "Moving files into correct libdir failed" - rm -rf "${ED}"/usr/lib - for dir in "${ED}"/usr/"$(get_libdir)"/pkgconfig "${ED}"/usr/share/pkgconfig - do - - if [[ -d "${dir}" && "$(find "${dir}" -name '*.pc')" != "" ]] - then - pushd "${dir}" &> /dev/null - sed -i -r -e 's:/(lib)([^a-zA-Z0-9]|$):/'"$(get_libdir)"'\2:g' \ - *.pc \ - || die "Sedding some sense into pkgconfig files failed." - popd "${dir}" &> /dev/null - fi - done - if [[ -d "${ED}/usr/bin" ]] - then - for exe in "${ED}/usr/bin"/* - do - if [[ "$(file -S "${exe}")" == *"shell script text"* ]] - then - sed -r -i -e ":/lib(/|$): s:/lib(/|$):/$(get_libdir)\1:" \ - "${exe}" || die "Sedding some sense into ${exe} failed" - fi - done - fi - - fi -} - -fi diff --git a/eclass/plasma.kde.org.eclass b/eclass/plasma.kde.org.eclass index 6612028e298b..dfbaea88b096 100644 --- a/eclass/plasma.kde.org.eclass +++ b/eclass/plasma.kde.org.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: plasma.kde.org.eclass @@ -70,7 +70,7 @@ if [[ ${KDE_BUILD_TYPE} == live ]]; then fi elif [[ -z ${KDE_ORG_COMMIT} ]]; then case ${PV} in - 5.??.[6-9][05]* | 6.?.[6-9][05]* ) + 6.?.[6-9][0-5]* ) _KDE_SRC_URI+="unstable/plasma/${KDE_CATV}/" RESTRICT+=" mirror" ;; diff --git a/eclass/postgres.eclass b/eclass/postgres.eclass index 21490df1965e..d743c5d0d165 100644 --- a/eclass/postgres.eclass +++ b/eclass/postgres.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: postgres.eclass @@ -27,7 +27,7 @@ _POSTGRES_ECLASS=1 # @DESCRIPTION: # List of versions to reverse sort POSTGRES_COMPAT slots -_POSTGRES_ALL_VERSIONS=( 9999 17 16 15 14 13 12 ) +_POSTGRES_ALL_VERSIONS=( 9999 17 16 15 14 13 ) diff --git a/eclass/python-any-r1.eclass b/eclass/python-any-r1.eclass index adc7b1bfec47..d581b6a4647f 100644 --- a/eclass/python-any-r1.eclass +++ b/eclass/python-any-r1.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: python-any-r1.eclass @@ -175,7 +175,7 @@ _python_any_set_globals() { _python_export "${i}" PYTHON_PKG_DEP # note: need to strip '=' slot operator for || deps - deps="${PYTHON_PKG_DEP/:=} ${deps}" + deps="${PYTHON_PKG_DEP/=} ${deps}" done deps="|| ( ${deps})" @@ -258,7 +258,7 @@ python_gen_any_dep() { local i_depstr=${depstr//\$\{PYTHON_USEDEP\}/${PYTHON_USEDEP}} i_depstr=${i_depstr//\$\{PYTHON_SINGLE_USEDEP\}/${PYTHON_SINGLE_USEDEP}} # note: need to strip '=' slot operator for || deps - out="( ${PYTHON_PKG_DEP/:=} ${i_depstr} ) ${out}" + out="( ${PYTHON_PKG_DEP/=} ${i_depstr} ) ${out}" done echo "|| ( ${out})" } diff --git a/eclass/python-r1.eclass b/eclass/python-r1.eclass index 9b03a269e88b..02d7215320a2 100644 --- a/eclass/python-r1.eclass +++ b/eclass/python-r1.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: python-r1.eclass @@ -518,7 +518,7 @@ python_gen_any_dep() { local i_depstr=${depstr//\$\{PYTHON_USEDEP\}/${PYTHON_USEDEP}} i_depstr=${i_depstr//\$\{PYTHON_SINGLE_USEDEP\}/${PYTHON_SINGLE_USEDEP}} # note: need to strip '=' slot operator for || deps - out="( ${PYTHON_PKG_DEP/:=} ${i_depstr} ) ${out}" + out="( ${PYTHON_PKG_DEP/=} ${i_depstr} ) ${out}" fi done echo "|| ( ${out})" diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass index 0cb132b72e3a..affb8e55a50d 100644 --- a/eclass/python-utils-r1.eclass +++ b/eclass/python-utils-r1.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: python-utils-r1.eclass @@ -39,7 +39,7 @@ inherit multiprocessing toolchain-funcs # @DESCRIPTION: # All supported Python implementations, most preferred last. _PYTHON_ALL_IMPLS=( - pypy3 + pypy3 pypy3_11 python3_13t python3_{10..13} ) @@ -137,7 +137,7 @@ _python_set_impls() { # please keep them in sync with _PYTHON_ALL_IMPLS # and _PYTHON_HISTORICAL_IMPLS case ${i} in - pypy3|python3_9|python3_1[0-3]|python3_13t) + pypy3|pypy3_11|python3_9|python3_1[0-3]|python3_13t) ;; jython2_7|pypy|pypy1_[89]|pypy2_0|python2_[5-7]|python3_[1-9]) obsolete+=( "${i}" ) @@ -233,7 +233,8 @@ _python_impl_matches() { return 0 ;; 3.8|3.9|3.1[1-3]) - [[ ${impl%t} == python${pattern/./_} ]] && return 0 + [[ ${impl%t} == python${pattern/./_} || ${impl} == pypy${pattern/./_} ]] && + return 0 ;; *) # unify value style to allow lax matching @@ -304,14 +305,10 @@ _python_export() { local impl var case "${1}" in - python*|jython*) + python*|jython*|pypy|pypy3*) impl=${1/_/.} shift ;; - pypy|pypy3) - impl=${1} - shift - ;; *) impl=${EPYTHON} if [[ -z ${impl} ]]; then @@ -453,7 +450,10 @@ _python_export() { 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}}]" + 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}]}" ;; *) die "Invalid implementation: ${impl}" @@ -641,7 +641,7 @@ python_optimize() { "${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*|pypy3*) # Python 3.9+ "${PYTHON}" -m compileall -j "${jobs}" -o 0 -o 1 -o 2 --hardlink-dupes -q -f -d "${instpath}" "${d}" ;; @@ -1080,7 +1080,7 @@ python_fix_shebang() { python|python3) match=1 ;; - python2|python[23].[0-9]|python3.[1-9][0-9]|pypy|pypy3|jython[23].[0-9]) + python2|python[23].[0-9]|python3.[1-9][0-9]|pypy|pypy3|pypy3.[1-9][0-9]|jython[23].[0-9]) # Explicit mismatch. match=1 error=1 diff --git a/eclass/qt6-build.eclass b/eclass/qt6-build.eclass index ca6c63081053..1c13174804ad 100644 --- a/eclass/qt6-build.eclass +++ b/eclass/qt6-build.eclass @@ -81,12 +81,13 @@ readonly QT6_BUILD_TYPE HOMEPAGE="https://www.qt.io/" LICENSE="|| ( GPL-2 GPL-3 LGPL-3 ) FDL-1.3" -SLOT=6/${PV%%_*} +SLOT="6/${PV%%_*}" +IUSE="custom-cflags" if [[ ${QT6_RESTRICT_TESTS} ]]; then RESTRICT="test" else - IUSE="test" + IUSE+=" test" RESTRICT="!test? ( test )" fi @@ -128,18 +129,21 @@ qt6-build_src_prepare() { fi _qt6-build_prepare_env - _qt6-build_sanitize_cpu_flags - - # LTO cause test failures in several components (e.g. qtcharts, - # multimedia, scxml, wayland, webchannel, ...). - # - # Exact extent/causes unknown, but for some related-sounding bugs: - # https://bugreports.qt.io/browse/QTBUG-112332 - # https://bugreports.qt.io/browse/QTBUG-115731 - # - # Does not manifest itself with clang:16 (did with gcc-13.2.0), but - # still assumed to be generally unsafe either way in current state. - in_iuse custom-cflags && use custom-cflags || filter-lto + + if use !custom-cflags; then + _qt6-build_sanitize_cpu_flags + + # LTO cause test failures in several components (e.g. qtcharts, + # multimedia, scxml, wayland, webchannel, ...). + # + # Exact extent/causes unknown, but for some related-sounding bugs: + # https://bugreports.qt.io/browse/QTBUG-112332 + # https://bugreports.qt.io/browse/QTBUG-115731 + # + # Does not manifest itself with clang:16 (did with gcc-13.2.0), but + # still assumed to be generally unsafe either way in current state. + filter-lto + fi } # @FUNCTION: qt6-build_src_configure @@ -199,11 +203,9 @@ qt6-build_src_install() { _qt6-build_create_user_facing_links - # hack: trim typical junk with currently no known "proper" way - # to avoid that primarily happens with tests (e.g. qt5compat and - # qtsvg tests, but qtbase[gui,-test] currently does some too) - rm -rf -- "${D}${QT6_PREFIX}"/tests \ - "${D}${QT6_LIBDIR}/objects-${CMAKE_BUILD_TYPE}" || die + # Qt often install unwanted files when tests are enabled and, while + # this does not cover everything, delete the common case. + rm -rf -- "${D}${QT6_PREFIX}"/tests || die } ###### Public helpers ###### @@ -230,18 +232,33 @@ _qt6-build_create_user_facing_links() { # even if no links (empty), if missing will assume that it is an error [[ ${PN} == qttranslations ]] && return - # loop and match using paths (upstream suggests `xargs ln -s < ${links}` - # but, for what it is worth, that will fail if paths have spaces) + # TODO: drop when <6.8.3 is gone, unneeded version with relative paths + if ver_test -lt 6.8.3; then + local link + while IFS= read -r link; do + if [[ -z ${link} ]]; then + continue + elif [[ ${link} =~ ^("${QT6_PREFIX}"/.+)\ ("${QT6_PREFIX}"/bin/.+) ]] + then + dosym -r "${BASH_REMATCH[1]#"${EPREFIX}"}" \ + "${BASH_REMATCH[2]#"${EPREFIX}"}" + else + die "unrecognized user_facing_tool_links.txt line: ${link}" + fi + done < "${BUILD_DIR}"/user_facing_tool_links.txt || die + + return + fi + local link while IFS= read -r link; do if [[ -z ${link} ]]; then continue - elif [[ ${link} =~ ^("${QT6_PREFIX}"/.+)\ ("${QT6_PREFIX}"/bin/.+) ]] - then - dosym -r "${BASH_REMATCH[1]#"${EPREFIX}"}" \ - "${BASH_REMATCH[2]#"${EPREFIX}"}" + elif [[ ${link} =~ (../[^ ]+)\ (bin/.+) ]]; then + dosym "${BASH_REMATCH[1]}" \ + "${QT6_PREFIX#"${EPREFIX}"}/${BASH_REMATCH[2]}" else - die "unrecognized line '${link}' in '${links}'" + die "unrecognized user_facing_tool_links.txt line: ${link}" fi done < "${BUILD_DIR}"/user_facing_tool_links.txt || die } @@ -275,83 +292,39 @@ _qt6-build_prepare_env() { # @FUNCTION: _qt6-build_sanitize_cpu_flags # @INTERNAL # @DESCRIPTION: -# Qt hardly support use of -mno-* or -march=native for unusual CPUs -# (or VMs) that support incomplete x86-64 feature levels, and attempts -# to allow this anyway has worked poorly. This instead tries to detect -# unusual configurations and fallbacks to generic -march=x86-64* if so -# (bug #898644,#908420,#913400,#933374). +# Qt hardly supports use of -mno-* or -march=native for unusual CPUs +# (or VMs) that support incomplete x86-64 feature levels among other +# issues such as CPUs with buggy rdrand, and attempts to allow this +# anyway has worked poorly. This strips CPU instructions related +# -m* flags and replaces with the highest -march=x86-64-v* usable as +# a non-ideal solution (bug #898644,#908420,#913400,#922498,#933374). _qt6-build_sanitize_cpu_flags() { # less of an issue with non-amd64, will revisit only if needed use amd64 || return 0 local cpuflags=( - # list of checked cpu features by qtbase in configure.cmake - aes avx avx2 avx512{bw,cd,dq,er,f,ifma,pf,vbmi,vbmi2,vl} - f16c rdrnd rdseed sha sse2 sse3 sse4_1 sse4_2 ssse3 vaes - - # extras checked by qtbase's qsimd_p.h - bmi bmi2 f16c fma lzcnt popcnt + # ideally update whenever compilers gain new ones, or could + # be offloaded to flag-o-matic if needed by other ebuilds + # grep -B 1 'Var(ix86_isa_flags' gcc/config/i386/i386.opt | grep ^m | grep -Ev '^m(16|32|64|x32)' + 3dnow 3dnowa abm adx aes amx-avx512 amx-bf16 amx-complex + amx-fp16 amx-fp8 amx-int8 amx-movrs amx-tf32 amx-tile + amx-transpose apxf avx avx10.1-256 avx10.1-512 avx10.2-256 + avx10.2-512 avx2 avx512bf16 avx512bitalg avx512bw avx512cd + avx512dq avx512f avx512fp16 avx512ifma avx512vbmi avx512vbmi2 + avx512vl avx512vnni avx512vp2intersect avx512vpopcntdq avxifma + avxneconvert avxvnni avxvnniint16 avxvnniint8 bmi bmi2 cldemote + clflushopt clwb clzero cmpccxadd crc32 cx16 enqcmd evex512 f16c + fma fma4 fsgsbase fxsr gfni hle hreset kl lwp lzcnt mmx movbe + movdir64b movdiri movrs mwait mwaitx pclmul pconfig pku popcnt + prefetchi prfchw ptwrite raoint rdpid rdrnd rdseed rtm sahf + serialize sgx sha sha512 shstk sm3 sm4 sse sse2 sse3 sse4 + sse4.1 sse4.2 sse4a ssse3 tbm tsxldtrk uintr usermsr vaes + vpclmulqdq waitpkg wbnoinvd widekl xop xsave xsavec xsaveopt + xsaves ) - # extras only needed by chromium in qtwebengine - # (see also chromium's ebuild wrt bug #530248,#544702,#546984,#853646) - [[ ${PN} == qtwebengine ]] && cpuflags+=( - avx512vnni mmx xop - - # unclear if these two are really needed given (current) chromium - # does not pass these flags, albeit it may side-disable something - # else so keeping as a safety (like chromium's ebuild does) - fma4 sse4a - ) - - # extras for which -mno-* does not matter, but can lead to enabling - # other flags when set and breaking the -march=haswell case below - # (add more as needed if users use these) - local cpuflags_filter_only=( - avx512vp2intersect - ) - - local sanitize - - # check if any known problematic -mno-* C(XX)FLAGS - is-flagq "@($(IFS='|'; echo "${cpuflags[*]/#/-mno-}"))" && sanitize=1 - - # check if qsimd_p.h (search for "enable all") will accept -march, and - # further check when -march=haswell is appended (which Qt uses for some - # parts) given combination with other -m* could lead to partial support - if [[ ! -v sanitize ]]; then - local flags - for flags in '' '-march=haswell'; do - : "$($(tc-getCXX) -E -P ${CXXFLAGS} ${CPPFLAGS} ${flags} - <<-EOF | tail -n 1 - #if (defined(__AVX2__) && (__BMI__ + __BMI2__ + __F16C__ + __FMA__ + __LZCNT__ + __POPCNT__) != 6) || \ - (defined(__AVX512F__) && (__AVX512BW__ + __AVX512CD__ + __AVX512DQ__ + __AVX512VL__) != 4) - bad - #endif - EOF - pipestatus || die - )" - if [[ ${_} == bad ]]; then - sanitize=1 - break - fi - done - fi - - # some cpus have broken rdrand/rdseed and it's enabled regardless - # with -march=native, Qt detects this and fails (bug #922498) - if [[ ! -v sanitize ]] && - ! tc-is-cross-compiler && - # the kernel also detects this and removes it from cpuinfo - [[ -r /proc/cpuinfo && $(</proc/cpuinfo) != *rdrand* ]] && - tc-cpp-is-true __RDRND__ ${CXXFLAGS} ${CPPFLAGS} - then - einfo "Detected CPU with (likely) broken rdrand/rdseed (bug #922498)" - sanitize=1 - fi - - [[ -v sanitize ]] || return 0 # *should* be fine as-is - - # determine highest(known) usable x86-64 feature level + # determine and the highest(known) usable x86-64 feature level + # so users will not lose *all* CPU-specific optimizations local march=$( $(tc-getCXX) -E -P ${CXXFLAGS} ${CPPFLAGS} - <<-EOF | tail -n 1 default @@ -368,10 +341,11 @@ _qt6-build_sanitize_cpu_flags() { pipestatus || die ) - cpuflags+=("${cpuflags_filter_only[@]}") filter-flags '-march=*' "${cpuflags[@]/#/-m}" "${cpuflags[@]/#/-mno-}" - [[ ${march} == x86-64* ]] && append-flags $(test-flags-CXX -march=${march}) - einfo "C(XX)FLAGS were adjusted due to Qt limitations: ${CXXFLAGS}" + [[ ${march} == x86-64* ]] && append-flags $(test-flags-CXX -march="${march}") + einfo "C(XX)FLAGS adjusted due to frequent -march=*/-m* issues with Qt:" + einfo " \"${CXXFLAGS}\"" + einfo "(can override with USE=custom-cflags, but no support will be given)" } fi diff --git a/eclass/rust-toolchain.eclass b/eclass/rust-toolchain.eclass index 89bca88b9e6b..41fccb7c4a07 100644 --- a/eclass/rust-toolchain.eclass +++ b/eclass/rust-toolchain.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: rust-toolchain.eclass @@ -73,6 +73,7 @@ rust_abi() { rust_arch_uri() { if [ -n "$3" ]; then echo "${RUST_TOOLCHAIN_BASEURL}${2}-${1}.tar.xz -> ${3}-${1}.tar.xz" + echo "verify-sig? ( ${RUST_TOOLCHAIN_BASEURL}${2}-${1}.tar.xz.asc -> ${3}-${1}.tar.xz.asc )" else echo "${RUST_TOOLCHAIN_BASEURL}${2}-${1}.tar.xz" echo "verify-sig? ( ${RUST_TOOLCHAIN_BASEURL}${2}-${1}.tar.xz.asc )" @@ -80,7 +81,7 @@ rust_arch_uri() { } # @FUNCTION: rust_all_arch_uris -# @USAGE: <base-uri> [alt-distfile-basename] +# @USAGE: [alt-distfile-basename] [rust_arch_uri-rename-param] # @DESCRIPTION: # Outputs the URIs for SRC_URI to help fetch dependencies, using a base URI # provided as an argument. Optionally allows for distfile renaming via a specified @@ -91,51 +92,31 @@ rust_arch_uri() { # rust_all_arch_uris() { + local alt_basename="$1" + local rename_param="$2" + echo " - abi_x86_32? ( elibc_glibc? ( $(rust_arch_uri i686-unknown-linux-gnu "$@") ) ) + abi_x86_32? ( elibc_glibc? ( $(rust_arch_uri i686-unknown-linux-gnu "${alt_basename}" "${rename_param}") ) ) abi_x86_64? ( - elibc_glibc? ( $(rust_arch_uri x86_64-unknown-linux-gnu "$@") ) - elibc_musl? ( $(rust_arch_uri x86_64-unknown-linux-musl "$@") ) + elibc_glibc? ( $(rust_arch_uri x86_64-unknown-linux-gnu "${alt_basename}" "${rename_param}") ) + elibc_musl? ( $(rust_arch_uri x86_64-unknown-linux-musl "${alt_basename}" "${rename_param}") ) ) arm? ( elibc_glibc? ( - $(rust_arch_uri arm-unknown-linux-gnueabi "$@") - $(rust_arch_uri arm-unknown-linux-gnueabihf "$@") - $(rust_arch_uri armv7-unknown-linux-gnueabihf "$@") + $(rust_arch_uri arm-unknown-linux-gnueabi "${alt_basename}" "${rename_param}") + $(rust_arch_uri arm-unknown-linux-gnueabihf "${alt_basename}" "${rename_param}") + $(rust_arch_uri armv7-unknown-linux-gnueabihf "${alt_basename}" "${rename_param}") ) ) arm64? ( - elibc_glibc? ( $(rust_arch_uri aarch64-unknown-linux-gnu "$@") ) - elibc_musl? ( $(rust_arch_uri aarch64-unknown-linux-musl "$@") ) + elibc_glibc? ( $(rust_arch_uri aarch64-unknown-linux-gnu "${alt_basename}" "${rename_param}") ) + elibc_musl? ( $(rust_arch_uri aarch64-unknown-linux-musl "${alt_basename}" "${rename_param}") ) ) - ppc? ( elibc_glibc? ( $(rust_arch_uri powerpc-unknown-linux-gnu "$@") ) ) + ppc? ( elibc_glibc? ( $(rust_arch_uri powerpc-unknown-linux-gnu "${alt_basename}" "${rename_param}") ) ) ppc64? ( - big-endian? ( elibc_glibc? ( $(rust_arch_uri powerpc64-unknown-linux-gnu "$@") ) ) - !big-endian? ( elibc_glibc? ( $(rust_arch_uri powerpc64le-unknown-linux-gnu "$@") ) ) + big-endian? ( elibc_glibc? ( $(rust_arch_uri powerpc64-unknown-linux-gnu "${alt_basename}" "${rename_param}") ) ) + !big-endian? ( elibc_glibc? ( $(rust_arch_uri powerpc64le-unknown-linux-gnu "${alt_basename}" "${rename_param}") ) ) ) - riscv? ( elibc_glibc? ( $(rust_arch_uri riscv64gc-unknown-linux-gnu "$@") ) ) - s390? ( elibc_glibc? ( $(rust_arch_uri s390x-unknown-linux-gnu "$@") ) ) + riscv? ( elibc_glibc? ( $(rust_arch_uri riscv64gc-unknown-linux-gnu "${alt_basename}" "${rename_param}") ) ) + s390? ( elibc_glibc? ( $(rust_arch_uri s390x-unknown-linux-gnu "${alt_basename}" "${rename_param}") ) ) + loong? ( elibc_glibc? ( $(rust_arch_uri loongarch64-unknown-linux-gnu "${alt_basename}" "${rename_param}") ) ) " - - # Upstream did not gain support for loong until v1.71.0. - # NOTE: Merge this into the block above after every <1.71.0 version is - # gone from tree. - local arg_version="${1##*-}" - arg_version="${arg_version:-$PV}" - if ver_test "${arg_version}" -ge 1.71.0; then - echo "loong? ( elibc_glibc? ( $(rust_arch_uri loongarch64-unknown-linux-gnu "$@") ) )" - fi - - # until https://github.com/rust-lang/rust/pull/113274 is resolved, there - # will not be upstream-built mips artifacts - if ver_test "${arg_version}" -lt 1.72.0; then - echo "mips? ( - abi_mips_o32? ( - big-endian? ( $(rust_arch_uri mips-unknown-linux-gnu "$@") ) - !big-endian? ( $(rust_arch_uri mipsel-unknown-linux-gnu "$@") ) - ) - abi_mips_n64? ( - big-endian? ( $(rust_arch_uri mips64-unknown-linux-gnuabi64 "$@") ) - !big-endian? ( $(rust_arch_uri mips64el-unknown-linux-gnuabi64 "$@") ) - ) - )" - fi } diff --git a/eclass/rust.eclass b/eclass/rust.eclass index 0630d5973854..41197ce4e3a3 100644 --- a/eclass/rust.eclass +++ b/eclass/rust.eclass @@ -12,12 +12,12 @@ # An eclass to reliably depend on a Rust or Rust/LLVM combination for # a given Rust slot. To use the eclass: # -# 1. If required, set RUST_{MAX,MIN}_SLOT to the range of supported slots. +# 1. If required, set RUST_{MAX,MIN}_VER to the range of supported slots. # # 2. If rust is optional, set RUST_OPTIONAL to a non-empty value then -# appropriately gate ${RUST_DEPEND} +# appropriately gate ${RUST_DEPEND}. # -# 3. Use rust_pkg_setup, get_rust_prefix or RUST_SLOT. +# 3. Use rust_pkg_setup, get_rust_prefix, or RUST_SLOT. # Example use for a package supporting Rust 1.72.0 to 1.82.0: # @CODE @@ -67,6 +67,10 @@ fi # @DESCRIPTION: # Definitive list of Rust slots and the associated LLVM slot, newest first. declare -A -g -r _RUST_LLVM_MAP=( + ["9999"]=20 + ["1.86.0"]=19 + ["1.85.0"]=19 + ["1.84.1"]=19 ["1.84.0"]=19 ["1.83.0"]=19 ["1.82.0"]=19 @@ -79,7 +83,6 @@ declare -A -g -r _RUST_LLVM_MAP=( ["1.75.0"]=17 ["1.74.1"]=17 ["1.71.1"]=16 - ["1.54.0"]=12 ) # @ECLASS_VARIABLE: _RUST_SLOTS_ORDERED @@ -89,6 +92,10 @@ declare -A -g -r _RUST_LLVM_MAP=( # While _RUST_LLVM_MAP stores useful info about the relationship between Rust and LLVM slots, # 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.0" + "1.85.0" + "1.84.1" "1.84.0" "1.83.0" "1.82.0" @@ -101,7 +108,6 @@ declare -a -g -r _RUST_SLOTS_ORDERED=( "1.75.0" "1.74.1" "1.71.1" - "1.54.0" ) # == user control knobs == @@ -110,7 +116,7 @@ declare -a -g -r _RUST_SLOTS_ORDERED=( # @USER_VARIABLE # @DESCRIPTION: # Specify the version (slot) of Rust to be used by the package. This is -# useful for troubleshooting and debugging purposes; If unset, the newest +# useful for troubleshooting and debugging purposes. If unset, the newest # acceptable Rust version will be used. May be combined with ERUST_TYPE_OVERRIDE. # This variable must not be set in ebuilds. @@ -138,6 +144,18 @@ declare -a -g -r _RUST_SLOTS_ORDERED=( # Lowest Rust slot supported by the package. Needs to be set before # rust_pkg_setup is called. If unset, no lower bound is assumed. +# @ECLASS_VARIABLE: RUST_SLOT +# @OUTPUT_VARIABLE +# @DESCRIPTION: +# The selected Rust slot for building, from the range defined by +# RUST_MAX_VER and RUST_MIN_VER. This is set by rust_pkg_setup. + +# @ECLASS_VARIABLE: RUST_TYPE +# @OUTPUT_VARIABLE +# @DESCRIPTION: +# The selected Rust type for building, either 'source' or 'binary'. +# This is set by rust_pkg_setup. + # @ECLASS_VARIABLE: RUST_NEEDS_LLVM # @DEFAULT_UNSET # @DESCRIPTION: @@ -169,7 +187,7 @@ declare -a -g -r _RUST_SLOTS_ORDERED=( # @DEFAULT_UNSET # @DESCRIPTION: # If set to a non-empty value, the Rust dependency will not be added -# to BDEPEND. This is useful for where packages need to gate rust behind +# to BDEPEND. This is useful for packages that need to gate rust behind # certain USE themselves. # @ECLASS_VARIABLE: RUST_REQ_USE @@ -297,12 +315,12 @@ unset -f _rust_set_globals # If -d is specified, the checks are performed relative to ESYSROOT, # and ESYSROOT-path is returned. # -# If RUST_M{AX,IN}_SLOT is non-zero, then only Rust versions that +# If RUST_M{AX,IN}_VER is non-zero, then only Rust versions that # are not newer or older than the specified slot(s) will be considered. -# Otherwise, all Rust versions are be considered acceptable. +# Otherwise, all Rust versions are considered acceptable. # # If the `rust_check_deps()` function is defined within the ebuild, it -# will be called to verify whether a particular slot is accepable. +# will be called to verify whether a particular slot is acceptable. # Within the function scope, RUST_SLOT and LLVM_SLOT will be defined. # # The function should return a true status if the slot is acceptable, @@ -437,7 +455,7 @@ _get_rust_slot() { # @FUNCTION: get_rust_path # @USAGE: prefix slot rust_type # @DESCRIPTION: -# Given argument of slot and rust_type, return an appropriate path +# Given arguments of prefix, slot, and rust_type, return an appropriate path # for the Rust install. The rust_type should be either "source" # or "binary". If the rust_type is not one of these, the function # will die. @@ -466,7 +484,7 @@ get_rust_path() { # and print an absolute path to it. If both -bin and regular Rust # are installed, the regular Rust is preferred. # -# The options and behavior are the same as get_rust_slot. +# The options and behavior are the same as _get_rust_slot. get_rust_prefix() { debug-print-function ${FUNCNAME} "$@" @@ -495,10 +513,10 @@ rust_prepend_path() { # `llvm-r1_pkg_setup` call should be made in addition to this function. # For path determination logic, please see the get_rust_prefix documentation. # -# The highest acceptable Rust slot can be set in RUST_MAX_VER variable. +# The highest acceptable Rust slot can be set in the RUST_MAX_VER variable. # If it is unset or empty, any slot is acceptable. # -# The lowest acceptable Rust slot can be set in RUST_MIN_VER variable. +# The lowest acceptable Rust slot can be set in the RUST_MIN_VER variable. # If it is unset or empty, any slot is acceptable. # # `CARGO` and `RUSTC` variables are set for the selected slot and exported. diff --git a/eclass/tests/python-utils-r1.sh b/eclass/tests/python-utils-r1.sh index 81c3c6f78158..4969da103566 100755 --- a/eclass/tests/python-utils-r1.sh +++ b/eclass/tests/python-utils-r1.sh @@ -127,11 +127,26 @@ 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*:=\[symlink\]' -PYTHON_REQ_USE=sqlite test_var PYTHON_PKG_DEP pypy3 '*dev-lang/pypy*:=\[symlink,sqlite\]' +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 + test_var EPYTHON "pypy3.${minor}" "pypy3.${minor}" + test_var PYTHON "pypy3.${minor}" "/usr/bin/pypy3.${minor}" + if [[ -x /usr/bin/pypy3.${minor} ]]; then + test_var PYTHON_SITEDIR "pypy3.${minor}" "/usr/lib*/pypy3.${minor}/site-packages" + test_var PYTHON_INCLUDEDIR "pypy3.${minor}" "/usr/include/pypy3.${minor}" + fi + test_var PYTHON_PKG_DEP "pypy3.${minor}" '*dev-lang/pypy*:3.11=' + PYTHON_REQ_USE=sqlite test_var PYTHON_PKG_DEP "pypy3.${minor}" '*dev-lang/pypy*:3.11=\[sqlite\]' + test_var PYTHON_SCRIPTDIR "pypy3.${minor}" "/usr/lib/python-exec/pypy3.${minor}" + eoutdent +done + for EPREFIX in '' /foo; do einfo "Testing python_fix_shebang with EPREFIX=${EPREFIX@Q}" eindent @@ -213,6 +228,9 @@ 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 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 eoutdent rm "${tmpfile}" diff --git a/eclass/tests/zig-utils.sh b/eclass/tests/zig-utils.sh index 14af1d2105e3..3c98134b9006 100755 --- a/eclass/tests/zig-utils.sh +++ b/eclass/tests/zig-utils.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 2024 Gentoo Authors +# Copyright 2024-2025 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 EAPI=8 @@ -197,6 +197,8 @@ c_to_zig_map=( # https://bugs.gentoo.org/924920 ["-march=armv7-a -mfpu=vfpv3-d16 -mfloat-abi=hard"]=generic+v7a+vfp3d16-soft_float + + ["-march=armv7-a -march=unset"]="generic-soft_float" ) test-convert_c_env_to_zig_cpu c_to_zig_map "${CHOST}" tend ${?} @@ -210,6 +212,10 @@ c_to_zig_map=( ["-march=armv8.3-a"]="generic+v8_3a" ["-mcpu=cortex-a78 -march=armv8.3-a"]="cortex_a78+v8_3a" + + ["-march=native"]="native" + ["-march=native -mtune=native"]="generic" + ["-mcpu=cortex-a78 -march=native"]="cortex_a78" ) test-convert_c_env_to_zig_cpu c_to_zig_map "${CHOST}" tend ${?} diff --git a/eclass/toolchain-funcs.eclass b/eclass/toolchain-funcs.eclass index 0abed5b8d75e..754d23f91c06 100644 --- a/eclass/toolchain-funcs.eclass +++ b/eclass/toolchain-funcs.eclass @@ -1,4 +1,4 @@ -# Copyright 2002-2024 Gentoo Authors +# Copyright 2002-2025 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 # @ECLASS: toolchain-funcs.eclass @@ -900,7 +900,7 @@ tc-get-compiler-type() { HAVE_GCC #endif ' - local res=$($(tc-getCPP "$@") -E -P - <<<"${code}") + local res=$($(tc-getCC "$@") -E -P - <<<"${code}") case ${res} in *HAVE_PATHCC*) echo pathcc;; @@ -927,7 +927,7 @@ tc-is-clang() { # compilers rather than maintaining a --version flag matrix, bug #335943. _gcc_fullversion() { local ver="$1"; shift - set -- $($(tc-getCPP "$@") -E -P - <<<"__GNUC__ __GNUC_MINOR__ __GNUC_PATCHLEVEL__") + set -- $($(tc-getCC "$@") -E -P - <<<"__GNUC__ __GNUC_MINOR__ __GNUC_PATCHLEVEL__") eval echo "${ver}" } @@ -960,7 +960,7 @@ gcc-micro-version() { # Internal func. Based on _gcc_fullversion() above. _clang_fullversion() { local ver="$1"; shift - set -- $($(tc-getCPP "$@") -E -P - <<<"__clang_major__ __clang_minor__ __clang_patchlevel__") + set -- $($(tc-getCC "$@") -E -P - <<<"__clang_major__ __clang_minor__ __clang_patchlevel__") eval echo "${ver}" } @@ -1347,14 +1347,14 @@ tc-get-c-rtlib() { # @FUNCTION: tc-get-ptr-size # @RETURN: Size of a pointer in bytes for CHOST (e.g. 4 or 8). tc-get-ptr-size() { - $(tc-getCPP) -P - <<< __SIZEOF_POINTER__ || + $(tc-getCC) -E -P - <<< __SIZEOF_POINTER__ || die "Could not determine CHOST pointer size" } # @FUNCTION: tc-get-build-ptr-size # @RETURN: Size of a pointer in bytes for CBUILD (e.g. 4 or 8). tc-get-build-ptr-size() { - $(tc-getBUILD_CPP) -P - <<< __SIZEOF_POINTER__ || + $(tc-getBUILD_CC) -E -P - <<< __SIZEOF_POINTER__ || die "Could not determine CBUILD pointer size" } diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass index 7068fc452dbe..2d479c9c7267 100644 --- a/eclass/toolchain.eclass +++ b/eclass/toolchain.eclass @@ -299,7 +299,8 @@ tc_has_feature() { if [[ ${PN} != kgcc64 && ${PN} != gcc-* ]] ; then IUSE+=" debug +cxx" IUSE+=" +fortran" TC_FEATURES+=( fortran ) - IUSE+=" doc hardened multilib objc" + IUSE+=" doc" TC_FEATURES+=( doc ) + IUSE+=" hardened multilib objc" IUSE+=" pgo" IUSE+=" objc-gc" TC_FEATURES+=( objc-gc ) IUSE+=" libssp objc++" @@ -339,6 +340,7 @@ if [[ ${PN} != kgcc64 && ${PN} != gcc-* ]] ; then tc_version_is_at_least 14.0.0_pre20230423 ${PV} && IUSE+=" rust" TC_FEATURES+=( rust ) tc_version_is_at_least 14.2.1_p20241026 ${PV} && IUSE+=" time64" tc_version_is_at_least 15.0.0_pre20241124 ${PV} && IUSE+=" libgdiagnostics" + tc_version_is_at_least 15.0.1_pre20250316 ${PV} && IUSE+=" cobol" fi if tc_version_is_at_least 10; then @@ -380,6 +382,11 @@ BDEPEND=" >=sys-devel/autogen-5.5.4 ) " + +if tc_has_feature doc ; then + BDEPEND+=" doc? ( app-text/doxygen )" +fi + DEPEND="${RDEPEND}" if [[ ${PN} == gcc && ${PV} == *_p* ]] ; then @@ -418,7 +425,6 @@ if [[ ${PN} != gnat-gpl ]] && tc_has_feature ada ; then sys-devel/gcc:${SLOT}[ada] <sys-devel/gcc-${SLOT}[ada] <dev-lang/ada-bootstrap-$((${SLOT} + 1)) - dev-lang/gnat-gpl[ada] ) ) " @@ -429,7 +435,6 @@ if [[ ${PN} != gnat-gpl ]] && tc_has_feature ada ; then sys-devel/gcc:${SLOT}[ada] <sys-devel/gcc-${SLOT}[ada] <dev-lang/ada-bootstrap-${SLOT} - dev-lang/gnat-gpl[ada] ) ) " @@ -691,6 +696,7 @@ toolchain_src_prepare() { # Workaround -march=native not working for stage1 with non-GCC (bug #933772). if ! tc-is-gcc && [[ "${CFLAGS}${CXXFLAGS}" == *-march=native* ]] ; then CLANG_DISABLE_CET_HACK=1 + filter-flags '-march=native' fi if ! use vanilla ; then @@ -1250,6 +1256,7 @@ toolchain_src_configure() { is_f77 && GCC_LANG+=",f77" is_f95 && GCC_LANG+=",f95" is_ada && GCC_LANG+=",ada" + is_cobol && GCC_LANG+=",cobol" is_modula2 && GCC_LANG+=",m2" is_rust && GCC_LANG+=",rust" @@ -1473,7 +1480,7 @@ toolchain_src_configure() { confgcc+=( # https://gcc.gnu.org/PR100289 - # TOOD: Find a way to disable this just for stage1 cross? + # TODO: Find a way to disable this just for stage1 cross? --disable-gcov --disable-bootstrap @@ -1826,6 +1833,11 @@ toolchain_src_configure() { fi fi + if [[ ${CTARGET} != *-darwin* ]] && tc_version_is_at_least 14.1 ; then + # This allows passing -stdlib-=libc++ at runtime. + confgcc+=( --with-gxx-libcxx-include-dir="${ESYSROOT}"/usr/include/c++/v1 ) + fi + # TODO: Ignore RCs here (but TOOLCHAIN_IS_RC isn't yet an eclass var) if [[ ${PV} == *_p* && -f "${S}"/gcc/doc/gcc.info ]] ; then # Safeguard against https://gcc.gnu.org/PR106899 being fixed @@ -2099,6 +2111,11 @@ gcc_do_filter_flags() { # https://gcc.gnu.org/PR100431 filter-flags -Werror=format-security + if ver_test -lt 11.1 ; then + filter-flags '-fdiagnostics-urls=*' + filter-flags '-Wstringop-overread' + fi + if ver_test -lt 13.6 ; then # These aren't supported by the just-built compiler either. filter-flags -fharden-compares -fharden-conditional-branches \ @@ -2266,6 +2283,8 @@ gcc_do_make() { local emakeargs=( LDFLAGS="${LDFLAGS}" + # TODO: Can we replace this with --enable-version-specific-runtime-libs + # these days? LIBPATH="${LIBPATH}" ) @@ -2340,22 +2359,18 @@ gcc_do_make() { pushd "${WORKDIR}"/build >/dev/null || die emake "${emakeargs[@]}" ${GCC_MAKE_TARGET} - if ! is_crosscompile && _tc_use_if_iuse cxx && _tc_use_if_iuse doc ; then - if type -p doxygen > /dev/null ; then - cd "${CTARGET}"/libstdc++-v3/doc || die - emake doc-man-doxygen + if ! is_crosscompile && _tc_use_if_iuse cxx && tc_has_feature doc && _tc_use_if_iuse doc ; then + cd "${CTARGET}"/libstdc++-v3/doc || die + emake doc-man-doxygen - # Clean bogus manpages. bug #113902 - find -name '*_build_*' -delete || die + # Clean bogus manpages. bug #113902 + find -name '*_build_*' -delete || die - # Blow away generated directory references. Newer versions of gcc - # have gotten better at this, but not perfect. This is easier than - # backporting all of the various doxygen patches. bug #486754 - find -name '*_.3' -exec grep -l ' Directory Reference ' {} + | \ - xargs rm -f - else - ewarn "Skipping libstdc++ manpage generation since you don't have doxygen installed" - fi + # Blow away generated directory references. Newer versions of gcc + # have gotten better at this, but not perfect. This is easier than + # backporting all of the various doxygen patches. bug #486754 + find -name '*_.3' -exec grep -l ' Directory Reference ' {} + | \ + xargs rm -f fi popd >/dev/null || die @@ -2592,7 +2607,7 @@ toolchain_src_install() { cd "${D}"${BINPATH} || die # Ugh: we really need to auto-detect this list. # It's constantly out of date. - for x in cpp gcc gccrs g++ c++ gcov gdc g77 gfortran gccgo gnat* ; do + for x in cpp gcc gccrs g++ c++ gcobol gcov gdc g77 gfortran gccgo gnat* ; do # For some reason, g77 gets made instead of ${CTARGET}-g77... # this should take care of that if [[ -f ${x} ]] ; then @@ -2749,7 +2764,9 @@ gcc_movelibs() { # code to run on the target. if is_crosscompile ; then dodir "${HOSTLIBPATH#${EPREFIX}}" - mv "${ED}"/usr/$(get_libdir)/libcc1* "${D}${HOSTLIBPATH}" || die + # XXX: Ideally, we'd use $(get_libdir) here, but it's + # not right for cross. See bug #942573 and bug #794181. + mv "${ED}"/usr/lib*/libcc1* "${D}${HOSTLIBPATH}" || die fi # libgccjit gets installed to /usr/lib, not /usr/$(get_libdir). Probably @@ -2963,7 +2980,7 @@ toolchain_pkg_postrm() { return 0 else # Removed the last GCC installed (bug #906040) - if ! has_version "sys-devel/gcc" && has_version "sys-devel/clang" ; then + if ! has_version "sys-devel/gcc" && has_version "llvm-core/clang" ; then einfo "Last GCC version removed. Cleaning up ${EROOT}/etc/clang/gentoo-gcc-install.cfg." echo > "${EROOT}"/etc/clang/gentoo-gcc-install.cfg fi @@ -3132,6 +3149,11 @@ is_objcxx() { _tc_use_if_iuse cxx && _tc_use_if_iuse objc++ } +is_cobol() { + gcc-lang-supported cobol || return 1 + _tc_use_if_iuse cobol +} + is_modula2() { gcc-lang-supported m2 || return 1 _tc_use_if_iuse cxx && _tc_use_if_iuse modula2 @@ -3153,14 +3175,16 @@ XGCC() { get_make_var GCC_FOR_TARGET ; } has toolchain_death_notice ${EBUILD_DEATH_HOOKS} || EBUILD_DEATH_HOOKS+=" toolchain_death_notice" toolchain_death_notice() { + # TODO: For bootstrap comparison failures, include the stage2 & stage3 + # differing objects to avoid having to ask reporters to manually collect... local dir for dir in "${WORKDIR}"/build-jit "${WORKDIR}"/build ; do if [[ -e "${dir}" ]] ; then pushd "${WORKDIR}" >/dev/null (echo '' | $(tc-getCC ${CTARGET}) ${CFLAGS} -v -E - 2>&1) > "${dir}"/gccinfo.log [[ -e "${T}"/build.log ]] && cp "${T}"/build.log "${dir}" - tar -arf "${WORKDIR}"/gcc-build-logs.tar \ - "${dir#${WORKDIR}/}"/gccinfo.log "${dir#${WORKDIR}/}"/build.log $(find -name "${dir#${WORKDIR}/}"/config.log) + tar -rf "${WORKDIR}"/gcc-build-logs.tar \ + "${dir#${WORKDIR}/}"/gccinfo.log "${dir#${WORKDIR}/}"/build.log $(find "${dir#${WORKDIR}/}" -type f -name "config.log") rm "${dir#${WORKDIR}/}"/gccinfo.log "${dir#${WORKDIR}/}"/build.log eerror eerror "Please include ${WORKDIR}/gcc-build-logs.tar.xz in your bug report." @@ -3168,7 +3192,7 @@ toolchain_death_notice() { popd >/dev/null fi done - xz -9e "${WORKDIR}"/gcc-build-logs.tar.xz + xz -9e "${WORKDIR}"/gcc-build-logs.tar } fi diff --git a/eclass/zig-utils.eclass b/eclass/zig-utils.eclass index 5502d997935e..b1a7e0801667 100644 --- a/eclass/zig-utils.eclass +++ b/eclass/zig-utils.eclass @@ -202,6 +202,35 @@ fi # 0.13.0 # @CODE +# @FUNCTION: _get-c-option +# @INTERNAL +# @USAGE: <option-name> +# @DESCRIPTION: +# Gets value of some compiler option from CFLAGS, starting from the end. +# Must be a full name, without "-" and "=..." part. +# +# Example: +# @CODE +# CFLAGS="-march=i686 -march=i586" +# _get-c-option march # returns i586 +# @CODE +_get-c-option() { + if [[ ${#} -ne 1 ]]; then + die "${FUNCNAME[0]}: expected 1 argument, got ${#}" + fi + + local prefix="-${1}=" + local c_flags=( ${CFLAGS} ) + for (( i=${#c_flags[@]} - 1; i >= 0; i -= 1 )); do + local c_flag="${c_flags[i]}" + if [[ "${c_flag}" == ${prefix}* ]]; then + echo "${c_flag#${prefix}}" + return + fi + done + echo "" +} + # @FUNCTION: zig-utils_c_env_to_zig_target # @USAGE: <C-style target tuple> <CFLAGS> # @DESCRIPTION: @@ -224,8 +253,8 @@ zig-utils_c_env_to_zig_target() { local c_arch="${c_tuple%%-*}" local c_abi="${c_tuple##*-}" - local c_flags="${2}" - local c_flags_march="$(CFLAGS="${c_flags}" get-flag march)" + local -x CFLAGS="${2}" + local c_flags_march="$(_get-c-option march)" local arch os abi @@ -279,11 +308,12 @@ zig-utils_c_env_to_zig_cpu() { local c_tuple="${1}" local c_arch="${c_tuple%%-*}" - local c_flags="${2}" - local c_flags_mabi="$(CFLAGS="${c_flags}" get-flag mabi)" - local c_flags_march="$(CFLAGS="${c_flags}" get-flag march)" - local c_flags_mcpu="$(CFLAGS="${c_flags}" get-flag mcpu)" - local c_flags_mfpu="$(CFLAGS="${c_flags}" get-flag mfpu)" + local -x CFLAGS="${2}" + local c_flags_mabi="$(_get-c-option mabi)" + local c_flags_march="$(_get-c-option march)" + local c_flags_mcpu="$(_get-c-option mcpu)" + local c_flags_mfpu="$(_get-c-option mfpu)" + local c_flags_mtune="$(_get-c-option mtune)" local base_cpu features="" @@ -303,13 +333,28 @@ zig-utils_c_env_to_zig_cpu() { esac case "${c_flags_march}" in - "") ;; + "" | unset) ;; armv*) local c_arm_family="${c_flags_march##arm}" c_arm_family="${c_arm_family//./_}" c_arm_family="${c_arm_family//-/}" features+="+${c_arm_family}" ;; + native) + # GCC docs: This option has no effect if + # the compiler is unable to recognize the + # architecture of the host system. + # + # When -march=native is given and no other + # -mcpu or -mtune is given then ... -march=native + # is treated as -mcpu=native. + if [[ -z "${c_flags_mcpu}${c_flags_mtune}" ]]; then + base_cpu=native + else + : # Zig can not detect CPU features (architecture + # in our case) separately from model, so we ignore it. + fi + ;; *) features+="+${c_flags_march}";; esac @@ -448,6 +493,8 @@ zig-utils_find_installation() { local zig_supported_versions=( "9999" + "0.14.1" + "0.14.0" "0.13.1" "0.13.0" ) diff --git a/eclass/zig.eclass b/eclass/zig.eclass index 2a0178e66d71..0de7ee9eb47a 100644 --- a/eclass/zig.eclass +++ b/eclass/zig.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: zig.eclass @@ -152,6 +152,7 @@ _zig_set_zbs_uris() { _zig_set_zbs_uris # @ECLASS_VARIABLE: my_zbs_args +# @DEFAULT_UNSET # @DESCRIPTION: # Bash array with ebuild-specified arguments to pass to the # "zig build" after "src_configure". @@ -159,6 +160,8 @@ _zig_set_zbs_uris # need to override default optimize mode of this eclass (ReleaseSafe) # with your default, please use "--release=small" etc. syntax so that # user can still override it in ZBS_ARGS_EXTRA. +# Note: `--prefix` and other relative arguments will +# process here as relative to BUILD_DIR. # # Example: # @CODE @@ -170,7 +173,6 @@ _zig_set_zbs_uris # zig_src_configure # } # @CODE -: "${my_zbs_args:=}" # @ECLASS_VARIABLE: ZBS_ARGS_EXTRA # @USER_VARIABLE @@ -203,7 +205,6 @@ _zig_set_zbs_uris : "${ZBS_VERBOSE:=ON}" # @ECLASS_VARIABLE: BUILD_DIR -# @DEFAULT_UNSET # @DESCRIPTION: # Directory where all "ezig build" calls will be proceeded. # Defaults to "${WORKDIR}/${P}-build" if not set. @@ -293,14 +294,18 @@ zig_init_base_args() { -Dcpu="${ZIG_CPU}" --release=safe + # We want absolute path here so that it would appear correctly + # when embedded to binaries with build.zig, but without DESTDIR + # it would try to escape sandbox and install directly to root. + # + # Therefore, we set DESTDIR each time to be: + # 1) BUILD_DIR in phases before `src_install`, + # 2) D during `src_install`. + --prefix "${EPREFIX}/usr/" --prefix-exe-dir bin/ --prefix-lib-dir "$(get_libdir)/" --prefix-include-dir include/ - # Should be relative path to make other calls easier, - # so remove leading slash here. - --prefix "${EPREFIX:+${EPREFIX#/}/}usr/" - --libc "${T}/zig_libc.txt" ) if [[ "${ZBS_VERBOSE}" != OFF ]]; then @@ -487,12 +492,17 @@ zig_src_configure() { # @DESCRIPTION: # Calls "ezig build" with previously set ZBS_ARGS. # Args passed to this function will be passed after ZBS_ARGS. +# They can be used to call custom steps or override some +# options temporarily like `--prefix`. +# Note that `--prefix` and other relative arguments will +# process here as relative to BUILD_DIR. zig_src_compile() { pushd "${BUILD_DIR}" > /dev/null || die local args=( "${ZBS_ARGS[@]}" "${@}" ) einfo "ZBS: compiling with: ${args[@]}" - nonfatal ezig build "${args[@]}" || die "ZBS: compilation failed" + DESTDIR="${BUILD_DIR}" nonfatal ezig build "${args[@]}" || + die "ZBS: compilation failed" popd > /dev/null || die } @@ -505,6 +515,8 @@ zig_src_compile() { # Args passed to this function will be passed after ZBS_ARGS. # Note: currently step detection might give false positives in # very rare cases, it will be improved in the future. +# Note that `--prefix` and other relative arguments will +# process here as relative to BUILD_DIR. zig_src_test() { pushd "${BUILD_DIR}" > /dev/null || die @@ -526,7 +538,7 @@ zig_src_test() { nonfatal ezig build --list-steps "${args[@]}" ); then einfo "ZBS: testing with: ${args[@]}" - nonfatal ezig build test "${args[@]}" || + DESTDIR="${BUILD_DIR}" nonfatal ezig build test "${args[@]}" || die "ZBS: tests failed" else einfo "Test step not found, skipping." @@ -541,6 +553,8 @@ zig_src_test() { # Calls "ezig build" with DESTDIR and previously set ZBS_ARGS. # Args passed to this function will be passed after ZBS_ARGS. # Also installs documentation via "einstalldocs". +# Note that `--prefix` and other relative arguments will +# process here as relative to D. zig_src_install() { pushd "${BUILD_DIR}" > /dev/null || die local args=( "${ZBS_ARGS[@]}" "${@}" ) |