Ignore system standard path when prepending environment variables

Summary:
Ignore /usr as prefix or kdedir when prepending environment variables to not
overrule user setting of PKG_CONFIG_PATH.

For me it was enough to fix my build with prepending CMAKE_PREFIX_PATH
conditionally, but in theory the other environment variables should also only
be prepended if it is not /usr to prepend.

Test Plan:
Compiled XCB 1.13 to /opt/xcb and have XCB 1.11 in /usr/.... Set
PKG_CONFIG_PATH to /opt/xcb/lib/pkgconfig.

Without this patch CMake, called by kdesrc-build, finds XCB 1.11 in
/usr/lib/x86_64-linux-gnu according to its log, but sets as version number
1.13 for some reason.

On make this fails. It still uses the lib from /opt/xcb> but does not include
the correct headers in opt/xcb/include.

With the patch CMake directly finds the lib in /opt/xcb and build succeeds.

Reviewers: bshah, mpyne

Reviewed By: mpyne

Subscribers:

Tags:

Differential Revision: https://phabricator.kde.org/D12739
wilder^2
Roman Gilg 8 years ago
parent ac5cc6f1ba
commit 9d977859e2
  1. 7
      modules/ksb/BuildSystem/KDE4.pm
  2. 15
      modules/ksb/Module.pm

@ -32,8 +32,11 @@ sub prepareModuleBuildEnvironment
{
my ($self, $ctx, $module, $prefix) = @_;
$ctx->prependEnvironmentValue('CMAKE_PREFIX_PATH', $prefix);
$ctx->prependEnvironmentValue('XDG_DATA_DIRS', "$prefix/share");
# Avoid moving /usr up in env vars
if ($prefix ne '/usr') {
$ctx->prependEnvironmentValue('CMAKE_PREFIX_PATH', $prefix);
$ctx->prependEnvironmentValue('XDG_DATA_DIRS', "$prefix/share");
}
my $qtdir = $module->getOption('qtdir');
if ($qtdir && $qtdir ne $prefix) {

@ -657,14 +657,17 @@ sub setupEnvironment
# Add global set-envs and context
$self->buildContext()->applyUserEnvironment();
my @pkg_config_dirs = ("$kdedir/lib/pkgconfig");
$ctx->prependEnvironmentValue('PKG_CONFIG_PATH', @pkg_config_dirs);
# Avoid moving /usr up in env vars
if ($kdedir ne '/usr') {
my @pkg_config_dirs = ("$kdedir/lib/pkgconfig");
$ctx->prependEnvironmentValue('PKG_CONFIG_PATH', @pkg_config_dirs);
my @ld_dirs = ("$kdedir/lib", $self->getOption('libpath'));
$ctx->prependEnvironmentValue('LD_LIBRARY_PATH', @ld_dirs);
my @ld_dirs = ("$kdedir/lib", $self->getOption('libpath'));
$ctx->prependEnvironmentValue('LD_LIBRARY_PATH', @ld_dirs);
my @path = ("$kdedir/bin", $self->getOption('binpath'));
$ctx->prependEnvironmentValue('PATH', @path);
my @path = ("$kdedir/bin", $self->getOption('binpath'));
$ctx->prependEnvironmentValue('PATH', @path);
}
# Build system's environment injection
my $buildSystem = $self->buildSystem();

Loading…
Cancel
Save