modularize: Move QtBuildSystem to separate file.

ksb::BuildSystem::Qt4, to allow for Qt5 support to be added.

Tested by building Qt4 from git.
wilder
Michael Pyne 13 years ago
parent d91a0e0bc8
commit e857805802
  1. 102
      kdesrc-build
  2. 98
      modules/ksb/BuildSystem/Qt4.pm

@ -1258,103 +1258,6 @@ EOM
}
# }}}
# package QtBuildSystem {{{
{
package QtBuildSystem;
use ksb::Debug;
use ksb::Util;
use ksb::BuildSystem;
our @ISA = ('ksb::BuildSystem');
sub needsInstalled
{
my $self = assert_isa(shift, 'QtBuildSystem');
my $module = $self->module();
return $module->getOption('qtdir') ne $module->fullpath('build');
}
sub name
{
return 'Qt';
}
# If coming from gitorious.org instead of KDE's mirror we should force on
# progress output to work around a gitorious.org clone bug.
sub forceProgressOutput
{
my $self = assert_isa(shift, 'QtBuildSystem');
my $module = $self->module();
return $module->getOption('repository') =~ /gitorious\.org\//;
}
# Return value style: boolean
sub configureInternal
{
my $self = assert_isa(shift, 'QtBuildSystem');
my $module = $self->module();
my $srcdir = $module->fullpath('source');
my $script = "$srcdir/configure";
if (! -e $script && !pretending())
{
error ("\tMissing configure script for r[b[$module]");
return 0;
}
my @commands = split (/\s+/, $module->getOption('configure-flags'));
push @commands, '-confirm-license', '-opensource';
# Get the user's CXXFLAGS
my $cxxflags = $module->getOption('cxxflags');
$module->buildContext()->queueEnvironmentVariable('CXXFLAGS', $cxxflags);
my $prefix = $module->getOption('qtdir');
# Some users have added -prefix manually to their flags, they
# probably shouldn't anymore. :)
if (scalar grep /^-prefix(=.*)?$/, @commands)
{
warning (<<EOF);
b[y[*]
b[y[*] You have the y[-prefix] option selected in your $module configure flags.
b[y[*] kdesrc-build will correctly add the -prefix option to match your Qt
b[y[*] directory setting, so you do not need to use -prefix yourself.
b[y[*]
EOF
}
push @commands, "-prefix", $prefix;
unshift @commands, $script;
my $builddir = $module->fullpath('build');
my $old_flags = $module->getPersistentOption('last-configure-flags') || '';
my $cur_flags = main::get_list_digest(@commands);
if(($cur_flags ne $old_flags) ||
($module->getOption('reconfigure')) ||
(! -e "$builddir/Makefile")
)
{
note ("\tb[r[LGPL license selected for Qt]. See $srcdir/LICENSE.LGPL");
info ("\tRunning g[configure]...");
$module->setPersistentOption('last-configure-flags', $cur_flags);
return log_command($module, "configure", \@commands) == 0;
}
# Skip execution of configure.
return 1;
}
1;
}
# }}}
# package Module {{{
{
package Module;
@ -1372,6 +1275,7 @@ EOF
use ksb::BuildSystem;
use ksb::BuildSystem::Autotools;
use ksb::BuildSystem::QMake;
use ksb::BuildSystem::Qt4;
use ksb::BuildSystem::CMakeBootstrap;
use Storable 'dclone';
@ -1590,7 +1494,7 @@ EOF
'qmake' => 'ksb::BuildSystem::QMake',
'cmake-bootstrap' => 'ksb::BuildSystem::CMakeBootstrap',
'kde' => 'KDEBuildSystem',
'qt' => 'QtBuildSystem',
'qt' => 'ksb::BuildSystem::Qt4',
'autotools' => 'ksb::BuildSystem::Autotools',
);
@ -1622,7 +1526,7 @@ EOF
($self->getOption('repository') =~ /^kde:qt$/) ||
(-e "$sourceDir/bin/syncqt"))
{
$buildType = QtBuildSystem->new($self);
$buildType = ksb::BuildSystem::Qt4->new($self);
}
# This test must come before KDEBuildSystem as cmake's own bootstrap

@ -0,0 +1,98 @@
package ksb::BuildSystem::Qt4;
# Build system for the Qt4 toolkit
use strict;
use warnings;
use v5.10;
use ksb::Debug;
use ksb::Util;
use ksb::BuildSystem;
our @ISA = ('ksb::BuildSystem');
sub needsInstalled
{
my $self = assert_isa(shift, 'ksb::BuildSystem::Qt4');
my $module = $self->module();
return $module->getOption('qtdir') ne $module->fullpath('build');
}
sub name
{
return 'Qt';
}
# If coming from gitorious.org instead of KDE's mirror we should force on
# progress output to work around a gitorious.org clone bug.
sub forceProgressOutput
{
my $self = assert_isa(shift, 'ksb::BuildSystem::Qt4');
my $module = $self->module();
return $module->getOption('repository') =~ /gitorious\.org\//;
}
# Return value style: boolean
sub configureInternal
{
my $self = assert_isa(shift, 'ksb::BuildSystem::Qt4');
my $module = $self->module();
my $srcdir = $module->fullpath('source');
my $script = "$srcdir/configure";
if (! -e $script && !pretending())
{
error ("\tMissing configure script for r[b[$module]");
return 0;
}
my @commands = split (/\s+/, $module->getOption('configure-flags'));
push @commands, '-confirm-license', '-opensource';
# Get the user's CXXFLAGS
my $cxxflags = $module->getOption('cxxflags');
$module->buildContext()->queueEnvironmentVariable('CXXFLAGS', $cxxflags);
my $prefix = $module->getOption('qtdir');
# Some users have added -prefix manually to their flags, they
# probably shouldn't anymore. :)
if (scalar grep /^-prefix(=.*)?$/, @commands)
{
warning (<<EOF);
b[y[*]
b[y[*] You have the y[-prefix] option selected in your $module configure flags.
b[y[*] kdesrc-build will correctly add the -prefix option to match your Qt
b[y[*] directory setting, so you do not need to use -prefix yourself.
b[y[*]
EOF
}
push @commands, "-prefix", $prefix;
unshift @commands, $script;
my $builddir = $module->fullpath('build');
my $old_flags = $module->getPersistentOption('last-configure-flags') || '';
my $cur_flags = main::get_list_digest(@commands);
if(($cur_flags ne $old_flags) ||
($module->getOption('reconfigure')) ||
(! -e "$builddir/Makefile")
)
{
note ("\tb[r[LGPL license selected for Qt]. See $srcdir/LICENSE.LGPL");
info ("\tRunning g[configure]...");
$module->setPersistentOption('last-configure-flags', $cur_flags);
return log_command($module, "configure", \@commands) == 0;
}
# Skip execution of configure.
return 1;
}
1;
Loading…
Cancel
Save