summaryrefslogtreecommitdiff
path: root/Debian/Debhelper/Buildsystem
diff options
context:
space:
mode:
authorJoey Hess <joey@gnu.kitenet.net>2010-01-27 17:08:15 -0500
committerJoey Hess <joey@gnu.kitenet.net>2010-01-27 17:08:15 -0500
commitc7cc73a586743aa6b523e1d4ccbef59c65dc68c3 (patch)
treec76476f8cac04666f5981072c86bb9aa859bcf96 /Debian/Debhelper/Buildsystem
parent9ddfafa251e8f16b53855617fcd01b5b19eb22fd (diff)
qmake: New buildsystem contributed by Kel Modderman. Closes: #566840
Diffstat (limited to 'Debian/Debhelper/Buildsystem')
-rw-r--r--Debian/Debhelper/Buildsystem/qmake.pm80
1 files changed, 80 insertions, 0 deletions
diff --git a/Debian/Debhelper/Buildsystem/qmake.pm b/Debian/Debhelper/Buildsystem/qmake.pm
new file mode 100644
index 0000000..823a70e
--- /dev/null
+++ b/Debian/Debhelper/Buildsystem/qmake.pm
@@ -0,0 +1,80 @@
+# A debhelper build system class for Qt projects
+# (based on the makefile class).
+#
+# Copyright: © 2010 Kelvin Modderman
+# License: GPL-2+
+
+package Debian::Debhelper::Buildsystem::qmake;
+
+use strict;
+use warnings;
+use Debian::Debhelper::Dh_Lib qw(error);
+use base 'Debian::Debhelper::Buildsystem::makefile';
+
+sub DESCRIPTION {
+ "qmake (*.pro)";
+}
+
+sub check_auto_buildable {
+ my $this=shift;
+ my @projects=glob($this->get_sourcepath('*.pro'));
+ my $ret=0;
+
+ if (@projects > 0 && -e $projects[0]) {
+ $ret=1;
+ # Existence of a Makefile generated by qmake indicates qmake
+ # class has already been used by a prior build step, so should
+ # be used instead of the parent makefile class.
+ my $mf=$this->get_buildpath("Makefile");
+ if (-e $mf) {
+ $ret = $this->SUPER::check_auto_buildable(@_);
+ open(my $fh, '<', $mf)
+ or error("unable to open Makefile: $mf");
+ while(<$fh>) {
+ if (m/^# Generated by qmake/i) {
+ $ret++;
+ last;
+ }
+ }
+ close($fh);
+ }
+ }
+
+ return $ret;
+}
+
+sub configure {
+ my $this=shift;
+ my @options;
+ my @flags;
+
+ push @options, '-makefile';
+ push @options, '-nocache';
+
+ if ($ENV{CFLAGS}) {
+ push @flags, "QMAKE_CFLAGS_RELEASE=$ENV{CFLAGS}";
+ push @flags, "QMAKE_CFLAGS_DEBUG=$ENV{CFLAGS}";
+ }
+ if ($ENV{CXXFLAGS}) {
+ push @flags, "QMAKE_CXXFLAGS_RELEASE=$ENV{CXXFLAGS}";
+ push @flags, "QMAKE_CXXFLAGS_DEBUG=$ENV{CXXFLAGS}";
+ }
+ if ($ENV{LDFLAGS}) {
+ push @flags, "QMAKE_LFLAGS_RELEASE=$ENV{LDFLAGS}";
+ push @flags, "QMAKE_LFLAGS_DEBUG=$ENV{LDFLAGS}";
+ }
+ push @flags, "QMAKE_STRIP=:";
+
+ $this->doit_in_builddir('qmake', @options, @flags, @_);
+}
+
+sub install {
+ my $this=shift;
+ my $destdir=shift;
+
+ # qmake generated Makefiles use INSTALL_ROOT in install target
+ # where one would expect DESTDIR to be used.
+ $this->SUPER::install($destdir, "INSTALL_ROOT=$destdir", @_);
+}
+
+1;