Commit bccf6457 authored by Sebastian Ramacher's avatar Sebastian Ramacher

Improve dh_zathura and provide sequence

parent 681cd7e0
......@@ -25,7 +25,7 @@ Vcs-Browser: https://salsa.debian.org/sramacher/zathura
Package: zathura
Architecture: any
Provides:
${zathura:Provides}
zathura-abi-4
Depends:
zathura-pdf-poppler,
${shlibs:Depends},
......@@ -52,12 +52,14 @@ Description: document viewer with a minimalistic interface
Package: zathura-dev
Section: libdevel
Architecture: all
Architecture: any
Multi-Arch: same
Depends:
${misc:Depends},
libgirara-dev (>= 0.2.9),
libgtk-3-dev (>= 3.22),
libcairo2-dev (>= 1.8.8)
libcairo2-dev (>= 1.8.8),
libset-scalar-perl
Description: development files for zathura plugins
zathura is a document viewer with a minimalistic and space saving interface.
It can be extended to support other file formats via a plugin system.
......
#!/usr/bin/perl -w
# Copyright 2012-2018 Sebastian Ramacher <sramacher@debian.org>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. The name of the author may not be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
# IN NO EVENT SHALL THE AUTOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
# TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# PROMISE: DH NOOP WITHOUT tmp(usr/lib)
=head1 NAME
dh_zathura - helps with packaging zathura plugins
=head1 SYNOPSIS
dh_libva [S<I<debhelper options>>] [B<--substvar=>I<substvar>]
=head1 DESCRIPTION
B<dh_zathura> is a debhelper program that generates dependencies for zathura
plugin packages. It scans packages looking for zathura plugins and adds the
packages providing the necessary ABI for the plugins 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/zathura";
next unless -d $pkgpath;
# ABI versions
my $abiver = Set::Scalar->new;
# Files to check
my @filelist = glob($pkgpath . "/*.so");
foreach my $plugin (@filelist) {
open(my $nm, "-|", "nm", ("-D", $plugin)) or
error("cannot read symbols: $!\n");
while (<$nm>) {
chomp;
my @data = split(' ');
next unless scalar(@data) == 3;
my $symbol = $data[2];
if ($symbol =~ /^zathura_plugin_(\d+)_(\d+)$/) {
$abiver->insert("zathura-abi-$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
#!/usr/bin/perl -w
# Copyright 2012 Sebastian Ramacher <s.ramacher@gmx.at>
# Copyright 2018 Sebastian Ramacher <sramacher@debian.org>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
......@@ -23,35 +22,11 @@
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
use warnings;
use strict;
use Debian::Debhelper::Dh_Lib;
init(options => {
"substvar=s" => \$dh{SUBSTVAR}
});
my $abiversion;
open(PKGCONFIG, 'pkg-config --variable=abiversion zathura |') or
error("cannot read ABI version data: $!");
while (<PKGCONFIG>) {
chomp;
next unless /^\w+$/;
$abiversion = $_;
}
close PKGCONFIG or error($! ? "cannot close pkg-config pipe: $!\n"
: "non-zero exit status from pkg-config: $?");
unless ($abiversion) {
error("cannot parse ABI version data");
}
unless ($dh{SUBSTVAR}) {
$dh{SUBSTVAR} = "misc:Depends";
}
use Debian::Debhelper::Dh_Lib;
foreach my $package (@{$dh{DOPACKAGES}}) {
addsubstvar($package, $dh{SUBSTVAR}, "zathura-abi-$abiversion");
}
insert_after('dh_link', 'dh_zathura');
exit 0;
1;
.TH DH_ZATHURA 1 "2012-03-21" "zathura"
.SH NAME
/usr/share/zathura/dh_zathura \- adds zathura depends to misc:Depends substvar
.SH SYNOPSIS
\fBdh_zathura\fR [\fIdebhelper\ options\fR] [\fB\-\-substvar=\fR\fIname]
.SH DESCRIPTION
dh_zathura adds information about the correct dependency on zathura to
misc:Depends substvar. This is needed because an ABI breakage might make the
a plugin unusable.
.PP
The helper script uses the information stored in zathura's pkg-config file to
determine the ABI version.
.SH "OPTIONS"
.IP "\fB\-\-substvar=\fR\fIname" 4
Change the substvar name to something other than misc:Depends.
.SH "SEE ALSO"
\fIdebhelper\fR(7)
.PP
This program is provided by zathura-dev and is not part of debhelper.
.SH "AUTHOR"
Sebastian Ramacher <s.ramacher@gmx.at>
......@@ -17,12 +17,12 @@ export COLOR=0
%:
dh $@
debian/dh/dh_zathura.1:
cd debian/dh && pod2man -c Debhelper -r '' dh_zathura dh_zathura.1
override_dh_auto_test:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
xvfb-run -a env $(MAKE) test
endif
override_dh_gencontrol:
PKG_CONFIG_PATH=$(CURDIR) ./debian/dh_zathura \
-pzathura --substvar=zathura:Provides
dh_gencontrol
override_dh_auto_build: debian/dh/dh_zathura.1
dh_auto_build
usr/include/zathura/*
usr/lib/pkgconfig/zathura.pc
debian/dh_zathura usr/share/zathura
debian/dh/dh_zathura /usr/bin
debian/dh/zathura.pm /usr/share/perl5/Debian/Debhelper/Sequence
debian/dh_zathura.1
debian/dh/dh_zathura.1
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment