commit: e6a69ea10ed74a0ce49e979bbc4bbce139949259 Author: Sam James <sam <AT> gentoo <DOT> org> AuthorDate: Tue Oct 1 01:02:17 2024 +0000 Commit: Sam James <sam <AT> gentoo <DOT> org> CommitDate: Tue Oct 1 01:10:28 2024 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e6a69ea1
toolchain.eclass: support dev-lang/ada-bootstrap Bug: https://bugs.gentoo.org/547358 Bug: https://bugs.gentoo.org/919667 Bug: https://bugs.gentoo.org/940472 Closes: https://bugs.gentoo.org/940471 Signed-off-by: Sam James <sam <AT> gentoo.org> eclass/toolchain.eclass | 42 +++++++++++++++++++++++++++++++++--------- 1 file changed, 33 insertions(+), 9 deletions(-) diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass index 939c68113188..648e67b9493b 100644 --- a/eclass/toolchain.eclass +++ b/eclass/toolchain.eclass @@ -402,7 +402,16 @@ if tc_has_feature valgrind ; then fi if [[ ${PN} != gnat-gpl ]] && tc_has_feature ada ; then - BDEPEND+=" ada? ( || ( sys-devel/gcc:${SLOT}[ada] <sys-devel/gcc-${SLOT}[ada] dev-lang/gnat-gpl[ada] ) )" + BDEPEND+=" + ada? ( + || ( + sys-devel/gcc:${SLOT}[ada] + <sys-devel/gcc-${SLOT}[ada] + <dev-lang/ada-bootstrap-${SLOT} + dev-lang/gnat-gpl[ada] + ) + ) + " fi # TODO: Add a pkg_setup & pkg_pretend check for whether the active compiler @@ -850,10 +859,28 @@ toolchain_setup_ada() { eend 1 done - # As a last resort, use dev-lang/gnat-gpl. - # TODO: Make gnat-gpl coinstallable with gcc:10 (bug #940471). + # As a penultimate resort, try dev-lang/ada-bootstrap. + if ver_test ${ada_bootstrap} -gt ${PV} || [[ -z ${ada_bootstrap} ]] ; then + ebegin "Testing fallback dev-lang/ada-bootstrap for Ada" + if has_version -b "<dev-lang/ada-bootstrap-${SLOT}" ; then + local latest_ada_bootstrap=$(best_version -b "<dev-lang/ada-bootstrap-${SLOT}") + latest_ada_bootstrap="${latest_ada_bootstrap#dev-lang/ada-bootstrap-}" + latest_ada_bootstrap=$(ver_cut 1 ${latest_ada_bootstrap}) + ada_bootstrap=${latest_ada_bootstrap} + + # TODO: Figure out ada-bootstrap versioning/slots + export PATH="${BROOT}/usr/lib/ada-bootstrap/bin:${PATH}" + + eend 0 + break + else + eend 1 + fi + fi + + # As a last resort, try dev-lang/gnat-gpl. if ver_test ${ada_bootstrap} -gt ${PV} || [[ -z ${ada_bootstrap} ]] ; then - ebegin "Testing dev-lang/gnat-gpl for Ada" + ebegin "Testing fallback dev-lang/gnat-gpl for Ada" if has_version -b "dev-lang/gnat-gpl" ; then ada_bootstrap=10 eend 0 @@ -866,12 +893,9 @@ toolchain_setup_ada() { # TODO: Source a newer, or build our own, bootstrap tarball (bug #940472). if [[ -z ${ada_bootstrap} ]] ; then eerror "Couldn't find a suitable GNAT compiler for Ada!" - eerror "Please try installing dev-lang/gnat-gpl." + eerror "Please try installing dev-lang/ada-bootstrap or failing that, dev-lang/gnat-gpl." eerror "For other platforms, you may need to use crossdev." - die "Fallback ada-bootstrap path not yet implemented!" - - #einfo "Using bootstrap GNAT compiler..." - #export PATH="${BROOT}/opt/ada-bootstrap-${GCCMAJOR}/bin:${PATH}" + die "Couldn't find an Ada bootstrap compiler!" fi cat <<-"EOF" > "${T}"/ada.spec || die
