• [gentoo-dev] Subject: [PATCH] toolchain-func.eclass: ada related change

    From Alfredo Tupone@21:1/5 to All on Fri Mar 22 19:20:01 2024
    inject ada in TC_FEATURES so the check on 'tc_has_feature ada' works.

    Check that when building ada we do not use a newer compiler to build it. Probably there is a better sed to check the selected compiler.
    I take the first number that is in the gnatmake -v string, and if
    present, the ada compiler is available and that is the slot. dev-lang/gnat-gpl-2021 return 2021 and that is slot 10.

    Please review




    Signed-off-by: Alfredo Tupone <tupone@gentoo.org>
    ---
    eclass/toolchain.eclass | 16 ++++++++++++++--
    1 file changed, 14 insertions(+), 2 deletions(-)

    diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass
    index e962c8181693..c58837bef811 100644
    --- a/eclass/toolchain.eclass
    +++ b/eclass/toolchain.eclass
    @@ -243,38 +243,38 @@ if [[ ${PN} != kgcc64 && ${PN} != gcc-* ]] ; then
    IUSE+=" objc-gc" TC_FEATURES+=( objc-gc )
    IUSE+=" libssp objc++"

    # Stop forcing openmp on by default in the eclass. Gradually phase it out.
    # See bug #890999.
    if tc_version_is_at_least 13.0.0_pre20221218 ; then
    IUSE+=" openmp"
    else
    IUSE+=" +openmp"
    fi

    IUSE+=" fixed-point"
    IUSE+=" go"
    IUSE+=" +sanitize" TC_FEATURES+=( sanitize )
    IUSE+=" graphite" TC_FEATURES+=( graphite )
    - IUSE+=" ada"
    IUSE+=" vtv"
    IUSE+=" jit"
    IUSE+=" +pie +ssp pch"

    IUSE+=" systemtap" TC_FEATURES+=( systemtap )

    tc_version_is_at_least 9.0 && IUSE+=" d" TC_FEATURES+=( d )
    + tc_version_is_at_least 9.0 && IUSE+=" ada" TC_FEATURES+=( ada )
  • From Alfredo Tupone@21:1/5 to All on Mon Mar 25 20:30:03 2024
    I think the following should deserve attention:

    + prevAdaSLOT=$(gnatmake -v 2>&1 | sed -n '2 p' | sed 's:^[^0-9]*\([0-9]\+\).*:\1:' | sed 's:2021:10:' )

    maybe there is a way to not use sed at all, or at least to not call it three times

    + die 'Ada cannot be built with a newer compiler'

    Is this good in a pkg_pretend ? All the time I tested gcc[ada] did not build with a new compiler

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Sam James@21:1/5 to Alfredo Tupone on Thu Apr 25 14:10:01 2024
    Alfredo Tupone <tupone@gentoo.org> writes:

    Having received no comments, I would like to add this changes to toolchain.eclass

    This is less intrusive.

    The compiler check that was in place in the original email maybe is distruptive. It was checking that the used compiler is ada and version
    is less or equal.

    I saw that some gcc versions can be build with a newer compiler. IIRC
    gcc-13 can build gcc-12 but gcc-11 cannot be built with gcc-12



    I don't really get the point in this change, though, if it's purely
    the diff quoted below. I don't see a commit message either.

    Please send another version with `git-send-email` with a full commit
    message to explain what you're doing here and why?

    (added missing toolchain@ CC too)

    diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass
    index a5d4345e7fbf..23c57353d702 100644
    --- a/eclass/toolchain.eclass
    +++ b/eclass/toolchain.eclass
    @@ -288,38 +288,38 @@ if [[ ${PN} != kgcc64 && ${PN} != gcc-* ]] ; then
    IUSE+=" objc-gc" TC_FEATURES+=( objc-gc )
    IUSE+=" libssp objc++"

    # Stop forcing openmp on by default in the eclass. Gradually phase it out.
    # See bug #890999.
    if tc_version_is_at_least 13.0.0_pre20221218 ; then
    IUSE+=" openmp"
    else
    IUSE+=" +openmp"
    fi

    IUSE+=" fixed-point"
    IUSE+=" go"
    IUSE+=" +sanitize" TC_FEATURES+=( sanitize )
    IUSE+=" graphite" TC_FEATURES+=( graphite )
    - IUSE+=" ada"
    IUSE+=" vtv"
    IUSE+=" jit"
    IUSE+=" +pie +ssp pch"

    IUSE+=" systemtap" TC_FEATURES+=( systemtap )

    tc_version_is_at_least 9.0 && IUSE+=" d" TC_FEATURES+=( d )
    + tc_version_is_at_least 9.0 && IUSE+=" ada" TC_FEATURES+=( ada )
    tc_version_is_at_least 9.1 && IUSE+=" lto"
    tc_version_is_at_least 10 && IUSE+=" cet"
    tc_version_is_at_least 10 && IUSE+=" zstd" TC_FEATURES+=( zstd )
    tc_version_is_at_least 11 && IUSE+=" valgrind" TC_FEATURES+=( valgrind )
    tc_version_is_at_least 11 && IUSE+=" custom-cflags"
    tc_version_is_at_least 12 && IUSE+=" ieee-long-double"
    tc_version_is_at_least 12.2.1_p20221203 ${PV} && IUSE+=" default-znow"
    tc_version_is_at_least 12.2.1_p20221203 ${PV} && IUSE+=" default-stack-clash-protection"
    tc_version_is_at_least 13.0.0_pre20221218 ${PV} && IUSE+=" modula2"
    # See https://gcc.gnu.org/pipermail/gcc-patches/2023-April/615944.html
    # and https://rust-gcc.github.io/2023/04/24/gccrs-and-gcc13-release.html for why
    # it was disabled in 13.
    tc_version_is_at_least 14.0.0_pre20230423 ${PV} && IUSE+=" rust"
    fi

    @@ -2495,31 +2495,31 @@ should_we_gcc_config() {
    #
    # Also add a hook so special ebuilds (kgcc64) can control which languages
    # exactly get enabled
    gcc-lang-supported() {
    grep ^language=\"${1}\" "${S}"/gcc/*/config-lang.in > /dev/null || return 1
    [[ -z ${TOOLCHAIN_ALLOWED_LANGS} ]] && return 0
    has $1 ${TOOLCHAIN_ALLOWED_LANGS}
    }

    _tc_use_if_iuse() {
    in_iuse $1 && use $1
    }

    is_ada() {
    gcc-lang-supported ada || return 1
    - _tc_use_if_iuse ada
    + _tc_use_if_iuse cxx && _tc_use_if_iuse ada
    }

    is_cxx() {
    gcc-lang-supported 'c++' || return 1
    _tc_use_if_iuse cxx
    }

    is_d() {
    gcc-lang-supported d || return 1
    _tc_use_if_iuse d
    }

    is_f77() {
    gcc-lang-supported f77 || return 1
    _tc_use_if_iuse fortran

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Alfredo Tupone@21:1/5 to All on Thu Apr 25 13:20:02 2024
    Having received no comments, I would like to add this changes to toolchain.eclass

    This is less intrusive.

    The compiler check that was in place in the original email maybe is distruptive. It was checking that the used compiler is ada and version
    is less or equal.

    I saw that some gcc versions can be build with a newer compiler. IIRC
    gcc-13 can build gcc-12 but gcc-11 cannot be built with gcc-12


    diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass
    index a5d4345e7fbf..23c57353d702 100644
    --- a/eclass/toolchain.eclass
    +++ b/eclass/toolchain.eclass
    @@ -288,38 +288,38 @@ if [[ ${PN} != kgcc64 && ${PN} != gcc-* ]] ; then
    IUSE+=" objc-gc" TC_FEATURES+=( objc-gc )
    IUSE+=" libssp objc++"

    # Stop forcing openmp on by default in the eclass. Gradually phase it out.
    # See bug #890999.
    if tc_version_is_at_least 13.0.0_pre20221218 ; then
    IUSE+=" openmp"
    else
    IUSE+=" +openmp"
    fi

    IUSE+=" fixed-point"
    IUSE+=" go"
    IUSE+=" +sanitize" TC_FEATURES+=( sanitize )
    IUSE+=" graphite" TC_FEATURES+=( graphite )
    - IUSE+=" ada"
    IUSE+=" vtv"
    IUSE+=" jit"
    IUSE+=" +pie +ssp pch"

    IUSE+=" systemtap" TC_FEATURES+=( systemtap )

    tc_version_is_at_least 9.0 && IUSE+=" d" TC_FEATURES+=( d )
    + tc_version_is_at_least 9.0 && IUSE+=" ada" TC_FEATURES+=( ada )
    tc_version_is_at_least 9.1 && IUSE+=" lto"
    tc_version_is_at_least 10 && IUSE+=" cet"
    tc_version_is_at_least 10 && IUSE+=" zstd" TC_FEATURES+=( zstd )
    tc_version_is_at_least 11 && IUSE+=" valgrind" TC_F