I have been supporting an overlay with changes to the toolchain.eclass to enable Ada in sys-devel/gcc. I have sent mails to the dev-ml, this contains all the information required with links to the overlay and other information. What will need to be done is to remove the ADA_TARGET variable, the existing dev-lang/gnat-gpl package in favour of prebuilt bootstraps. Reproducible: Always
Created attachment 878599 [details, diff] Patch to add Ada support with bootstrap ebuilds.
Can probably close this old one https://bugs.gentoo.org/547358
i've recently started learning Ada, and have been trying to wrap my head around the current state of the Ada ecosystem in general, together with the current state of Ada on Gentoo in particular. i've created the Ada page on the wiki: https://wiki.gentoo.org/wiki/Ada to try to document what i've discovered/learned so far. This bug was brought to my attention by a post on forum.ada-lang.io: https://forum.ada-lang.io/t/getting-emacs-ada-mode-working/708/7 When first trying to set up Ada on Gentoo, as a newbie to Ada, i had no idea that gnat-gpl is deprecated upstream, nor that i couldn't simply enable the 'ada' USE flag on sys-devel/gcc to have an Ada compiler on my system. Consequently, this patch seems like a good idea to me. And i'd be happy to update the wiki page accordingly.
I tried the gentoo way, using gnat-gpl last night, it installs gnat-10 and the ebuild can't see it. So, there it is, offically no Ada.
No, I bootstrapped it fine like 5 days ago while working on this bug.
To use the gnat compiler to build the new compiler one needs to gcc-config it before.
Ok, it does work. I'm building gcc:13 again now, after it wanted gcc:11. Anyway, I've already posted this before, but here's my bootstrap build script: https://github.com/Lucretia/ada-overlay/blob/master/scripts/build-bootstrap.sh
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=799693623d76c89e8b04d2434d0dfece44bb49f9 commit 799693623d76c89e8b04d2434d0dfece44bb49f9 Author: Sam James <sam@gentoo.org> AuthorDate: 2024-08-03 02:27:51 +0000 Commit: Sam James <sam@gentoo.org> CommitDate: 2024-09-29 00:18:08 +0000 toolchain.eclass: Ada rework Look hard for an existing GNAT for use for bootstrapping without requiring users to run `gcc-config` / switch their system copy of GCC, which is both brittle in that it requires manual intervention, and also unclean. Started looking at this after https://public-inbox.gentoo.org/gentoo-dev/2a700166-f01a-4807-bd76-7b0cce72af0b@archeia.com/ although the approach is different. I did use it as a base although not much of it remains. We take the following approach: * Iterate over installed GCC slots (preferring ${SLOT}, then iterating from the latest version installed down to GCC 10) to find a copy of GNAT; * Create wrappers for gnat* to redirect calls when building GCC to our found bootstrap copy of GNAT; * Use an extracted spec file to redirect gnat1 calls to that bootstrap copy too, as the build system doesn't allow saying "just use this copy of gnat" (it always wants $(CC) to support it). The real nasty part here is that GCC's build system doesn't seem to have a way to point to 'ADACC' or similar (it looks like it did have 'ADAC' years ago). Remaining bits to be done: * Adapting/replacing/supplementing dev-lang/gnat-gpl with a version that can be installed in parallel to sys-devel/gcc:10 so it can be pulled in transparently for bootstrapping; * Build our own, or source some other copy (e.g. from Alire), of a newer bootstrap GNAT. https://github.com/alire-project/GNAT-FSF-builds is a likely candidate. I also hope that we can ultimately do the same for D. Bug: https://gcc.gnu.org/PR864 Bug: https://gcc.gnu.org/PR108909 Bug: https://bugs.gentoo.org/137268 Bug: https://bugs.gentoo.org/547358 Bug: https://bugs.gentoo.org/919667 Closes: https://bugs.gentoo.org/937774 Link: https://lists.fedorahosted.org/archives/list/epel-devel@lists.fedoraproject.org/thread/CVQ3JIOZI5ODYDZU2DZLA37JWSLMCIN7/ Signed-off-by: Sam James <sam@gentoo.org> eclass/toolchain.eclass | 143 +++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 141 insertions(+), 2 deletions(-) https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f210bb3d7324b1a6c1fe9d5e98cdfd57241d6499 commit f210bb3d7324b1a6c1fe9d5e98cdfd57241d6499 Author: Sam James <sam@gentoo.org> AuthorDate: 2024-09-28 23:00:54 +0000 Commit: Sam James <sam@gentoo.org> CommitDate: 2024-09-29 00:15:58 +0000 dev-lang/gnat-gpl: rename USE=bootstrap -> USE=system-bootstrap, invert meaning USE=bootstrap has/had a special meaning in <EAPI 5 and it also ends up stable-masked apparently too. It was dropped from use.desc in af748c0468c6ab3ce760de2bfd84f4cef1eb9bcf and dropped from sys-devel/gcc a while ago too (bug #440224). To facilitate automatically using gnat-gpl in sys-devel/gcc, do two things: * Rename USE=bootstrap -> USE=system-bootstrap * Make USE=system-bootstrap mean "I need a working Ada compiler to build this" (i.e. invert its meaning) to match dev-java/openjdk and dev-lang/rust. Bug: https://bugs.gentoo.org/137268 Bug: https://bugs.gentoo.org/440224 Bug: https://bugs.gentoo.org/547358 Bug: https://bugs.gentoo.org/919667 Signed-off-by: Sam James <sam@gentoo.org> dev-lang/gnat-gpl/gnat-gpl-2021-r5.ebuild | 12 ++++++------ dev-lang/gnat-gpl/metadata.xml | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-)
I'm going to split the two remaining bits out, actually.
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e6a69ea10ed74a0ce49e979bbc4bbce139949259 commit e6a69ea10ed74a0ce49e979bbc4bbce139949259 Author: Sam James <sam@gentoo.org> AuthorDate: 2024-10-01 01:02:17 +0000 Commit: Sam James <sam@gentoo.org> CommitDate: 2024-10-01 01:10:28 +0000 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@gentoo.org> eclass/toolchain.eclass | 42 +++++++++++++++++++++++++++++++++--------- 1 file changed, 33 insertions(+), 9 deletions(-) https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2fecbe438a39dfc3b226ff2c474c297a0763998f commit 2fecbe438a39dfc3b226ff2c474c297a0763998f Author: Sam James <sam@gentoo.org> AuthorDate: 2024-09-30 20:01:59 +0000 Commit: Sam James <sam@gentoo.org> CommitDate: 2024-10-01 01:10:27 +0000 dev-lang/ada-bootstrap: new package, add 0_p2021 Split dev-lang/gnat-gpl into dev-lang/ada-bootstrap. This ebuild was initially a clone of dev-lang/gnat-gpl-2021-r5 then had some cleanups done, toolchain.eclass use removed, and simplified what it configures/builds/installs. As I mentioned in 799693623d76c89e8b04d2434d0dfece44bb49f9, there were two jobs left -- this fixes the first one: splitting dev-lang/gnat-gpl into its own package which doesn't collide with sys-devel/gcc:10 and also does the least possible work, not with lots of USE, etc.) Some inspiration taken from sys-devel/bpf-toolchain. Considered using the *-toolchain name again but given the purpose of this is *not* just to avoid crossdev use but instead to bootstrap from a binary for Ada, it didn't feel appropriate. (Planned to do this anyway but the issue mentioned in 9732ef3475830dbe289fc80358613e90b612563c pushed me to get on with it now.) Later versions of ada-bootstrap will be our own binaries for both newer GCC as a base (although this is mostly a nice-to-have and to keep things building rather than it being essential, AFAIK) as well as more importantly musl and other arch support. For that future work, see https://bugs.gentoo.org/940471#c1 for a suggestion from Luke A. Guest. That will be tracked in bug #940472. 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@gentoo.org> dev-lang/ada-bootstrap/Manifest | 5 + .../ada-bootstrap/ada-bootstrap-0_p2021.ebuild | 183 +++++++++++++++++++++ .../files/ada-bootstrap-0_p2021-gentoo.patch | 72 ++++++++ .../files/gcc-configure-texinfo.patch | 16 ++ dev-lang/ada-bootstrap/metadata.xml | 7 + 5 files changed, 283 insertions(+)