.\" English manual page for dh_ada_library .\" .\" Copyright (C) 2012-2022 Nicolas Boulenguez .\" .\" This program is free software: you can redistribute it and/or .\" modify it under the terms of the GNU General Public License as .\" published by the Free Software Foundation, either version 3 of the .\" License, or (at your option) any later version. .\" This program is distributed in the hope that it will be useful, but .\" WITHOUT ANY WARRANTY; without even the implied warranty of .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU .\" General Public License for more details. .\" You should have received a copy of the GNU General Public License .\" along with this program. If not, see . .\" .TH DH_ADA_LIBRARY 1 "2022-08-16" .\"---------------------------------------------------------------------- .SH NAME dh_ada_library \- help packaging Ada libraries for Debian .\"---------------------------------------------------------------------- .SH SYNOPSIS .B dh_ada_library .RI [\| "debhelper options" \|] .\"---------------------------------------------------------------------- .SH DESCRIPTION .B dh_ada_library is a debhelper program that handles some common tasks in packaging libraries written in the Ada programming language. .PP The difficult work is to convince the upstream build system to produce both a static and a relocatable library in a row (during the \fBdh_auto_configure\fR and \fBdh_auto_build\fR steps), then to install these under \fBdebian/tmp\fR with the directory structure described by the Debian Policy for Ada (\fBdh_auto_install\fR). .\" The \fB/usr/share/ada/packaging.mk\fR Makefile snippet, part of the same \fBdh\-ada\-library\fR package, may help for that. .PP Once the files are installed, \fBdh_ada_library\fR is in charge of dispatching them to the specific package temporary directories. .\" It is enabled by the presence of the \fBdh\-sequence\-ada\-library\fR virtual package in the \fBBuild\-Depends\-Arch\fR field of the \fBdebian/control\fR file. .\" For a while, you should in addition depend on the explicit \fBdh\-ada\-library (>= 8.1)\fR, because this version introduces incompatible changes, and virtual packages cannot receive version restrictions. .PP At start, it parses .I debian/control to check that package names exist conforming to the Coexistence Not Allowed naming scheme described in the \fBDebian Policy for Ada\fR and extracts the ALI files version (\fIaliversion\fR)) and the shared library version (\fIsoversion\fR). .\" More accurately, each library needs two packages, \flib\fIname\fB\-\fIALIversion\fB-dev/\fR and \flib\fIname\fB\-\fISOversion\ffR. .\" The dash is required when \fIname\fR ends with a digit, used here for readability, but rare in practice. .\"---------------------------------------------------------------------- .SS Runtime library package The following files are copied from \fBdebian/tmp\fR to \fBdebian/lib\fIname\fB\-\fISOversion\fR. .IP "\fBdebian/tmp/usr/lib/\fIDEB_HOST_MULTIARCH\fB/\fIshared library\fR" The concrete file containing the shared library. .\" This file is found by following the \fBdebian/tmp/usr/lib/\fIDEB_HOST_MULTIARCH\fB/lib\fIname\fB.so\fR symbolic link. .IP \fBdebian/tmp/usr/lib/\fIDEB_HOST_MULTIARCH\fB/\fISOname\fR The shared object name (\fISOname\fR) is extracted from the binary data in the shared library, and may differ from the file name. .\" In that case, both are installed (ldconfig requires the symbolic link, see the Debian Policy for details). .IP \fBdh_link\fR later removes the redundant path components like \fBlib/..\fR. .PP Versions before 8.1 were ignoring the SOname/Library_Version, and guessing it from the SOversion in the Debian package name. .\" Patches caused by this unfortunate decision can now be unapplied. .\"---------------------------------------------------------------------- .SS Development package (\-dev) The following files are copied from \fBdebian/tmp\fR to \fBdebian/lib\fIname\fB\-\fALIversion\fR. .IP \fIali_install_dir\fB/\fIname\fB/\fI*\fB.ali\fR The GNAT Ada Library Information files files created along the objects when building the shared library. .IP \fBdh_fixperms\fR later checks that their permissions are 444. .IP In order to improve build reproducibility, \fI\-f*\-prefix\-map\fR compiler flags are removed from them. .IP \fIada_install_dir\fB/\fIname\fB/\fI*\fR The sources, Ada or not, should all be in a single directory. .IP \fB/usr/lib/\fIDEB_HOST_MULTIARCH\fB/lib\fIname\fB.a\fR The static archive. .IP \fIgpr_install_dir\fB/\fIname\fB.gpr\fR This standalone library GNAT project intended for use after installation. .IP If the library was built with \fBgprbuild\fR and another GNAT project, the \fBgprinstall\fR tool can generate such a standalone project with the correct \fBLanguages\fR, \fBLinker_Switches\fR in the \fBLinker\fR package, imports (\fBwith\fR), source file renamings... .\" Else, the maintainer must write a new project, or more accurately generate it because \fBDEB_HOST_MULTIARCH\fR cannot be hardcoded. .\" If so, it is recommended to also substitute the path variables set by \fB/usr/share/ada/packaging.mk\fR, in case the directory structure ever has to change (again). .IP \fBusr/lib/\fIDEB_HOST_MULTIARCH\fB/lib\fIname\fB.so\fR The development symbolic link is installed here, but dangling because the concrete shared library is in the runtime library package. .IP \fBdh_link\fR later removes the redundant path components like \fBlib/..\fR. .IP \fBada:Depends\fR This debhelper substitution variable is created for inclusion in the \fBDepends\fR field of the \fBlib\fIname\fB-\fIALIversion\fB-dev\fR package in \fBdebian/control\fR. .\" The value means that the development package needs the same version of the runtime library package (because of the dangling symbolic link), and the default Ada compiler. .\" For technical reasons (\fBhttps://bugs.debian.org/bug=975589#24\fR), the compiler version is not described \fBgnat\-\fIV\fR but as \fBgnat (>= \fIV\fB), gnat (<< \fIV+1\fB)\fR. .IP In addition, \fBdh_ada_library\fR searches \fBdebian/tmp/\fIgpr_install_dir\fB/\fIname\fB.gpr\fR for imported projects (\fBwith\fR). .\" For each imported library project recognized, either as built from this source package or installed by one of the \fIBuild\-Depends\fR, a dependency is added into \fIada:Depends\fR. .\" For already processed project within the same source package, the dependency mandates an exact \fIbinary:Version\fR, ensuring that all static libraries are compiled with compatible options. .\" Remaining projects trigger a warning, because the maintainer will need to find the right dependency. .IP Versions before 8.1 were guessing more dependencies from \fBLinker'Linker_Options\fR. .\" This was often wrong, for no benefit since C \-dev packages carry no version and can be hard-coded in \fBdebian/control\fR. .\"---------------------------------------------------------------------- .SS Files that are not installed The following files, if they exist, are ignored but marked as installed by \fBdh_ada_library\fR in order to prevent a false alert by \fBdh_missing\fR later, as if the files were listed in \fBdebian/not\-installed\fR. .\" .IP \fBdebian/tmp/usr/unwantedly_gprinstalled\fR Please refer to \fB/usr/share/ada/packaging.mk\fR. .\" .IP \fBdebian/tmp/usr/lib/\fIDEB_HOST_MULTIARCH\fB/lib\fIname\fB.la The Debian Policy recommends not to install libtool \fB.la\fR files. .\"---------------------------------------------------------------------- .SH REMARKS It would be easy to fix the directory structure, and versions before 8.1 were doing exactly this, at the cost of generating a project with different paths. .\" Now that gprinstall is almost capable of dealing with stagged installs, duplicating its job seems a waste of energy. .PP Both libraries and ALI files are installed into .IR /usr/lib/ DEB_HOST_MULTIARCH , the project and sources into .IR /usr/share/ada/adainclude . .\" This implies that the \-dev package cannot be declared .I Multi-Arch: same as the content of the project (and maybe of generated sources) will vary across architectures. .PP The \fILinker'Linker_Options\fR attribute should rarely be needed. .\" A dependency written in Ada should be described by an imported project, also handling \fI.ali\fR files. .\" A dependency written in C should be listed in \fILibrary_Options\fR when building a shared library, and in \fILinker'Linker_Options\fR when using a static archive, but is not always required in \fILinker'Linker_Options\fR for shared libraries. .\" Until now, such options have only proved useful to light bindings importing C symbols from a specification or an inlined procedure. .\" In a \fIfoo.pc\fR file as read by \fIpkg\-config\fR, they are named \fILibs\fR, excluding \fI\-lfoo\fR and \fILibs.private\fR. .\"---------------------------------------------------------------------- .SH OPTIONS Common debhelper command line options and environment variables are recognized. .\"---------------------------------------------------------------------- .SH EXAMPLES This stanza in \fBdebian/rules\fR may help debugging. .nf .B override_dh_ada_library: .B " dh_ada_library -v" .fi .\"---------------------------------------------------------------------- .SH VERSIONS The version is composed of two numbers separated by a dot. .\" The second one increases during a normal update, which supposedly fixes bugs, introduces compatible evolutions, or remove stuff unused since \fIoldoldstable\fR. .\" A change in the first one announces an incompatibility requiring some users to modify their source package. .\"---------------------------------------------------------------------- .SH SEE ALSO .BR debhelper (7), .BR deb\-substvars (5), the \fBDebian Policy\fR at .IR https://www.debian.org/doc/debian\-policy/ch\-sharedlibs.html#run\-time\-shared\-libraries , the \fBDebian Policy for Ada\fR at .IR http://people.debian.org/~lbrenta/debian\-ada\-policy.html , and the documentation of GNAT project tools installed into \fB/usr/share/doc/gprbuild\fR by the gprbuild-doc package. .\"---------------------------------------------------------------------- .SH AUTHOR .B dh_ada_library and this manpage were written by Nicolas Boulenguez for the Debian project (and may be used by others).