diff options
Diffstat (limited to 'eclass')
-rw-r--r-- | eclass/Manifest.gz | bin | 39542 -> 39223 bytes | |||
-rw-r--r-- | eclass/bzr.eclass | 258 | ||||
-rw-r--r-- | eclass/ltprune.eclass | 177 | ||||
-rw-r--r-- | eclass/toolchain.eclass | 69 |
4 files changed, 33 insertions, 471 deletions
diff --git a/eclass/Manifest.gz b/eclass/Manifest.gz Binary files differindex 310ca38e64ed..287cb6e84c2b 100644 --- a/eclass/Manifest.gz +++ b/eclass/Manifest.gz diff --git a/eclass/bzr.eclass b/eclass/bzr.eclass deleted file mode 100644 index b442381dc668..000000000000 --- a/eclass/bzr.eclass +++ /dev/null @@ -1,258 +0,0 @@ -# Copyright 1999-2023 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -# @DEAD -# @ECLASS: bzr.eclass -# @MAINTAINER: -# Ulrich Müller <ulm@gentoo.org> -# @AUTHOR: -# Jorge Manuel B. S. Vicetto <jmbsvicetto@gentoo.org> -# Mark Lee <bzr-gentoo-overlay@lazymalevolence.com> -# Ulrich Müller <ulm@gentoo.org> -# Christian Faulhammer <fauli@gentoo.org> -# @SUPPORTED_EAPIS: 7 8 -# @BLURB: generic fetching functions for the Bazaar VCS -# @DESCRIPTION: -# The bzr.eclass provides functions to fetch and unpack sources from -# repositories of the Bazaar distributed version control system. -# The eclass was originally derived from git.eclass. -# -# Note: Just set EBZR_REPO_URI to the URI of the branch and src_unpack() -# of this eclass will export the branch to ${WORKDIR}/${P}. - -case ${EAPI} in - 7|8) ;; - *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;; -esac - -PROPERTIES+=" live" - -BDEPEND="dev-vcs/breezy" - -# @ECLASS_VARIABLE: EBZR_STORE_DIR -# @USER_VARIABLE -# @DESCRIPTION: -# The directory to store all fetched Bazaar live sources. -: "${EBZR_STORE_DIR:=${PORTAGE_ACTUAL_DISTDIR:-${DISTDIR}}/bzr-src}" - -# @ECLASS_VARIABLE: EBZR_UNPACK_DIR -# @DESCRIPTION: -# The working directory where the sources are copied to. -: "${EBZR_UNPACK_DIR:=${WORKDIR}/${P}}" - -# @ECLASS_VARIABLE: EBZR_INIT_REPO_CMD -# @DESCRIPTION: -# The Bazaar command to initialise a shared repository. -: "${EBZR_INIT_REPO_CMD:="brz init-shared-repository --no-trees"}" - -# @ECLASS_VARIABLE: EBZR_FETCH_CMD -# @DESCRIPTION: -# The Bazaar command to fetch the sources. -: "${EBZR_FETCH_CMD:="brz branch --no-tree"}" - -# @ECLASS_VARIABLE: EBZR_UPDATE_CMD -# @DESCRIPTION: -# The Bazaar command to update the sources. -: "${EBZR_UPDATE_CMD:="brz pull --overwrite-tags"}" - -# @ECLASS_VARIABLE: EBZR_EXPORT_CMD -# @DESCRIPTION: -# The Bazaar command to export a branch. -: "${EBZR_EXPORT_CMD:="brz export"}" - -# @ECLASS_VARIABLE: EBZR_CHECKOUT_CMD -# @DESCRIPTION: -# The Bazaar command to checkout a branch. -: "${EBZR_CHECKOUT_CMD:="brz checkout --lightweight -q"}" - -# @ECLASS_VARIABLE: EBZR_REVNO_CMD -# @DESCRIPTION: -# The Bazaar command to list a revision number of the branch. -: "${EBZR_REVNO_CMD:="brz revno"}" - -# @ECLASS_VARIABLE: EBZR_OPTIONS -# @DEFAULT_UNSET -# @DESCRIPTION: -# The options passed to the fetch and update commands. - -# @ECLASS_VARIABLE: EBZR_REPO_URI -# @DEFAULT_UNSET -# @REQUIRED -# @DESCRIPTION: -# The repository URI for the source package. - -# @ECLASS_VARIABLE: EBZR_PROJECT -# @DESCRIPTION: -# The project name of your ebuild. Normally, the branch will be stored -# in the ${EBZR_STORE_DIR}/${EBZR_PROJECT} directory. -# -# If EBZR_BRANCH is set (see below), then a shared repository will be -# created in that directory, and the branch will be located in -# ${EBZR_STORE_DIR}/${EBZR_PROJECT}/${EBZR_BRANCH}. -: "${EBZR_PROJECT:=${PN}}" - -# @ECLASS_VARIABLE: EBZR_BRANCH -# @DEFAULT_UNSET -# @DESCRIPTION: -# The directory where to store the branch within a shared repository, -# relative to ${EBZR_STORE_DIR}/${EBZR_PROJECT}. -# -# This variable should be set if there are several live ebuilds for -# different branches of the same upstream project. The branches can -# then share the same repository in EBZR_PROJECT, which will save both -# data traffic volume and disk space. -# -# If there is only a live ebuild for one single branch, EBZR_BRANCH -# needs not be set. In this case, the branch will be stored in a -# stand-alone repository directly in EBZR_PROJECT. - -# @ECLASS_VARIABLE: EBZR_REVISION -# @DEFAULT_UNSET -# @DESCRIPTION: -# Revision to fetch, defaults to the latest (see brz help revisionspec). - -# @ECLASS_VARIABLE: EBZR_OFFLINE -# @USER_VARIABLE -# @DESCRIPTION: -# Set this variable to a non-empty value to disable automatic updating -# of a bzr source tree. This is intended to be set outside the ebuild -# by users. -: "${EBZR_OFFLINE=${EVCS_OFFLINE}}" - -# @ECLASS_VARIABLE: EVCS_UMASK -# @USER_VARIABLE -# @DEFAULT_UNSET -# @DESCRIPTION: -# Set this variable to a custom umask. This is intended to be set by -# users. By setting this to something like 002, it can make life easier -# for people who do development as non-root (but are in the portage -# group), and then switch over to building with FEATURES=userpriv. -# Or vice-versa. Shouldn't be a security issue here as anyone who has -# portage group write access already can screw the system over in more -# creative ways. - -# @ECLASS_VARIABLE: EBZR_WORKDIR_CHECKOUT -# @DEFAULT_UNSET -# @DESCRIPTION: -# If this variable is set to a non-empty value, EBZR_CHECKOUT_CMD will -# be used instead of EBZR_EXPORT_CMD to copy the sources to WORKDIR. - -# @FUNCTION: _bzr_initial_fetch -# @USAGE: <repository URI> <branch directory> -# @INTERNAL -# @DESCRIPTION: -# Internal function, retrieves the source code from a repository for the -# first time, using ${EBZR_FETCH_CMD}. -_bzr_initial_fetch() { - local repo_uri=$1 branch_dir=$2 - - if [[ -n ${EBZR_OFFLINE} ]]; then - die "EBZR_OFFLINE cannot be used when there is no local branch yet." - fi - - # fetch branch - einfo "bzr branch start -->" - einfo " repository: ${repo_uri} => ${branch_dir}" - - ${EBZR_FETCH_CMD} ${EBZR_OPTIONS} "${repo_uri}" "${branch_dir}" \ - || die "${ECLASS}: can't branch from ${repo_uri}" -} - -# @FUNCTION: _bzr_update -# @USAGE: <repository URI> <branch directory> -# @INTERNAL -# @DESCRIPTION: -# Internal function, updates the source code from a repository, using -# ${EBZR_UPDATE_CMD}. -_bzr_update() { - local repo_uri=$1 branch_dir=$2 - - if [[ -n ${EBZR_OFFLINE} ]]; then - einfo "skipping bzr pull -->" - einfo " repository: ${repo_uri}" - else - # update branch - einfo "bzr pull start -->" - einfo " repository: ${repo_uri}" - - pushd "${branch_dir}" > /dev/null \ - || die "${ECLASS}: can't chdir to ${branch_dir}" - ${EBZR_UPDATE_CMD} ${EBZR_OPTIONS} "${repo_uri}" \ - || die "${ECLASS}: can't pull from ${repo_uri}" - popd > /dev/null || die "${ECLASS}: popd failed" - fi -} - -# @FUNCTION: bzr_fetch -# @DESCRIPTION: -# Wrapper function to fetch sources from a Bazaar repository with -# bzr branch or bzr pull, depending on whether there is an existing -# working copy. -bzr_fetch() { - local repo_dir branch_dir save_umask - - [[ -n ${EBZR_REPO_URI} ]] || die "${ECLASS}: EBZR_REPO_URI is empty" - - if [[ ! -d ${EBZR_STORE_DIR} ]]; then - ( - addwrite / - mkdir -p "${EBZR_STORE_DIR}" \ - || die "${ECLASS}: can't mkdir ${EBZR_STORE_DIR}" - ) - fi - - pushd "${EBZR_STORE_DIR}" > /dev/null \ - || die "${ECLASS}: can't chdir to ${EBZR_STORE_DIR}" - - repo_dir=${EBZR_STORE_DIR}/${EBZR_PROJECT} - branch_dir=${repo_dir}${EBZR_BRANCH:+/${EBZR_BRANCH}} - - if [[ -n ${EVCS_UMASK} ]]; then - save_umask=$(umask) || die - umask "${EVCS_UMASK}" || die - fi - addwrite "${EBZR_STORE_DIR}" - - if [[ ! -d ${branch_dir}/.bzr ]]; then - if [[ ${repo_dir} != "${branch_dir}" && ! -d ${repo_dir}/.bzr ]]; then - einfo "creating shared bzr repository: ${repo_dir}" - ${EBZR_INIT_REPO_CMD} "${repo_dir}" \ - || die "${ECLASS}: can't create shared repository" - fi - _bzr_initial_fetch "${EBZR_REPO_URI}" "${branch_dir}" - else - _bzr_update "${EBZR_REPO_URI}" "${branch_dir}" - fi - - if [[ -n ${save_umask} ]]; then - umask "${save_umask}" || die - fi - - cd "${branch_dir}" || die "${ECLASS}: can't chdir to ${branch_dir}" - - # Save revision number in environment. #311101 - export EBZR_REVNO=$(${EBZR_REVNO_CMD}) - - if [[ -n ${EBZR_WORKDIR_CHECKOUT} ]]; then - einfo "checking out ..." - ${EBZR_CHECKOUT_CMD} ${EBZR_REVISION:+-r ${EBZR_REVISION}} \ - . "${EBZR_UNPACK_DIR}" || die "${ECLASS}: checkout failed" - else - einfo "exporting ..." - ${EBZR_EXPORT_CMD} ${EBZR_REVISION:+-r ${EBZR_REVISION}} \ - "${EBZR_UNPACK_DIR}" . || die "${ECLASS}: export failed" - fi - einfo \ - "revision ${EBZR_REVISION:-${EBZR_REVNO}} is now in ${EBZR_UNPACK_DIR}" - - popd > /dev/null || die "${ECLASS}: popd failed" -} - -# @FUNCTION: bzr_src_unpack -# @DESCRIPTION: -# Default src_unpack(), calls bzr_fetch. -bzr_src_unpack() { - bzr_fetch -} - -EXPORT_FUNCTIONS src_unpack diff --git a/eclass/ltprune.eclass b/eclass/ltprune.eclass deleted file mode 100644 index 51f5aaabfea7..000000000000 --- a/eclass/ltprune.eclass +++ /dev/null @@ -1,177 +0,0 @@ -# Copyright 1999-2024 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -# @DEAD -# @ECLASS: ltprune.eclass -# @MAINTAINER: -# Michał Górny <mgorny@gentoo.org> -# @SUPPORTED_EAPIS: 0 1 2 3 4 5 6 -# @BLURB: Smart .la file pruning -# @DEPRECATED: none -# @DESCRIPTION: -# A function to locate and remove unnecessary .la files. -# -# Discouraged. Whenever possible, please use much simpler: -# @CODE -# find "${ED}" -type f -name '*.la' -delete || die -# @CODE - -if [[ -z ${_LTPRUNE_ECLASS} ]]; then - -case ${EAPI:-0} in - 0|1|2|3|4|5|6) - ;; - *) - die "${ECLASS}: banned in EAPI=${EAPI}; use 'find' instead";; -esac - -inherit toolchain-funcs - -# @FUNCTION: prune_libtool_files -# @USAGE: [--all|--modules] -# @DESCRIPTION: -# Locate unnecessary libtool files (.la) and libtool static archives -# (.a) and remove them from installation image. -# -# By default, .la files are removed whenever the static linkage can -# either be performed using pkg-config or doesn't introduce additional -# flags. -# -# If '--modules' argument is passed, .la files for modules (plugins) are -# removed as well. This is usually useful when the package installs -# plugins and the plugin loader does not use .la files. -# -# If '--all' argument is passed, all .la files are removed without -# performing any heuristic on them. You shouldn't ever use that, -# and instead report a bug in the algorithm instead. -# -# The .a files are only removed whenever corresponding .la files state -# that they should not be linked to, i.e. whenever these files -# correspond to plugins. -# -# Note: if your package installs both static libraries and .pc files -# which use variable substitution for -l flags, you need to add -# pkg-config to your DEPEND. -prune_libtool_files() { - debug-print-function ${FUNCNAME} "$@" - - local removing_all removing_modules opt - for opt; do - case "${opt}" in - --all) - removing_all=1 - removing_modules=1 - ;; - --modules) - removing_modules=1 - ;; - *) - die "Invalid argument to ${FUNCNAME}(): ${opt}" - esac - done - - local f - local queue=() - while IFS= read -r -d '' f; do # for all .la files - local archivefile=${f/%.la/.a} - - # The following check is done by libtool itself. - # It helps us avoid removing random files which match '*.la', - # see bug #468380. - if ! sed -n -e '/^# Generated by .*libtool/q0;4q1' "${f}"; then - continue - fi - - [[ ${f} != ${archivefile} ]] || die 'regex sanity check failed' - local reason= pkgconfig_scanned= - local snotlink=$(sed -n -e 's:^shouldnotlink=::p' "${f}") - - if [[ ${snotlink} == yes ]]; then - - # Remove static libs we're not supposed to link against. - if [[ -f ${archivefile} ]]; then - einfo "Removing unnecessary ${archivefile#${D%/}} (static plugin)" - queue+=( "${archivefile}" ) - fi - - # The .la file may be used by a module loader, so avoid removing it - # unless explicitly requested. - if [[ ${removing_modules} ]]; then - reason='module' - fi - - else - - # Remove .la files when: - # - user explicitly wants us to remove all .la files, - # - respective static archive doesn't exist, - # - they are covered by a .pc file already, - # - they don't provide any new information (no libs & no flags). - - if [[ ${removing_all} ]]; then - reason='requested' - elif [[ ! -f ${archivefile} ]]; then - reason='no static archive' - elif [[ ! $(sed -nre \ - "s/^(dependency_libs|inherited_linker_flags)='(.*)'$/\2/p" \ - "${f}") ]]; then - reason='no libs & flags' - else - if [[ ! ${pkgconfig_scanned} ]]; then - # Create a list of all .pc-covered libs. - local pc_libs=() - if [[ ! ${removing_all} ]]; then - local pc - local tf=${T}/prune-lt-files.pc - local pkgconf=$(tc-getPKG_CONFIG) - - while IFS= read -r -d '' pc; do # for all .pc files - local arg libs - - # Use pkg-config if available (and works), - # fallback to sed. - if ${pkgconf} --exists "${pc}" &>/dev/null; then - sed -e '/^Requires:/d' "${pc}" > "${tf}" - libs=$(${pkgconf} --libs "${tf}") - else - libs=$(sed -ne 's/^Libs://p' "${pc}") - fi - - for arg in ${libs}; do - if [[ ${arg} == -l* ]]; then - if [[ ${arg} == '*$*' ]]; then - eerror "${FUNCNAME}: variable substitution likely failed in ${pc}" - eerror "(arg: ${arg})" - eerror "Most likely, you need to add virtual/pkgconfig to DEPEND." - die "${FUNCNAME}: unsubstituted variable found in .pc" - fi - - pc_libs+=( lib${arg#-l}.la ) - fi - done - done < <(find "${D}" -type f -name '*.pc' -print0) - - rm -f "${tf}" - fi - - pkgconfig_scanned=1 - fi # pkgconfig_scanned - - has "${f##*/}" "${pc_libs[@]}" && reason='covered by .pc' - fi # removal due to .pc - - fi # shouldnotlink==no - - if [[ ${reason} ]]; then - einfo "Removing unnecessary ${f#${D%/}} (${reason})" - queue+=( "${f}" ) - fi - done < <(find "${D}" -xtype f -name '*.la' -print0) - - if [[ ${queue[@]} ]]; then - rm -f "${queue[@]}" - fi -} - -_LTPRUNE_ECLASS=1 -fi #_LTPRUNE_ECLASS diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass index bfb087146864..ac236f3127f9 100644 --- a/eclass/toolchain.eclass +++ b/eclass/toolchain.eclass @@ -1920,34 +1920,27 @@ toolchain_src_test() { local -x LD_PRELOAD= # Controls running expensive tests in e.g. the torture testsuite. + # Note that 'TEST', not 'TESTS', is correct here as it's a GCC + # testsuite variable, not ours. local -x GCC_TEST_RUN_EXPENSIVE=1 # Use a subshell to allow meddling with flags just for the testsuite ( - # Unexpected warnings confuse the tests. - filter-flags -W* - # May break parsing. - filter-flags '-fdiagnostics-color=*' '-fdiagnostics-urls=*' - # Gentoo QA flags which don't belong in tests - filter-flags -frecord-gcc-switches - filter-flags '-Wl,--defsym=__gentoo_check_ldflags__=0' - # Go doesn't support this and causes noisy warnings - filter-flags -Wbuiltin-declaration-mismatch - # The ASAN tests at least need LD_PRELOAD and the contract - # tests. - filter-flags -fno-semantic-interposition - # Workaround our -Wformat-security default which breaks # various tests as it adds unexpected warning output. - append-flags -Wno-format-security -Wno-format + GCC_TESTS_CFLAGS+=" -Wno-format-security -Wno-format" + GCC_TESTS_CXXFLAGS+=" -Wno-format-security -Wno-format" + # Workaround our -Wtrampolines default which breaks # tests too. - append-flags -Wno-trampolines + GCC_TESTS_CFLAGS+=" -Wno-trampolines" + GCC_TESTS_CXXFLAGS+=" -Wno-trampolines" # A handful of Ada (and objc++?) tests need an executable stack - append-ldflags -Wl,--no-warn-execstack + GCC_TESTS_LDFLAGS+=" -Wl,--no-warn-execstack" # Avoid confusing tests like Fortran/C interop ones where # CFLAGS are used. - append-flags -Wno-complain-wrong-lang + GCC_TESTS_CFLAGS+=" -Wno-complain-wrong-lang" + GCC_TESTS_CXXFLAGS+=" -Wno-complain-wrong-lang" # Issues with Ada tests: # gnat.dg/align_max.adb @@ -1958,11 +1951,12 @@ toolchain_src_test() { # # TODO: This isn't ideal given it obv. affects codegen # and we want to be sure it works. - append-flags -fno-stack-clash-protection + GCC_TESTS_CFLAGS+=" -fno-stack-clash-protection" + GCC_TESTS_CXXFLAGS+=" -fno-stack-clash-protection" # configure defaults to '-O2 -g' and some tests expect it # accordingly. - append-flags -g + GCC_TESTS_CFLAGS+=" -g" # TODO: Does this handle s390 (-m31) correctly? # TODO: What if there are multiple ABIs like x32 too? @@ -1975,26 +1969,29 @@ toolchain_src_test() { # # CFLAGS and so on are repeated here because of tests vs building test # deps like libbacktrace. + # + # TODO: Should we try pass in the regular user flags for the non-RUNTESTFLAGS + # instances below for building e.g. libbacktrace? nonfatal emake -C "${WORKDIR}"/build -k "${GCC_TESTS_CHECK_TARGET}" \ RUNTESTFLAGS=" \ ${GCC_TESTS_RUNTESTFLAGS} \ - CFLAGS_FOR_TARGET='${CFLAGS_FOR_TARGET:-${CFLAGS}}' \ - CXXFLAGS_FOR_TARGET='${CXXFLAGS_FOR_TARGET:-${CXXFLAGS}}' \ - LDFLAGS_FOR_TARGET='${LDFLAGS_FOR_TARGET:-${LDFLAGS}}' \ - CFLAGS='${CFLAGS}' \ - CXXFLAGS='${CXXFLAGS}' \ - FCFLAGS='${FCFLAGS}' \ - FFLAGS='${FFLAGS}' \ - LDFLAGS='${LDFLAGS}' \ + CFLAGS_FOR_TARGET='${GCC_TESTS_CFLAGS_FOR_TARGET:-${GCC_TESTS_CFLAGS}}' \ + CXXFLAGS_FOR_TARGET='${GCC_TESTS_CXXFLAGS_FOR_TARGET:-${GCC_TESTS_CXXFLAGS}}' \ + LDFLAGS_FOR_TARGET='${TEST_LDFLAGS_FOR_TARGET:-${GCC_TESTS_LDFLAGS}}' \ + CFLAGS='${GCC_TESTS_CFLAGS}' \ + CXXFLAGS='${GCC_TESTS_CXXFLAGS}' \ + FCFLAGS='${GCC_TESTS_FCFLAGS}' \ + FFLAGS='${GCC_TESTS_FFLAGS}' \ + LDFLAGS='${GCC_TESTS_LDFLAGS}' \ " \ - CFLAGS_FOR_TARGET="${CFLAGS_FOR_TARGET:-${CFLAGS}}" \ - CXXFLAGS_FOR_TARGET="${CXXFLAGS_FOR_TARGET:-${CXXFLAGS}}" \ - LDFLAGS_FOR_TARGET="${LDFLAGS_FOR_TARGET:-${LDFLAGS}}" \ - CFLAGS="${CFLAGS}" \ - CXXFLAGS="${CXXFLAGS}" \ - FCFLAGS="${FCFLAGS}" \ - FFLAGS="${FFLAGS}" \ - LDFLAGS="${LDFLAGS}" + CFLAGS_FOR_TARGET="${GCC_TESTS_CFLAGS_FOR_TARGET:-${GCC_TESTS_CFLAGS}}" \ + CXXFLAGS_FOR_TARGET="${GCC_TESTS_CXXFLAGS_FOR_TARGET:-${GCC_TESTS_CXXFLAGS}}" \ + LDFLAGS_FOR_TARGET="${GCC_TESTS_LDFLAGS_FOR_TARGET:-${GCC_TESTS_LDFLAGS}}" \ + CFLAGS="${GCC_TESTS_CFLAGS}" \ + CXXFLAGS="${GCC_TESTS_CXXFLAGS}" \ + FCFLAGS="${GCC_TESTS_FCFLAGS}" \ + FFLAGS="${GCC_TESTS_FFLAGS}" \ + LDFLAGS="${GCC_TESTS_LDFLAGS}" ) # Produce an updated failure manifest. @@ -2049,7 +2046,7 @@ toolchain_src_test() { eerror "GCC_TESTS_IGNORE_NO_BASELINE is set, ignoring test result and creating a new baseline..." elif [[ -n ${GCC_TESTS_REGEN_BASELINE} ]] ; then eerror "GCC_TESTS_REGEN_BASELINE is set, ignoring test result and creating using a new baseline..." - elif [[ ${ret} != 0 ]]; then + elif [[ ${ret} != 0 ]] ; then eerror "(Set GCC_TESTS_IGNORE_NO_BASELINE=1 to make this non-fatal and generate a baseline.)" die "Tests failed (failures occurred with no reference data)" fi |