summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorModestas Vainius <modestas@vainius.eu>2010-02-13 14:54:53 +0200
committerModestas Vainius <modestas@vainius.eu>2010-02-13 15:54:34 +0200
commit62d9d9a52cd0abd59cd81482bb9079d638cadb88 (patch)
tree132f40f50b4157cd325d8ced8634eb4db8285c7b
parent5fac35d0ed955bff8c7c4716a6ee3521d3787a3b (diff)
downloadpkg-kde-tools-62d9d9a52cd0abd59cd81482bb9079d638cadb88.tar.gz
Implement dh_movelibkdeinit debhelper program.
It moves libkdeinit4_*.so from public /usr/lib to private /usr/lib/kde4/libkdeinit if RUNPATHs are set properly. Add this helper to CDBS kde.mk/debian-qt-kde.mk and debhelper kde addon.
-rw-r--r--Makefile2
-rw-r--r--debhelper/Debian/Debhelper/Sequence/kde.pm2
-rwxr-xr-xdebhelper/dh_movelibkdeinit128
-rw-r--r--debian/changelog5
-rw-r--r--makefiles/1/cdbs/kde.mk3
-rw-r--r--qt-kde-team/1/debian-qt-kde.mk3
6 files changed, 143 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index 29ebc66..a063e15 100644
--- a/Makefile
+++ b/Makefile
@@ -33,6 +33,8 @@ install:
# Custom debhelper commands
pod2man $(DEBHELPER_DIR)/dh_sameversiondep > $(MANDIR)/man1/dh_sameversiondep.1
install -m 0755 $(DEBHELPER_DIR)/dh_sameversiondep $(BINDIR)
+ pod2man $(DEBHELPER_DIR)/dh_movelibkdeinit > $(MANDIR)/man1/dh_movelibkdeinit.1
+ install -m 0755 $(DEBHELPER_DIR)/dh_movelibkdeinit $(BINDIR)
# Debhelper addons
cd $(DEBHELPER_DIR) && find Debian -type f -name "*.pm" -exec \
diff --git a/debhelper/Debian/Debhelper/Sequence/kde.pm b/debhelper/Debian/Debhelper/Sequence/kde.pm
index dab5987..445b6a9 100644
--- a/debhelper/Debian/Debhelper/Sequence/kde.pm
+++ b/debhelper/Debian/Debhelper/Sequence/kde.pm
@@ -31,3 +31,5 @@ add_command_options("dh_auto_build", "--buildsystem=kde");
add_command_options("dh_auto_test", "--buildsystem=kde");
add_command_options("dh_auto_install", "--buildsystem=kde");
add_command_options("dh_auto_clean", "--buildsystem=kde");
+
+insert_after("dh_install", "dh_movelibkdeinit");
diff --git a/debhelper/dh_movelibkdeinit b/debhelper/dh_movelibkdeinit
new file mode 100755
index 0000000..3708d31
--- /dev/null
+++ b/debhelper/dh_movelibkdeinit
@@ -0,0 +1,128 @@
+#!/usr/bin/perl -w
+
+=head1 NAME
+
+dh_movelibkdeinit - move libkdeinit4_*.so from public to the private directory
+
+=head1 SYNOPSIS
+
+B<dh_movelibkdeinit> [S<I<debhelper options>>]
+
+=head1 DESCRIPTION
+
+B<dh_movelibkdeinit> is a helper program which moves all installed
+F<usr/lib/libkdeinit4_*.so> kdeinit "shared" executables from the public
+location to the private subdirectory F</usr/lib/kde4/libkdeinit>.
+libkdeinit*.so shared executables are not proper public shared libraries by
+definition and they are built as shared library only for performance purposes.
+
+Please note, however, that in order for the moved executables to work properly,
+the following conditions must be met:
+
+=over 4
+
+=item *
+
+the package should depend on the kde4libs binary packages built with the
+C<-DLIBKDEINIT_INSTALL_DIR=/usr/lib/kde4/libkdeinit> cmake flag (enabled since
+kde4libs 4:4.4.0). B<dh_movelibkdeinit> will try to confirm this condition and
+it will do nothing if it is not met.
+
+=item *
+
+the source package was built with the C<-DENABLE_LIBKDEINIT_RUNPATH=ON> cmake
+flag. This flag is enabled by default when building using either CDBS kde.mk
+class or the debhelper kde build system which both as shipped in the 0.6.2 or
+later version of the I<pkg-kde-tools> package.
+
+=back
+
+=head1 OPTIONS
+
+=over 4
+
+=item B<-X>I<item>, B<--exclude> I<item>
+
+Do not move libkdeinit4_*.so files that contain "item" anywhere in their
+filename. You may use this option multiple times to build up a list of things
+to exclude.
+
+=back
+
+=cut
+
+use strict;
+use warnings;
+
+use Debian::Debhelper::Dh_Lib;
+
+use constant LIBKDEINIT_INSTALL_DIR => '/usr/lib/kde4/libkdeinit';
+
+init();
+
+if (@{$dh{DOPACKAGES}} && -f '/usr/bin/kdeinit4' &&
+ system(sprintf("objdump -p /usr/bin/kdeinit4 2>/dev/null | grep -q 'RUNPATH.*%s'",
+ LIBKDEINIT_INSTALL_DIR)) != 0)
+{
+ warning("kdeinit4 does not have a proper RUNPATH set, not moving public libkdeinit4_*.so");
+ exit 0;
+}
+
+foreach my $package (@{$dh{DOPACKAGES}}) {
+ my $tmpdir = tmpdir($package);
+ if (-d "$tmpdir/usr/lib") {
+ my $libkdeinit_dir = $tmpdir . LIBKDEINIT_INSTALL_DIR;
+ my @libkdeinit;
+ my $exclude = '';
+ if (defined($dh{EXCLUDE_FIND}) && $dh{EXCLUDE_FIND} ne '') {
+ $exclude = "! \\( $dh{EXCLUDE_FIND} \\)";
+ }
+ open (FIND, "find $tmpdir/usr/lib -maxdepth 1 -type f \\( -name 'libkdeinit4_*.so' \\) $exclude |");
+ while (<FIND>) {
+ chop;
+ push @libkdeinit, $_;
+ }
+ close FIND;
+
+ for my $libkdeinit (@libkdeinit) {
+ my $exename;
+ my $exepath;
+ if ($libkdeinit =~ m%/libkdeinit4_([^/]*)\.so$%) {
+ $exename = $1;
+ if (-x "$tmpdir/usr/bin/$exename") {
+ $exepath = "$tmpdir/usr/bin/$exename";
+ } else {
+ open (FIND, "find $tmpdir -type f -executable -name $exename |");
+ $exepath = <FIND>;
+ chop $exepath if $exepath;
+ close FIND;
+ }
+ }
+ if ($exepath) {
+ if (system(sprintf("objdump -p '%s' 2>/dev/null | grep -q 'RUNPATH.*%s'",
+ $exepath, LIBKDEINIT_INSTALL_DIR)) == 0) {
+ unless (-d $libkdeinit_dir) {
+ doit("mkdir", "-p", $libkdeinit_dir);
+ }
+ doit("mv", $libkdeinit, $libkdeinit_dir);
+ } else {
+ warning("unable to validate RUNPATH on the dummy kdeinit executable for $libkdeinit, not moving");
+ }
+ } else {
+ warning("unable to find a dummy kdeinit executable for $libkdeinit, not moving");
+ }
+ }
+ }
+}
+
+exit 0;
+
+=head1 SEE ALSO
+
+L<debhelper(7)>
+
+=head1 AUTHOR
+
+Modestas Vainius <modax@debian.org>
+
+=cut
diff --git a/debian/changelog b/debian/changelog
index 095de3a..f1c2135 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,5 +1,10 @@
pkg-kde-tools (0.6.2~pre4) UNRELEASED; urgency=low
+ * Implement dh_movelibkdeinit debhelper program which moves libkdeinit4_*.so
+ from public /usr/lib to private /usr/lib/kde4/libkdeinit if RUNPATHs are
+ set properly.
+ * Add dh_movelibkdeinit helper to debhelper kde addon sequence, CDBS kde.mk
+ and debian-qt-kde.mk.
-- Modestas Vainius <modax@debian.org> Sat, 13 Feb 2010 02:29:05 +0200
diff --git a/makefiles/1/cdbs/kde.mk b/makefiles/1/cdbs/kde.mk
index 264d8b6..9fe5f70 100644
--- a/makefiles/1/cdbs/kde.mk
+++ b/makefiles/1/cdbs/kde.mk
@@ -6,3 +6,6 @@ include /usr/share/pkg-kde-tools/makefiles/1/variables.mk
DEB_CMAKE_EXTRA_FLAGS += $(DEB_CMAKE_KDE4_FLAGS) $(DEB_CMAKE_CUSTOM_FLAGS)
DEB_COMPRESS_EXCLUDE = .dcl .docbook -license .tag .sty .el
+
+$(patsubst %,binary-post-install/%,$(DEB_ARCH_PACKAGES)) :: binary-post-install/%:
+ dh_movelibkdeinit -p$(cdbs_curpkg) $(DEB_DH_MOVELIBKDEINIT_ARGS)
diff --git a/qt-kde-team/1/debian-qt-kde.mk b/qt-kde-team/1/debian-qt-kde.mk
index de80f12..10c94d2 100644
--- a/qt-kde-team/1/debian-qt-kde.mk
+++ b/qt-kde-team/1/debian-qt-kde.mk
@@ -60,6 +60,9 @@ clean::
$(patsubst %,binary-install/%,$(DEB_PACKAGES)) :: binary-install/%:
$(if $(wildcard /usr/bin/dh_bugfiles),dh_bugfiles -p$(cdbs_curpkg) $(DEB_DH_BUGFILES_ARGS))
+$(patsubst %,binary-post-install/%,$(DEB_ARCH_PACKAGES)) :: binary-post-install/%:
+ dh_movelibkdeinit -p$(cdbs_curpkg) $(DEB_DH_MOVELIBKDEINIT_ARGS)
+
binary-install/$(DEB_SOURCE_PACKAGE)-doc-html::
set -e; \
for doc in `cd $(DEB_DESTDIR)/usr/share/doc/kde4/HTML/en; find . -name index.docbook`; do \