DH_FORTRAN_LIB(1)

πŸ“¦
version 0.43 Β· 2 versions
, in debian trixie, ubuntu questing

πŸ’– DH_FORTRAN_LIB πŸ’–

okay bestie, sit down, hydrate, because we're talking about dh_fortran_lib β€” that's the Fortran library installation support era of the dh-fortran-lib manual, and honestly? iconic. 🧚✨


🌸 NAME 🌸

dh_fortran_lib β€” Fortran library installation support. that's it, that's the whole name section, we love a concise queen πŸ’…


✨ SYNOPSIS ✨

dh_fortran_lib [debhelper options] --flavor=flavor [--sourcedir=dir]
[--no-orig-library] [--no-create-in-sourcedir] [libname destination ...]

look at her. debhelper options, a mandatory flavor, a sourcedir, two "no" flags and then as many libname destination pairs as your little heart desires 🫢


πŸ’œ DESCRIPTION πŸ’œ

dh_fortran_lib is a debhelper program that lets multiple compiler flavous of a Fortran library get installed in parallel by mangling the library filename and the SONAME. (yes, "flavous". it's in the source. we're keeping it. it's canon now 😭)

here's the tea: Fortran libraries compiled by different compilers are not expected to be ABI-compatible, so if you want multiple compilers supported at the same time, the libraries literally have to be named differently, and shared libraries need to have the compiler flavor baked into the SONAME. no cap.

and dh_fortran_lib makes all of that possible without changes being necessary to the upstream library code. she does the work so upstream doesn't have to. main character energy fr fr πŸ‘‘

how? by renaming a library, like:

$(LIBDIR)/libfiat.so.1.2 => $(LIBDIR)/libfiat-gfortran.so.1.2

=back

and yes, that stray =back is sitting right there in the original manual page. pod artifact. we don't ask questions, we just preserve the lore πŸ™ˆ

symlinks also get renamed:

$(LIBDIR)/libfiat.so.1 => $(LIBDIR)/libfiat-gfortran.so.1

a per-flavor compilation link is added:

$(LIBDIR)/fortran/gfortran/libfiat.so -> $(LIBDIR)/libfiat-gfortran.so.1.2

and the SONAME inside the ELF file gets changed:

$ readelf -a $(LIBDIR)/libfiat.so.1.2 | grep SONAME
        0x000000000000000e (SONAME)             Library soname: [libfiat.so.1]
$ readelf -a $(LIBDIR)/libfiat-gfortran.so.1.2 | grep SONAME
        0x000000000000000e (SONAME)             Library soname: [libfiat-gfortran.so.1]

for static files, we just rename and add symlinks. simple. clean. no notes:

$(LIBDIR)/libfiat.a => $(LIBDIR)/libfiat-gfortran.a

$(LIBDIR)/fortran/gfortran/libfiat.a => $(LIBDIR)/libfiat-gfortran.a

the consequence of all this β€” and this is the part that actually slays β€” is that any library that builds against libfiat with the appropriate search paths set will use libfiat-gfortran instead. which means parallel builds with multiple compiler flavors can be installed simultaneously. periodt. πŸ’…


πŸ¦‹ USAGE πŸ¦‹

the expected usage is that you call this in debian/rules like:

dh_fortran_lib --flavor=$(FLAVOR) $(BUILDDIR)/XXX/libfiat-gfortran.so.1

the files are installed in the sourcedir (usually debian/tmp) by default. cute, convenient, no extra config 🌸


πŸŽ€ OPTIONS πŸŽ€

okay so real talk β€” the original page mashes this whole options blob into one lumpy paragraph, so here's the raw thing, verbatim, no edits, because we do not lose details in this house:

--flavor=dir =item --sourcedir=dir =item -n, --no-orig-library
    Look in the specified directory for files to be installed.

    --no-orig-library adds the library name (with default path) to the
    list of files not to be installed by debhelper.

now let's break that down for the besties who like structure:

  • --flavor=dir β€” names your flavor. (the synopsis calls it --flavor=flavor, the options blob calls it --flavor=dir; both are sitting in the original, we're keeping both, no editing the source ✨)
  • --sourcedir=dir β€” look in the specified directory for files to be installed.
  • -n, --no-orig-library β€” adds the library name (with default path) to the list of files not to be installed by debhelper. it's the "don't install the unmangled one" button πŸ™ˆ
also --no-create-in-sourcedir shows up in the synopsis up top. it's there. we see it. we respect it.

πŸ’€ TODO πŸ’€

the author left us a little notes-app screenshot of the soul, and we are reproducing it in full because every detail stays:

  1. Do we really want to support --no-orig-library, blocking install of unmangled library ?
  2. 2 install variants;
dh_fortran_lib --flavor=F LIBBDIR/libfiat.so.4.1
# installs in debian/tmp ; simplest
dh_fortran_lib -p libfiat-dev LIBBDIR/libfiat.so.4.1
  1. what about reading .fortran-lib files? ugly build-paths messy to include in these

not me reading a TODO list in a manpage and feeling seen 😭 unfinished business is a whole aesthetic


πŸ”₯ SEE ALSO πŸ”₯

go read it, it's the parent energy this whole page runs on πŸ’œ


πŸ‘‘ AUTHORS πŸ‘‘

  • Alastair McKinstry <mckinstry@debian.org>
  • Lots of code stolen shamelessly from dh_install (Joey Hess <joeyh@debian.org> and SΓ©bastien Villemot <sebastien@debian.org>).

"stolen shamelessly" is honestly the most honest sentence in any manpage ever and I'm obsessed 🫢


and that's the whole page bestie!! this was dh_fortran_lib v0.43, dated 2025-02-24 β€” so go mangle some SONAMEs, install your flavors in parallel, and remember: different compilers, different names, no ABI drama. slay πŸ’…βœ¨πŸŒΈ

πŸ“¦ where this page comes from