3
# Copyright (C) 2010 Modestas Vainius <modax@debian.org>
5
# This program is free software: you can redistribute it and/or modify
6
# it under the terms of the GNU General Public License as published by
7
# the Free Software Foundation, either version 3 of the License, or
8
# (at your option) any later version.
10
# This program is distributed in the hope that it will be useful,
11
# but WITHOUT ANY WARRANTY; without even the implied warranty of
12
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
# GNU General Public License for more details.
15
# You should have received a copy of the GNU General Public License
16
# along with this program. If not, see <http://www.gnu.org/licenses/>
20
dh_movelibkdeinit - move libkdeinit4_*.so from public to the private directory
24
B<dh_movelibkdeinit> [S<I<debhelper options>>]
28
B<dh_movelibkdeinit> is a helper program which moves all installed
29
F<usr/lib/libkdeinit4_*.so> kdeinit "shared" executables from the public
30
location to the private subdirectory F</usr/lib/kde4/libkdeinit>.
31
libkdeinit*.so shared executables are not proper public shared libraries by
32
definition and they are built as shared library only for performance purposes.
34
Please note, however, that in order for the moved executables to work properly,
35
the following conditions must be met:
41
the package should depend on the kde4libs binary packages built with the
42
C<-DLIBKDEINIT_INSTALL_DIR=/usr/lib/kde4/libkdeinit> cmake flag (enabled since
43
kde4libs 4:4.4.0). B<dh_movelibkdeinit> will try to confirm this condition and
44
it will do nothing if it is not met.
48
the source package was built with the C<-DENABLE_LIBKDEINIT_RUNPATH=ON> cmake
49
flag. This flag is enabled by default when building using either CDBS kde.mk
50
class or the debhelper kde build system which both as shipped in the 0.6.2 or
51
later version of the I<pkg-kde-tools> package.
59
=item B<-X>I<item>, B<--exclude> I<item>
61
Do not move libkdeinit4_*.so files that contain "item" anywhere in their
62
filename. You may use this option multiple times to build up a list of things
72
use Debian::Debhelper::Dh_Lib;
74
use constant LIBKDEINIT_INSTALL_DIR => '/usr/lib/kde4/libkdeinit';
78
if (@{$dh{DOPACKAGES}} && -f '/usr/bin/kdeinit4' &&
79
system(sprintf("objdump -p /usr/bin/kdeinit4 2>/dev/null | grep -q 'RUNPATH.*%s'",
80
LIBKDEINIT_INSTALL_DIR)) != 0)
82
warning("kdeinit4 does not have a proper RUNPATH set, not moving public libkdeinit4_*.so");
86
foreach my $package (@{$dh{DOPACKAGES}}) {
87
my $tmpdir = tmpdir($package);
88
if (-d "$tmpdir/usr/lib") {
89
my $libkdeinit_dir = $tmpdir . LIBKDEINIT_INSTALL_DIR;
92
if (defined($dh{EXCLUDE_FIND}) && $dh{EXCLUDE_FIND} ne '') {
93
$exclude = "! \\( $dh{EXCLUDE_FIND} \\)";
95
open (FIND, "find $tmpdir/usr/lib -maxdepth 1 -type f \\( -name 'libkdeinit4_*.so' \\) $exclude |");
102
for my $libkdeinit (@libkdeinit) {
105
if ($libkdeinit =~ m%/libkdeinit4_([^/]*)\.so$%) {
107
if (-x "$tmpdir/usr/bin/$exename") {
108
$exepath = "$tmpdir/usr/bin/$exename";
110
open (FIND, "find $tmpdir -type f -executable -name $exename |");
112
chop $exepath if $exepath;
117
if (system(sprintf("objdump -p '%s' 2>/dev/null | grep -q 'RUNPATH.*%s'",
118
$exepath, LIBKDEINIT_INSTALL_DIR)) == 0) {
119
unless (-d $libkdeinit_dir) {
120
doit("mkdir", "-p", $libkdeinit_dir);
122
doit("mv", $libkdeinit, $libkdeinit_dir);
124
warning("unable to validate RUNPATH on the dummy kdeinit executable for $libkdeinit, not moving");
127
warning("unable to find a dummy kdeinit executable for $libkdeinit, not moving");
141
Modestas Vainius <modax@debian.org>