+ <p>
+ The <tt>shlibs</tt> system is a simpler alternative to
+ the <tt>symbols</tt> system for declaring dependencies for
+ shared libraries. It may be more appropriate for C++
+ libraries and other cases where tracking individual symbols is
+ too difficult. It predated the <tt>symbols</tt> system and is
+ therefore frequently seen in older packages. It is also
+ required for udebs, which do not support <tt>symbols</tt>.
+ </p>
+
+ <p>
+ In the following sections, we will first describe where the
+ various <file>shlibs</file> files are to be found, then how to
+ use <prgn>dpkg-shlibdeps</prgn>, and finally
+ the <file>shlibs</file> file format and how to create them.
+ </p>
+
+ <sect2 id="shlibs-paths">
+ <heading>The <file>shlibs</file> files present on the
+ system</heading>
+
+ <p>
+ There are several places where <tt>shlibs</tt> files are
+ found. The following list gives them in the order in which
+ they are read by <prgn>dpkg-shlibdeps</prgn>. (The first
+ one which gives the required information is used.)
+ <list>
+ <item>
+ <p><file>debian/shlibs.local</file></p>
+
+ <p>
+ This lists overrides for this package. This file
+ should normally not be used, but may be needed
+ temporarily in unusual situations to work around bugs
+ in other packages, or in unusual cases where the
+ normally declared dependency information in the
+ installed <file>shlibs</file> file for a library
+ cannot be used. This file overrides information
+ obtained from any other source.
+ </p>
+ </item>
+
+ <item>
+ <p><file>/etc/dpkg/shlibs.override</file></p>
+
+ <p>
+ This lists global overrides. This list is normally
+ empty. It is maintained by the local system
+ administrator.
+ </p>
+ </item>
+
+ <item>
+ <p><file>DEBIAN/shlibs</file> files in the "build
+ directory"</p>
+
+ <p>
+ These files are generated as part of the package build
+ process and staged for inclusion as control files in
+ the binary packages being built. They provide details
+ of any shared libraries included in the same package.
+ </p>
+ </item>
+
+ <item>
+ <p><file>shlibs</file> control files for packages
+ installed on the system</p>
+
+ <p>
+ The <file>shlibs</file> control files for all the
+ packages currently installed on the system. These are
+ normally found
+ in <file>/var/lib/dpkg/info/*.shlibs</file>, but
+ packages should not rely on this and instead should
+ use <tt>dpkg-query --control-path <var>package</var>
+ shlibs</tt> if for some reason these files need to be
+ examined.
+ </p>
+ </item>
+
+ <item>
+ <p><file>/etc/dpkg/shlibs.default</file></p>
+
+ <p>
+ This file lists any shared libraries whose packages
+ have failed to provide correct <file>shlibs</file>
+ files. It was used when the <file>shlibs</file> setup
+ was first introduced, but it is now normally empty.
+ It is maintained by the <tt>dpkg</tt> maintainer.
+ </p>
+ </item>
+ </list>
+ </p>
+
+ <p>
+ If a <file>symbols</file> file for a shared library package
+ is available, <prgn>dpkg-shlibdeps</prgn> will always use it
+ in preference to a <file>shlibs</file>, with the exception
+ of <file>debian/shlibs.local</file>. The latter overrides
+ any other <file>shlibs</file> or <file>symbols</file> files.
+ </p>
+ </sect2>
+
+ <sect2 id="shlibs">
+ <heading>The <file>shlibs</file> File Format</heading>
+
+ <p>
+ Each <file>shlibs</file> file has the same format. Lines
+ beginning with <tt>#</tt> are considered to be comments and
+ are ignored. Each line is of the form:
+ <example compact="compact">
+ [<var>type</var>: ]<var>library-name</var> <var>soname-version</var> <var>dependencies ...</var>
+ </example>
+ </p>
+
+ <p>
+ We will explain this by reference to the example of the
+ <tt>zlib1g</tt> package, which (at the time of writing)
+ installs the shared
+ library <file>/usr/lib/libz.so.1.2.3.4</file>.
+ </p>
+
+ <p>
+ <var>type</var> is an optional element that indicates the
+ type of package for which the line is valid. The only type
+ currently in use is <tt>udeb</tt>. The colon and space
+ after the type are required.
+ </p>
+
+ <p>
+ <var>library-name</var> is the name of the shared library,
+ in this case <tt>libz</tt>. (This must match the name part
+ of the soname, see below.)
+ </p>
+
+ <p>
+ <var>soname-version</var> is the version part of the
+ ELF <tt>SONAME</tt> attribute of the library, determined the
+ same way that the <var>soversion</var> component of the
+ recommended shared library package name is determined.
+ See <ref id="sharedlibs-runtime"> for the details.
+ </p>
+
+ <p>
+ <var>dependencies</var> has the same syntax as a dependency
+ field in a binary package control file. It should give
+ details of which packages are required to satisfy a binary
+ built against the version of the library contained in the
+ package. See <ref id="depsyntax"> for details on the
+ syntax, and <ref id="sharedlibs-updates"> for details on how
+ to maintain the dependency version constraint.
+ </p>
+
+ <p>
+ In our example, if the last change to the <tt>zlib1g</tt>
+ package that could change behavior for a client of that
+ library was in version <tt>1:1.2.3.3.dfsg-1</tt>, then
+ the <tt>shlibs</tt> entry for this library could say:
+ <example compact="compact">
+ libz 1 zlib1g (>= 1:1.2.3.3.dfsg)
+ </example>
+ This version restriction must be new enough that any binary
+ built against the current version of the library will work
+ with any version of the shared library that satisfies that
+ dependency.
+ </p>
+
+ <p>
+ As zlib1g also provides a udeb containing the shared
+ library, there would also be a second line:
+ <example compact="compact">
+ udeb: libz 1 zlib1g-udeb (>= 1:1.2.3.3.dfsg)
+ </example>
+ </p>
+ </sect2>
+
+ <sect2>
+ <heading>Providing a <file>shlibs</file> file</heading>
+
+ <p>
+ To provide a <file>shlibs</file> file for a shared library
+ binary package, create a <file>shlibs</file> file following
+ the format described above and place it in
+ the <file>DEBIAN</file> directory for that package during
+ the build. It will then be included as a control file for
+ that package<footnote>
+ This is what <prgn>dh_makeshlibs</prgn> in
+ the <package>debhelper</package> suite does. If your
+ package also has a udeb that provides a shared
+ library, <prgn>dh_makeshlibs</prgn> can automatically
+ generate the <tt>udeb:</tt> lines if you specify the name
+ of the udeb with the <tt>--add-udeb</tt> option.
+ </footnote>.
+ </p>
+
+ <p>
+ Since <prgn>dpkg-shlibdeps</prgn> reads
+ the <file>DEBIAN/shlibs</file> files in all of the binary
+ packages being built from this source package, all of
+ the <file>DEBIAN/shlibs</file> files should be installed
+ before <prgn>dpkg-shlibdeps</prgn> is called on any of the
+ binary packages.
+ </p>
+ </sect2>
+ </sect1>