DOKK / manpages / debian 12 / dh-fortran-mod / dh_fortran_mod.1.en
DH_FORTRAN_MOD(1) dh-fortran-mod DH_FORTRAN_MOD(1)

dh_fortran_mod - Install Fortran 90 .mod files and add dependency information.

dh_fortran_mod [--sourcedir=dir] [$<debhelper options>]

dh_fortran_mod is a debhelper program that finds Fortran module and submodule files and adds dependencies to gfortran-$version as required to the package using via the variable ${misc:Depends}.

dh_fortran_mod is expected to be automatically added using the debhelper "addon" fortran_mod ie. either automatically, by build-depending on 'dh-sequence-fortran-mod', or explicitly:

    dh $@ --with fortran_mod

dh_fortran_modSearches the debian/ directory for files debian/pkg.fortran-mod$ which list module files to include, with the same syntax as debhelper install files.

Look in the specified directory for files to be installed.

Typically Fortran module files are included in library development packages.

dh_fortran_mod will be expanded to find mod files automatically from the debian/tmp directory. It will enable the installation of mod files in parallel for multiple compilers. It will install .smod files for Fortran 2018.

The fortran-mod file syntax follows dh_install: pairs of sources and optional target directories. The default directory will be $fmoddir ( /usr/lib/$multiarch/fortran/$compiler_mod_directory/) If the target directory is absolute (starts with a '/'), this directory is used in the target package. If the target does not absolute, it will be treated as a subdirectory of $fmoddir.

$compiler_mod_directory is based on the compiler module version: currently gfortran-mod-15 for gfortran-12, and flang-mod-34 for flang-7. These will be updated for incompatible compiler versions. There is a symlink in $libdir/fortran/ for the 'canonical' compiler name, linking to this, e.g.
/usr/lib/$multiarch/fortran/x86_64-linux-gnu-gfortran-9 -> gfortran-mod-15 This enables makefile fragments to construct $fmoddir as required from :

  FC:=$(shell basename $(shell readlink -f /usr/bin/gfortran))
  FMODDIR:=/usr/lib/$(shell dpkg-architecture -qDEB_HOST_MULTIARCH)/fortran/$(FC)

Its not clear what happens on module version changes in Flang/F18. While the version number signifies format changes, it appears the design is currently to be backward compatible and read previous versions. Hence symlinks for flang handling may be required; however a new f18 front-end is being developed, so this may change.

debhelper(7)

Sebastien Villemot <sebastien@debian.org> Alastair McKinstry <mckinstry@debian.org>

Lots of code stolen shamelessly from dh_install (Joey Hess <joeyh@debian.org>).

2022-09-12 dh-fortran-mod v0.27