-
Notifications
You must be signed in to change notification settings - Fork 5
/
dh_epics_installlibs
executable file
·83 lines (55 loc) · 2.04 KB
/
dh_epics_installlibs
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
#!/usr/bin/perl
=head1 NAME
dh_epics_installlibs - Install host shared libraries in standard locations
=head1 SYNOPSIS
B<dh_epics_installlibs> [S<I<debhelper options>>]
=head1 DESCRIPTION
Looks for shared libraries in debian/tmp/${EPICS_BASE}/lib/${EPICS_HOST_ARCH}/.
Moves any shared libraries with SO names found to debian/tmp/usr/lib/
(or debian/tmp/usr/lib/<triplet>/ when using Multi-Arch)
and adjusts symlinks in the original directory.
This allows binaries linked against libXYZ.so.# to find it in the
default search path when run. At the same time new binaries being
linked must explicitly add ${EPICS_BASE}/lib/<targetname>/ to
the search path.
The intent of this process is to prevent accidentally linking
against the wrong copy/version of a library.
Switching to the new Multi-Arch locations is controlled by
the debhelper compat level in debian/compat:
level 9 and up will use the new Multi-Arch locations.
=cut
use strict;
use warnings;
use Debian::Debhelper::Dh_Lib;
use Debian::Debhelper::Dh_Epics qw(setepicsenv);
init();
my $multiarch=dpkg_architecture_value("DEB_HOST_MULTIARCH");
my $slashtriplet="";
if (! compat(8)) {
if (defined $multiarch && $multiarch ne '') {
$slashtriplet="/$multiarch";
}
}
setepicsenv();
# collect host libraries with SO names
my @libs = glob("debian/tmp/$ENV{EPICS_BASE}/lib/$ENV{EPICS_HOST_ARCH}/lib*.so.*");
if( @libs > 0) {
doit("install","-m","755","-d","debian/tmp/usr/lib$slashtriplet");
}
foreach my $lib (@libs) {
my $edir = dirname($lib);
my $lname = basename($lib);
my ($base, $sov) = $lname =~ m/(lib.*\.so)\.(.*)/;
if(-e "$edir/$base" and not -l "$edir/$base") {
warning("Warning: Not a symlink: $edir/$base");
}
doit("mv",$lib,"debian/tmp/usr/lib$slashtriplet/$lname");
doit("rm","-f","$edir/$base");
doit("ln","-s","../../..$slashtriplet/$lname","$edir/$base");
}
=head1 SEE ALSO
L<debhelper(7)>, L<epics-debhelper(7)>
This program is a not part of the official debhelper package.
=head1 AUTHOR
Michael Davidsaver <[email protected]>
=cut