From 67edf6e7be8ce7450a88ceada3152beeb9da05cd Mon Sep 17 00:00:00 2001 From: Michael Pyne Date: Sun, 25 Nov 2012 13:35:39 -0500 Subject: [PATCH] modularize: Move CMakeBootstrapSystem to separate file. --- kdesrc-build | 53 ++--------------------- modules/ksb/BuildSystem/CMakeBootstrap.pm | 47 ++++++++++++++++++++ 2 files changed, 50 insertions(+), 50 deletions(-) create mode 100644 modules/ksb/BuildSystem/CMakeBootstrap.pm diff --git a/kdesrc-build b/kdesrc-build index b066a62..5a178e7 100755 --- a/kdesrc-build +++ b/kdesrc-build @@ -927,54 +927,6 @@ EOM } # }}} -# package CMakeBootstrapSystem {{{ -{ - package CMakeBootstrapSystem; - - # This is a module used to do only one thing: Bootstrap CMake onto a system - # that doesn't have it, or has only an older version of it. - - use ksb::Debug; - use ksb::Util; - use ksb::BuildSystem; - - our @ISA = ('ksb::BuildSystem'); - - sub name - { - return 'cmake-bootstrap'; - } - - sub requiredPrograms - { - return qw{c++}; - } - - # Return value style: boolean - sub configureInternal - { - my $self = assert_isa(shift, 'CMakeBootstrapSystem'); - my $module = $self->module(); - my $sourcedir = $module->fullpath('source'); - my $installdir = $module->installationPath(); - - # 'module'-limited option grabbing can return undef, so use // - # to convert to empty string in that case. - my @bootstrapOptions = split_quoted_on_whitespace( - $module->getOption('configure-flags', 'module') // ''); - - p_chdir($module->fullpath('build')); - - return log_command($module, 'cmake-bootstrap', [ - "$sourcedir/bootstrap", "--prefix=$installdir", - @bootstrapOptions - ]) == 0; - } - - 1; -} -# }}} - # package l10nSystem {{{ { package l10nSystem; @@ -1420,6 +1372,7 @@ EOF use ksb::BuildSystem; use ksb::BuildSystem::Autotools; use ksb::BuildSystem::QMake; + use ksb::BuildSystem::CMakeBootstrap; use Storable 'dclone'; use Carp 'confess'; @@ -1640,7 +1593,7 @@ EOF when('qmake') { $buildSystem = ksb::BuildSystem::QMake->new($self); } when('cmake-bootstrap') - { $buildSystem = CMakeBootstrapSystem -> new($self); } + { $buildSystem = ksb::BuildSystem::CMakeBootstrap->new($self); } when('kde') { $buildSystem = KDEBuildSystem -> new($self); } when('qt') @@ -1683,7 +1636,7 @@ EOF if (!$buildType && (-e "$sourceDir/CMakeLists.txt") && (-e "$sourceDir/bootstrap")) { - $buildType = CMakeBootstrapSystem->new($self); + $buildType = ksb::BuildSystem::CMakeBootstrap->new($self); } if (!$buildType && (-e "$sourceDir/CMakeLists.txt" || diff --git a/modules/ksb/BuildSystem/CMakeBootstrap.pm b/modules/ksb/BuildSystem/CMakeBootstrap.pm new file mode 100644 index 0000000..e3683d3 --- /dev/null +++ b/modules/ksb/BuildSystem/CMakeBootstrap.pm @@ -0,0 +1,47 @@ +package ksb::BuildSystem::CMakeBootstrap; + +# This is a module used to do only one thing: Bootstrap CMake onto a system +# that doesn't have it, or has only an older version of it. + +use strict; +use warnings; +use v5.10; + +use ksb::Debug; +use ksb::Util; +use ksb::BuildSystem; + +our @ISA = ('ksb::BuildSystem'); + +sub name +{ + return 'cmake-bootstrap'; +} + +sub requiredPrograms +{ + return qw{c++}; +} + +# Return value style: boolean +sub configureInternal +{ + my $self = assert_isa(shift, 'ksb::BuildSystem::CMakeBootstrap'); + my $module = $self->module(); + my $sourcedir = $module->fullpath('source'); + my $installdir = $module->installationPath(); + + # 'module'-limited option grabbing can return undef, so use // + # to convert to empty string in that case. + my @bootstrapOptions = split_quoted_on_whitespace( + $module->getOption('configure-flags', 'module') // ''); + + p_chdir($module->fullpath('build')); + + return log_command($module, 'cmake-bootstrap', [ + "$sourcedir/bootstrap", "--prefix=$installdir", + @bootstrapOptions + ]) == 0; +} + +1;