From 2e62dc7e15cee8fc881fc5306e42861ce02d912d Mon Sep 17 00:00:00 2001 From: Michael Pyne Date: Sat, 17 Sep 2016 15:46:53 -0400 Subject: [PATCH] Point CMake to Qt's cmake module directory if different from KF5's I still need to fix kdesrc-build-setup though. :( CCBUG:368070 --- modules/ksb/BuildSystem.pm | 16 ++++++---------- modules/ksb/BuildSystem/KDE4.pm | 23 +++++++++++++++++------ modules/ksb/Module.pm | 30 ++++-------------------------- modules/ksb/l10nSystem.pm | 6 ++++-- 4 files changed, 31 insertions(+), 44 deletions(-) diff --git a/modules/ksb/BuildSystem.pm b/modules/ksb/BuildSystem.pm index 7532d3b..cb9c602 100644 --- a/modules/ksb/BuildSystem.pm +++ b/modules/ksb/BuildSystem.pm @@ -1,4 +1,4 @@ -package ksb::BuildSystem; +package ksb::BuildSystem 0.30; # Base module for the various build systems, includes built-in implementations of # generic functions and supports hooks for subclasses to provide needed detailed @@ -8,8 +8,6 @@ use strict; use warnings; use 5.014; -our $VERSION = '0.20'; - use ksb::Debug; use ksb::Util; use ksb::StatusView; @@ -101,14 +99,12 @@ sub isProgressOutputSupported return 0; } -# If this method returns a non-empty string, then that string is the name -# of an environment variable to prepend the module's installation prefix -# path to. Mostly a hack, but will have to do until there's a better scheme -# for giving integration points for build systems into the actual build -# process. -sub prefixEnvironmentVariable +# Called by the module being built before it runs its build/install process. Should +# setup any needed environment variables, build context settings, etc., in preparation +# for the build and install phases. +sub prepareModuleBuildEnvironment { - return undef; + my ($self, $ctx, $module, $prefix) = @_; } # Returns true if the module should have make install run in order to be diff --git a/modules/ksb/BuildSystem/KDE4.pm b/modules/ksb/BuildSystem/KDE4.pm index c139460..80e087e 100644 --- a/modules/ksb/BuildSystem/KDE4.pm +++ b/modules/ksb/BuildSystem/KDE4.pm @@ -1,4 +1,4 @@ -package ksb::BuildSystem::KDE4; +package ksb::BuildSystem::KDE4 0.20; # Class responsible for building KDE4 CMake-based modules. @@ -6,11 +6,10 @@ use strict; use warnings; use 5.014; -our $VERSION = '0.10'; - use ksb::Debug; use ksb::Util; -use ksb::BuildSystem; +use ksb::BuildContext 0.30; +use ksb::BuildSystem 0.30; our @ISA = ('ksb::BuildSystem'); @@ -32,9 +31,21 @@ sub isProgressOutputSupported return 1; } -sub prefixEnvironmentVariable +# Called by the module being built before it runs its build/install process. Should +# setup any needed environment variables, build context settings, etc., in preparation +# for the build and install phases. +sub prepareModuleBuildEnvironment { - return 'CMAKE_PREFIX_PATH'; + my ($self, $ctx, $module, $prefix) = @_; + + $ctx->prependEnvironmentValue('CMAKE_PREFIX_PATH', $prefix); + $ctx->prependEnvironmentValue('XDG_DATA_DIRS', "$prefix/share"); + + my $qtdir = $module->getOption('qtdir'); + if ($qtdir && $qtdir ne $prefix) { + # Ensure we can find Qt5's own CMake modules + $ctx->prependEnvironmentValue('CMAKE_MODULE_PATH', "$qtdir/lib/cmake"); + } } sub requiredPrograms diff --git a/modules/ksb/Module.pm b/modules/ksb/Module.pm index 57ecd63..bccea08 100644 --- a/modules/ksb/Module.pm +++ b/modules/ksb/Module.pm @@ -26,7 +26,7 @@ use ksb::Updater::KDEProjectMetadata; use ksb::BuildException 0.20; -use ksb::BuildSystem; +use ksb::BuildSystem 0.30; use ksb::BuildSystem::Autotools; use ksb::BuildSystem::QMake; use ksb::BuildSystem::Qt4; @@ -661,17 +661,10 @@ sub setupEnvironment my @ld_dirs = ("$kdedir/lib", "$qtdir/lib", $self->getOption('libpath')); $ctx->prependEnvironmentValue('LD_LIBRARY_PATH', @ld_dirs); - # Needed to find installed resources for KF5. - # TODO: Make this an integration point for the BuildSystem interface. - $ctx->prependEnvironmentValue('XDG_DATA_DIRS', "$kdedir/share"); + my $buildSystem = $self->buildSystem(); + $buildSystem->prepareModuleBuildEnvironment($ctx, $self, $prefix); my @path = ("$kdedir/bin", "$qtdir/bin", $self->getOption('binpath')); - - if (my $prefixEnvVar = $self->buildSystem()->prefixEnvironmentVariable()) - { - $ctx->prependEnvironmentValue($prefixEnvVar, $prefix); - } - $ctx->prependEnvironmentValue('PATH', @path); # Set up the children's environment. We use queueEnvironmentVariable since @@ -680,23 +673,8 @@ sub setupEnvironment $ctx->queueEnvironmentVariable('QTDIR', $qtdir); - # If the module isn't kdelibs, also append kdelibs's KDEDIR setting. - if ($self->name() ne 'kdelibs') - { - my $kdelibsModule = $ctx->lookupModule('kdelibs'); - my $kdelibsDir; - $kdelibsDir = $kdelibsModule->installationPath() if $kdelibsModule; - - if ($kdelibsDir && $kdelibsDir ne $kdedir) { - whisper ("Module $self uses different KDEDIR than kdelibs, including kdelibs as well."); - $kdedir .= ":$kdelibsDir" - } - } - - $ctx->queueEnvironmentVariable('KDEDIRS', $kdedir); - # Read in user environment defines - $self->applyUserEnvironment() unless $self->name() eq 'global'; + $self->applyUserEnvironment() unless $self == $ctx; } # Returns the path to the log directory used during this run for this diff --git a/modules/ksb/l10nSystem.pm b/modules/ksb/l10nSystem.pm index dd8bd18..3725c10 100644 --- a/modules/ksb/l10nSystem.pm +++ b/modules/ksb/l10nSystem.pm @@ -58,9 +58,11 @@ sub isSubdirBuildable return ($subdir ne 'scripts' && $subdir ne 'templates'); } -sub prefixEnvironmentVariable +sub prepareModuleBuildEnvironment { - return 'CMAKE_PREFIX_PATH'; + my ($ctx, $module, $prefix) = @_; + + $ctx->prependEnvironmentValue('CMAKE_PREFIX_PATH', $prefix); } # scm-specific update procedure.