diff --git a/modules/ksb/Application.pm b/modules/ksb/Application.pm --- a/modules/ksb/Application.pm +++ b/modules/ksb/Application.pm @@ -2406,6 +2406,9 @@ sub _checkForEssentialBuildPrograms { my $ctx = assert_isa(shift, 'ksb::BuildContext'); + my $kdedir = $ctx->getOption('kdedir'); + my $qtdir = $ctx->getOption('qtdir'); + my @preferred_paths = ("$kdedir/bin", "$qtdir/bin"); return 1 if pretending(); @@ -2432,7 +2435,8 @@ cmake => 'CMake', ); - my $programPath = absPathToExecutable($prog); + my $preferredPath = absPathToExecutable2($prog, @preferred_paths); + my $programPath = $preferredPath || absPathToExecutable($prog); # qmake is not necessarily named 'qmake' if (!$programPath && $prog eq 'qmake') { @@ -2442,7 +2446,8 @@ if (!$programPath) { # Don't complain about Qt if we're building it... if ($prog eq 'qmake' && ( - grep { $_->buildSystemType() eq 'Qt' } (@buildModules)) || + grep { $_->buildSystemType() eq 'Qt' || + $_->buildSystemType() eq 'Qt5' } (@buildModules)) || pretending() ) { diff --git a/modules/ksb/Module.pm b/modules/ksb/Module.pm --- a/modules/ksb/Module.pm +++ b/modules/ksb/Module.pm @@ -642,11 +642,24 @@ my $self = assert_isa(shift, 'ksb::Module'); my $ctx = $self->buildContext(); my $kdedir = $self->getOption('kdedir'); + my $qtdir = $self->getOption('qtdir'); my $prefix = $self->installationPath(); # Add global set-envs and context $self->buildContext()->applyUserEnvironment(); + # Avoid moving /usr up in env vars + if ($qtdir ne '/usr') { + my @qt_pkg_config_dirs = ("$qtdir/lib/pkgconfig"); + $ctx->prependEnvironmentValue('PKG_CONFIG_PATH', @qt_pkg_config_dirs); + + my @qt_ld_dirs = ("$qtdir/lib"); + $ctx->prependEnvironmentValue('LD_LIBRARY_PATH', @qt_ld_dirs); + + my @qt_path = ("$qtdir/bin"); + $ctx->prependEnvironmentValue('PATH', @qt_path); + } + # Avoid moving /usr up in env vars if ($kdedir ne '/usr') { my @pkg_config_dirs = ("$kdedir/lib/pkgconfig"); diff --git a/modules/ksb/Util.pm b/modules/ksb/Util.pm --- a/modules/ksb/Util.pm +++ b/modules/ksb/Util.pm @@ -19,7 +19,7 @@ use Exporter qw(import); # Use Exporter's import method our @EXPORT = qw(list_has assert_isa assert_in any unique_items - absPathToExecutable + absPathToExecutable absPathToExecutable2 fileDigestMD5 log_command disable_locale_message_translation trimmed split_quoted_on_whitespace safe_unlink safe_system p_chdir @@ -48,11 +48,20 @@ { my $prog = shift; my @paths = split(/:/, $ENV{'PATH'}); + return absPathToExecutable2($prog, @paths); +} + +# Subroutine to return the path to the given executable based on the +# given paths. e.g. if you pass (make, foo, bar) you could get '/foo/make'. +# If the executable is not found undef is returned. +sub absPathToExecutable2 +{ + my $prog = shift; # If it starts with a / the path is already absolute. return $prog if $prog =~ /^\//; - for my $path (@paths) + for my $path (@_) { return "$path/$prog" if (-x "$path/$prog"); }