#!/usr/bin/perl -w # Copyright (C) 2010 Modestas Vainius # # 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 =head1 NAME dh_sodeps - generate library dependencies for development *.so symlinks =head1 SYNOPSIS B [S>] [B<-V>I] =head1 DESCRIPTION dh_sodeps is a helper program that generates library dependencies for *.so symlinks that are typically found in the library development packages. It basically looks for F in the package build directory, finds all local arch specific packages that actually contain targets of those symlinks and adds dependencies on the discovered packages to the C substitution variable. Dependencies are strict by default, i.e. (=${binary:Version}) if the package containing *.so is arch specific or (>=${source:Version}) if it is arch independent. =head1 OPTIONS =over 4 =item B<-V>I, B<--version-info>=I Use the specified version information for dependencies. If this option is not specified, dh_sodeps will generate a strict dependency as explained above. Please note that you don't need to enclose the value in brackets. dh_sodeps will do this automatically. =item B<-X>I, B<--exclude> I Do not calculate dependencies for *.so files that contain "item" anywhere in their path/filename. You may use this option multiple times to build up a list of things to exclude. =back =cut use strict; use warnings; use Debian::Debhelper::Dh_Lib; my $opt_verinfo; init(options => { 'version-info|V' => \$opt_verinfo, }); exit 0 unless @{$dh{DOPACKAGES}}; my @packages = getpackages("arch"); foreach my $package (@{$dh{DOPACKAGES}}) { my $tmpdir = tmpdir($package); my @solinks = grep { -l $_ } glob("$tmpdir/usr/lib/*.so"); if (@solinks) { my $arch = package_arch($package); my $verinfo; if (defined $opt_verinfo) { $verinfo = $opt_verinfo; } elsif ($arch eq "all") { $verinfo = '>= ${source:Version}'; } else { $verinfo = '= ${binary:Version}'; } foreach my $solink (@solinks) { next if excludefile($solink); my $target = readlink($solink); foreach my $p (@packages) { next if $p eq $package; if (-e "debian/$p/usr/lib/$target") { addsubstvar($package, "so:Depends", $p, $verinfo); } } } } } exit 0; =head1 SEE ALSO L =head1 AUTHOR Modestas Vainius =cut