[SCM] libva/experimental: Implement dh_libva and add libva-driver-abi-* Provides to libva1

sramacher at users.alioth.debian.org sramacher at users.alioth.debian.org
Mon Dec 15 19:05:24 UTC 2014


The following commit has been merged in the experimental branch:
commit e816d105572743c0b61e96cd6b65c716cca0d3ef
Author: Sebastian Ramacher <sramacher at debian.org>
Date:   Mon Dec 15 17:50:19 2014 +0100

    Implement dh_libva and add libva-driver-abi-* Provides to libva1

diff --git a/debian/clean b/debian/clean
index 0cb746b..7d61a54 100644
--- a/debian/clean
+++ b/debian/clean
@@ -1,3 +1,4 @@
+debian/dh/dh_libva.1
 debian.upstream/changelog
 debian.upstream/control
 test/v4l_h264/decode/Makefile
diff --git a/debian/control b/debian/control
index 7b15fab..d3497e6 100644
--- a/debian/control
+++ b/debian/control
@@ -17,7 +17,8 @@ Build-Depends:
  libx11-dev,
  libxext-dev,
  libxfixes-dev,
- pkg-config
+ pkg-config,
+ perl
 Standards-Version: 3.9.6
 Homepage: http://www.freedesktop.org/wiki/Software/vaapi
 Vcs-Git: git://anonscm.debian.org/pkg-multimedia/libva.git
@@ -36,7 +37,8 @@ Depends:
  libva-x11-1 (= ${binary:Version}),
  libva1 (= ${binary:Version}),
  libwayland-dev (>= 1.0.0) [linux-any],
- ${misc:Depends}
+ ${misc:Depends},
+ libset-scalar-perl
 Description: Video Acceleration (VA) API for Linux -- development files
  Video Acceleration API (VA API) is a library ("libVA") and API specification
  which enables and provides access to graphics hardware (GPU) acceleration for
@@ -60,6 +62,12 @@ Recommends:
  va-driver-all | va-driver
 Breaks:
  vlc-nox (<< 1.1.5-3)
+Provides:
+ libva-driver-abi-0.32,
+ libva-driver-abi-0.33,
+ libva-driver-abi-0.34,
+ libva-driver-abi-0.35,
+ libva-driver-abi-0.36
 Description: Video Acceleration (VA) API for Linux -- runtime
  Video Acceleration API (VA API) is a library ("libVA") and API specification
  which enables and provides access to graphics hardware (GPU) acceleration for
diff --git a/debian/copyright b/debian/copyright
index e69facd..514150e 100644
--- a/debian/copyright
+++ b/debian/copyright
@@ -104,6 +104,7 @@ License: other
 Files: debian/*
 Copyright: 2007, Waldo Bastian <waldo.bastian at intel.com>
            2010, Andres Mejia <mcitadel at gmail.com>
+           2013-2014, Sebastian Ramacher <sramacher at debian.org>
 License: GPL-2+
  This file is free software; you can redistribute it and/or modify it
  under the terms of the GNU General Public License as published by
@@ -123,6 +124,10 @@ License: GPL-2+
  On Debian systems, the full text of the GNU General Public License
  version 2 can be found in the file `/usr/share/common-licenses/GPL-2'.
 
+Files: debian/dh/*
+Copyright: 2014, Sebastian Ramacher <sramacher at debian.org>
+License: Expat
+
 License: Expat
  Permission is hereby granted, free of charge, to any person obtaining
  a copy of this software and associated documentation files (the
diff --git a/debian/dh/dh_libva b/debian/dh/dh_libva
new file mode 100755
index 0000000..f87bee2
--- /dev/null
+++ b/debian/dh/dh_libva
@@ -0,0 +1,119 @@
+#!/usr/bin/perl
+#
+# Copyright 2014 Sebastian Ramacher <sramacher at 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) {
+    # Skip symlinks
+    next if -l $driver;
+
+    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('|', $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 at debian.org>
+
+=cut
+
+# vim:ts=2 sw=2 et
diff --git a/test/Makefile.am b/debian/dh/libva.pm
similarity index 79%
copy from test/Makefile.am
copy to debian/dh/libva.pm
index 6083bb3..dd09df5 100644
--- a/test/Makefile.am
+++ b/debian/dh/libva.pm
@@ -1,17 +1,17 @@
-# Copyright (c) 2007 Intel Corporation. All Rights Reserved.
+# Copyright 2014 Sebastian Ramacher <sramacher at debian.org>
 #
-# Permission is hereby granted, free of charge, to any person obtaining a
-# copy of this software and associated documentation files (the
+# 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.
@@ -20,10 +20,11 @@
 # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
 # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
-SUBDIRS = common decode encode vainfo
+use warnings;
+use strict;
+
+use Debian::Debhelper::Dh_Lib;
 
-if USE_X11
-SUBDIRS += basic putsurface
-endif
+insert_after('dh_install', 'dh_libva');
 
-EXTRA_DIST = loadsurface.h loadsurface_yuv.h
+1;
diff --git a/debian/libva-dev.install b/debian/libva-dev.install
index 1255ae0..869b410 100644
--- a/debian/libva-dev.install
+++ b/debian/libva-dev.install
@@ -2,3 +2,5 @@ usr/include
 usr/lib/*/libva*.so
 usr/lib/*/libva*.a
 usr/lib/*/pkgconfig
+debian/dh/dh_libva /usr/bin
+debian/dh/libva.pm /usr/share/perl5/Debian/Debhelper/Sequence
diff --git a/debian/libva-dev.manpages b/debian/libva-dev.manpages
new file mode 100644
index 0000000..18dca38
--- /dev/null
+++ b/debian/libva-dev.manpages
@@ -0,0 +1 @@
+debian/dh/dh_libva.1
diff --git a/debian/rules b/debian/rules
index be90f28..5e3a6ef 100755
--- a/debian/rules
+++ b/debian/rules
@@ -14,6 +14,10 @@ endif
 override_dh_auto_configure:
 	dh_auto_configure -- $(confflags)
 
+override_dh_auto_build:
+	dh_auto_build
+	cd debian/dh/ && pod2man -c Debhelper -r '' dh_libva dh_libva.1
+
 override_dh_makeshlibs:
 	dh_makeshlibs -Xdummy_drv_video.so
 

-- 
libva packaging



More information about the pkg-multimedia-commits mailing list