Project:Ada

From Gentoo Wiki
Jump to:navigation Jump to:search
Ada Project
Description This project provides support for Ada compilers and libraries in Portage. At present both a gnat compiler (gnat-gpl by AdaCore) and gcc (by FSF) are provided.
Project email ada@gentoo.org
Packages p.g.o/ada@gentoo.org


IRC channel #ada (webchat)
Lead(s)
Last elected: 2019-04-17
Member(s)
Subproject(s)
(and inherited member(s))
(none)
Parent Project Gentoo
Project listing

Aim of the project

The project maintains the compiler, builder, system library and IDE for ada.

The spark language, based on ada and aimed at safety and security, is also supported.

The reference sources are present at https://www.adacore.com/download/more, maintained by AdaCore.

We also hope to integrate gnat-gcc with the standard toolchain packages starting with 6.x/7.x, with new arches added as new bootstraps become available (see the ada-overlay on github for the current packages/eclass).

Current packages

At present

packages are part of the project.

Compilers

dev-lang/gnat-gpl

Compiler is available for both x86 32 and 64 bits

  • dev-lang/gnat-gpl-2021 slotted 10

Each dev-lang/gnat-gpl compiler conflict with the sys-devel/gcc on the same slot.

dev-lang/gnat-gpl share in fact most of the sources and the binaries with gcc.

To build the compiler unfortunately you need an ada/c/c++ compiler already available, to produce an ada/c/c++ compiler.

If you don't mess with the bootstrap use flag, the Ada compiler will be built using the gnat-gpl-2014-*-linux-bin.tar.gz from libre.adacore.com.

When you disable the bootstrap use flag, the build compiler will be using the information set in the file etc/portage/make.conf

FILE /etc/portage/make.confADA setting
ADA=x86_64-pc-linux-gnu-gcc-9.3.1
ADAFLAGS=${CFLAGS}
FEATURES="nostrip"

This will indicate the

  • the ADA compiler used to build the Ada compiler (if available)
  • the ADA compiler FLAGS, used to build Ada packages
  • optionally the nostrip features (or splitdebug) to retains symbol in the gnat runtime (e.g. catch exception with debugger)

The ADA variable is the name of the gcc compiler that can compile ada files and that will be used to build the ada compiler. Is not used for anything else. If you do not specify the ADA variable, the system gcc compiler will be used instead, if capable.

Once installed you can use the compiler either

  • by selecting it with gcc-config. In this case you also change the default c/c++ compiler (and this is not supported to upgrade gentoo)
  • by postfixing any ada command with its own version: eg. gnatmake-8.3.1

sys-devel/gcc

It is possible to add to sys-devel/gcc the ada language capability.

These are the step you need to follow:

  1. enable the ada use flag for sys-devel/gcc
  2. select a gcc compiler that is already built with ada support (using gcc-config). dev-lang/gnat-gpl can be used for that
  3. emerge sys-devel/gcc
  4. select the new generated gcc compiler (gcc-config)

You should have now the ada compiler ready to use.

Note: always use an older compiler to build gcc: e.g. compiling gcc-11 using gcc-12 is not supported

Building the dev-ada packages

When building the ada related packages, you need to indicate which version of compilers to use by setting the ADA_TARGET variable in the file etc/portage/make.conf

FILE /etc/portage/make.confADA setting
ADA_TARGET="gnat_2021"

The value used are

  • gnat_2021 to select dev-lang/gnat-gpl-2021
  • gcc_12 to select sys-devel/gcc-12
  • gcc_13 to select sys-devel/gcc-13

Switching to github release

Slowly we are switching to github release.

e.g. last release of dev-ada/gprbuild is from github and is versioned 22.0.0

To use these release you should mask the github switched package for all the annual based version:

FILE /etc/portage/package.maskADA setting
>=dev-ada/gprbuild-2000

Compiler changes

When you want to use a new ada compiler you need to change the make.conf to reflect this choice

FILE /etc/portage/make.confADA setting
ADA_TARGET="gnat_2021"

i.e. enabling gnat_2021 and then rebuild all ada packages