/usr/bin/dh_libva is in libva-dev 2.1.0-3.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 | #!/usr/bin/perl
#
# Copyright 2014-2016 Sebastian Ramacher <sramacher@debian.org>
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sub license, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
#
# The above copyright notice and this permission notice (including the
# next paragraph) shall be included in all copies or substantial portions
# of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
# IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
# ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# PROMISE: DH NOOP WITHOUT tmp(usr/lib)
=head1 NAME
dh_libva - helps with packaging VA API drivers
=head1 SYNOPSIS
dh_libva [S<I<debhelper options>>] [B<-X>I<item>] [I<directory>...]
=head1 DESCRIPTION
B<dh_libva> is a debhelper program that generates dependencies for VA API driver
packages. It scans packages looking for VA API drivers and adds the packages
providing the necessary ABI for the driver to the B<${misc:Depends}>
substitution variable.
=head1 OPTIONS
=over 4
=item B<--substvar=>I<substvar>
Override the substitution variable.
=back
=cut
use strict;
use warnings;
use Debian::Debhelper::Dh_Lib;
use Set::Scalar;
init(options => {
"substvar=s" => \$dh{SUBSTVAR}
});
unless ($dh{SUBSTVAR}) {
$dh{SUBSTVAR} = "misc:Depends";
}
my $triplet = dpkg_architecture_value("DEB_HOST_MULTIARCH");
foreach my $package (@{$dh{DOPACKAGES}}) {
# Directory that contains the files included in the package.
my $pkgpath = tmpdir($package);
$pkgpath .= "/usr/lib/$triplet/dri";
next unless -d $pkgpath;
# ABI versions
my $abiver = Set::Scalar->new;
# Files to check
my @filelist = glob($pkgpath . "/*_drv_video.so");
foreach my $driver (@filelist) {
open(my $nm, "-|", "nm", ("-D", $driver)) or
error("cannot read symbols: $!\n");
while (<$nm>) {
chomp;
my @data = split(' ');
next unless scalar(@data) == 3;
my $symbol = $data[2];
if ($symbol =~ /^__vaDriverInit_(\d+)_(\d+)$/) {
$abiver->insert("libva-driver-abi-$1.$2");
}
}
close $nm or error($! ? "cannot close nm pipe: $!\n" :
"non-zero exit status from nm: $=\n");
}
# Add substvar
addsubstvar($package, $dh{SUBSTVAR},
join(' | ', reverse sort $abiver->elements));
}
exit 0;
=head1 SEE ALSO
L<debhelper(7)>, L<dh(1)>.
This program is meant to be used together with debhelper.
=head1 AUTHOR
Sebastian Ramacher <sramacher@debian.org>
=cut
# vim:ts=2 sw=2 et
|