summaryrefslogtreecommitdiff
path: root/perllib/Debian/Debhelper
diff options
context:
space:
mode:
Diffstat (limited to 'perllib/Debian/Debhelper')
-rw-r--r--perllib/Debian/Debhelper/Buildsystem/kde.pm63
-rw-r--r--perllib/Debian/Debhelper/Sequence/kde.pm44
-rw-r--r--perllib/Debian/Debhelper/Sequence/pkgkde_symbolshelper.pm8
-rw-r--r--perllib/Debian/Debhelper/Sequence/sodeps.pm3
4 files changed, 118 insertions, 0 deletions
diff --git a/perllib/Debian/Debhelper/Buildsystem/kde.pm b/perllib/Debian/Debhelper/Buildsystem/kde.pm
new file mode 100644
index 0000000..c88961b
--- /dev/null
+++ b/perllib/Debian/Debhelper/Buildsystem/kde.pm
@@ -0,0 +1,63 @@
+# A debhelper build system class for building KDE 4 packages.
+# It is based on cmake class but passes KDE 4 flags by default.
+#
+# Copyright: © 2009 Modestas Vainius
+# License: GPL-2+
+
+package Debian::Debhelper::Buildsystem::kde;
+
+use strict;
+use warnings;
+use Debian::Debhelper::Dh_Lib qw(error);
+use base 'Debian::Debhelper::Buildsystem::cmake';
+
+sub DESCRIPTION {
+ "CMake with KDE 4 flags"
+}
+
+sub KDE4_FLAGS_FILE {
+ my $file = "kde4_flags";
+ if (! -r $file) {
+ $file = "/usr/share/pkg-kde-tools/lib/kde4_flags";
+ }
+ if (! -r $file) {
+ error "kde4_flags file could not be found";
+ }
+ return $file;
+}
+
+# Use shell for parsing contents of the kde4_flags file
+sub get_kde4_flags {
+ my $this=shift;
+ my $file = KDE4_FLAGS_FILE;
+ my ($escaped_flags, @escaped_flags);
+ my $flags;
+
+ # Read escaped flags from the file
+ open(KDE4_FLAGS, "<", $file) || error("unable to open KDE 4 flags file: $file");
+ @escaped_flags = <KDE4_FLAGS>;
+ chop @escaped_flags;
+ $escaped_flags = join(" ", @escaped_flags);
+ close KDE4_FLAGS;
+
+ # Unescape flags using shell
+ $flags = `$^X -w -Mstrict -e 'print join("\\x1e", \@ARGV);' -- $escaped_flags`;
+ return split("\x1e", $flags);
+}
+
+sub configure {
+ my $this=shift;
+ my @flags = $this->get_kde4_flags();
+
+ # Skip RPATH if kdelibs5-dev is older than 4:4.4.0
+ my $kdever = `dpkg-query -f='\${Version}\n' -W kdelibs5-dev 2>/dev/null`;
+ if ($kdever &&
+ system("dpkg", "--compare-versions", $kdever, "lt", "4:4.4.0") == 0)
+ {
+ push @flags, "-DCMAKE_SKIP_RPATH:BOOL=ON";
+ }
+
+ return $this->SUPER::configure(@flags, @_);
+}
+
+1;
diff --git a/perllib/Debian/Debhelper/Sequence/kde.pm b/perllib/Debian/Debhelper/Sequence/kde.pm
new file mode 100644
index 0000000..ca25d78
--- /dev/null
+++ b/perllib/Debian/Debhelper/Sequence/kde.pm
@@ -0,0 +1,44 @@
+{
+ package Debian::Debhelper::Sequence::kde;
+ use Debian::Debhelper::Dh_Version;
+ use Debian::Debhelper::Dh_Lib qw(error);
+
+ sub ensure_debhelper_version {
+ my @v = split(/\./, $Debian::Debhelper::Dh_Version::version);
+ if ($v[0] > $_[0]) {
+ return 1;
+ }
+ elsif ($v[0] == $_[0]) {
+ if ($v[1] > $_[1]) {
+ return 1;
+ }
+ elsif ($v[1] == $_[1]) {
+ return $1 >= $_[2] if ($v[2] =~ /^(\d+)/);
+ }
+ }
+ return 0;
+ }
+ unless (ensure_debhelper_version(7, 3, 16)) {
+ error "debhelper addon 'kde' requires debhelper 7.3.16 or later";
+ }
+
+ 1;
+}
+
+# Build with kde buildsystem by default
+add_command_options("dh_auto_configure", "--buildsystem=kde");
+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");
+
+# Omit usr/lib/kde4 from dh_makeshlibs by default
+add_command_options("dh_makeshlibs", "-Xusr/lib/kde4/");
+
+# Exclude kde documentation from dh_compress by default
+add_command_options("dh_compress",
+ qw(-X.dcl -X.docbook -X-license -X.tag -X.sty -X.el));
+
+insert_after("dh_install", "dh_movelibkdeinit");
+
+1;
diff --git a/perllib/Debian/Debhelper/Sequence/pkgkde_symbolshelper.pm b/perllib/Debian/Debhelper/Sequence/pkgkde_symbolshelper.pm
new file mode 100644
index 0000000..3577bc9
--- /dev/null
+++ b/perllib/Debian/Debhelper/Sequence/pkgkde_symbolshelper.pm
@@ -0,0 +1,8 @@
+use constant PKGKDE_BINDIR => '/usr/share/pkg-kde-tools/bin';
+
+# Add /usr/share/pkg-kde-tools/bin to $PATH
+if (! grep { PKGKDE_BINDIR eq $_ } split(":", $ENV{PATH})) {
+ $ENV{PATH} = PKGKDE_BINDIR . ":" . $ENV{PATH};
+}
+
+1;
diff --git a/perllib/Debian/Debhelper/Sequence/sodeps.pm b/perllib/Debian/Debhelper/Sequence/sodeps.pm
new file mode 100644
index 0000000..9ae6a03
--- /dev/null
+++ b/perllib/Debian/Debhelper/Sequence/sodeps.pm
@@ -0,0 +1,3 @@
+insert_after("dh_shlibdeps", "dh_sodeps");
+
+1;