Project:Ada

From Gentoo Wiki
Jump to: navigation, search
Gentoo Resources for Ada
Description This project provides support for Ada compilers and libraries in Portage. At present a gnat compiler is provided: gnat-gpl by AdaCore.
Email ada@gentoo.org
Lead(s) none
No lead election date set
Members
Subprojects
(and inherited members)
(none)
Parent Project Gentoo Linux
Project listing

Aim of the project

The project maintain the compiler, builder, system library and IDE for ada. The reference sources are the one present in the libre.adacore.com site, maintained by AdaCore.

Current packages

At present

packages are part of the project.

  • dev-lang/gnat-gpl-2016 conflict with the sys-devel/gcc-4.9.4 compiler.
  • dev-lang/gnat-gpl-2017 conflict with the sys-devel/gcc-6.3.0 compiler.

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

Configuration

You need to indicate the

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

Those should be set in the file etc/portage/make.conf

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

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

Starting from 2017 version you should also set one of the two use flags:

  • gnat_2016 to select dev-lang/gnat-gpl-2016
  • gnat_2017 to select dev-lang/gnat-gpl-2017

to build these two packages.

Only one of these two flags should be enabled, and preferably the setting should be done at global level on make.conf

The choice should be inline with the set of the ADA variable

Build instructions

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 have an ada compiler available you must set the bootstrap use flags. In this case the compiler used will be gnat-gpl-2014-x86_64-linux-bin.tar.gz from libre.adacore.com.

root # USE=bootstrap emerge dev-lang/gnat-gpl

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-4.9.4

Similar to the compiler, for gprbuild you need to set the "bootstrap" flag and unset the "shared" flag initially for the first build, then rebuild them in order to be able to use them as shared libs, like this:

root # USE="bootstrap -shared" emerge dev-ada/gprbuild
root #emerge --ask dev-ada/gprbuild

as dev-ada/gprbuild needs dev-ada/xmlada and dev-ada/xmlada needs dev-ada/gprbuild; the bootstrap flag breaks the loop.

Compiler upgrade

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=x86_64-pc-linux-gnu-gcc-6.3.0

change the use flag setting, enabling gnat_2017 and disabling gnat_2016 and then rebuild all ada packages starting from dev-ada/gprbuild with the bootstrap use flags