This document describes the current policies for packaging Ada programs and libraries for Fedora. These are Ada-specific amendments to the generic Packaging Guidelines. Ada packages must also conform to the Packaging Guidelines and the Review Guidelines.
BuildRequires:
gcc-gnat
" to ensure that the compiler is available.There are a number of RPM macros that contain Fedora's standard compiler and linker flags adapted for GNAT. The appropriate macro MUST be used in the build stage. The right macro to use depends on what build tools the package uses.
Gnatmake
or GPRbuild
but without Comfignat
there are the macros %Gnatmake_optflags
and %GPRbuild_optflags
, which contain builder, compiler and linker flags.Gnatmake
or GPRbuild
, then the appropriate macro for each tool MUST be used. If for example Gnatlink is invoked directly, then the expansion of Gnatlink_flags shall be passed to it.For packages whose build systems use Comfignat
there is the macro %Comfignat_make
. It expands to a Make command with appropriate values for Comfignat
's configuration variables, including builder, compiler and linker flags, directory variables and the directories project. Use it alone to build the default target:
%build
%{Comfignatmake}
# If needed, a different target and/or additional variables may be appended:
%{Comfignatmake} demoprograms atomicdoodads=true
For the installation stage of Comfignat-using packages, the macro %make_install
(not %makeinstall
) is recommended.
ExclusiveArch:
%{GNAT_arches}
".BuildRequires:
fedora-gnat-project-common
" to ensure that the necessary RPM macros are defined.Gnatmake and GPRbuild both add a runpath to the built binaries by default. Fedora's builder flags normally include an option to disable the automatic runpath. There are however cases where it would be advantageous to allow a runpath. Libraries can have test suites or auxiliary programs that aren't installed but run during the build and need to link to the library in the build directory, and they may rely on an automatic runpath for this. In those cases the spec file may define a macro named GNAT_add_rpath. The builders will then be allowed to add a runpath in those parts of the spec file where GNAT_add_rpath is defined.
Packages that contain Ada code SHOULD run %{_rpmconfigdir}/check-rpaths
as the last thing in the %check
section. This is a precaution against packaging bugs and toolchain bugs that would cause binaries with runpaths to end up in packages. All packages that use GNAT_add_rpath MUST do this (and must therefore have a %check
section).
Requires:
fedora-gnat-project-common
".Here's an example of what a project file installed with a library may look like:
with "directories";
project Example is
for Library_Name use "example";
for Source_Dirs use (Directories.Includedir & "/example");
for Library_Dir use Directories.Libdir;
for Library_ALI_Dir use Directories.Libdir & "/example";
for Externally_Built use "true";
end Example;
%{_includedir}
directory or a subdirectory thereof. Placing them directly in %{_includedir}
may be appropriate if there are very few of them in the package and their names include the name of the library. Otherwise they should usually be placed in a subdirectory, for example %{_includedir}/%{name}
.%{_libdir}
, for example %{_libdir}/%{name}
.%{_GNAT_project_dir}
directory or a subdirectory thereof. A subdirectory, for example %{_GNAT_project_dir}/%{name}
, may be a good idea if there are lots of project files in the same package or if they have generic names. Otherwise they should usually be placed directly in %{_GNAT_project_dir}
. The name of the library MUST be included either in the name of each project file or in the name of the subdirectory where the project files are placed.Rpmlint is a program that checks packages for common problems. For Ada packages, some of the rpmlint messages, such as "executable-stack", can be disregarded, because GNAT uses trampolines for pointers to nested functions. (See for example this entry in the GCC Bugzilla.)