Fortran-paketoinnin ohjeet

Moduulit ja sisällytystiedostot

Fortranin moduulitiedostot, jotka päättyvät .mod-tiedostoihin, ovat tiedostoja, jotka kuvaavat Fortran 90:n (ja uudempien) moduuli-API:a ja ABI:a. Nämä eivät ole samanlaisia kuin C:n otsikkotiedostot, jotka kuvaavat API:a, vaan ne ovat kääntäjästä ja arkkitehtuurista riippuvaisia, eivätkä ihmiset pysty niitä helposti lukemaan. gfortran etsii niitä kuitenkin included-hakemistoista (hakemistoista, jotka on määritetty -I-merkillä).

Due to the ABI specificity, the module directory used must be architecture specific. In addition each gfortran release (e.g. from 4.4 to 4.5) may lead to an incompatible change in the .mod files, therefore mass rebuilds of Fortran packages must take place when gfortran is updated.

Fortran can also use include files, similar to C headers. Common used filename suffixes are '.inc' and '.h', although '.fh' has been used for files that are designed to function as public headers.

Packaging of Fortran programs

Fortran programs in Fedora MUST be compiled, if possible, using the default Fortran compiler in Fedora, 'gfortran'. As usual, standard Fedora optimization flags %{optflags} MUST be used in the compilation.

Fortran include files MUST be placed in the standard include directory: either directly in %{_includedir}, or if headers have general names or upstream recommends having an own directory, in e.g. %{_includedir}/%{name}.

As Fortran modules are architecture and GCC version specific, they MUST be placed into %{_fmoddir} (or its package-specific subfolder in case the modules have generic names), which is owned by 'gcc-gfortran'. For directory ownership any packages containing Fortran modules MUST Requires: gcc-gfortran%{_isa}.

To use the modules in the Fortran module directory, one needs to add -I%{_fmoddir} to the compiler flags (this is already included in FFLAGS used by %configure).