Ignore system standard path when prepending environment variables
ClosedPublic

Authored by romangg on May 7 2018, 3:20 PM.

Details

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.

Diff Detail

Repository
R365 kdesrc-build
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
romangg requested review of this revision.May 7 2018, 3:20 PM
romangg created this revision.
mpyne accepted this revision.May 9 2018, 11:59 PM

Looks good to me, but do you know if there are any other directories we'd need to check (on Unixy systems) besides /usr?

This revision is now accepted and ready to land.May 9 2018, 11:59 PM

Looks good to me, but do you know if there are any other directories we'd need to check (on Unixy systems) besides /usr?

Maybe /usr/local, but I am not sure if this is searched by default for all environment variables affected here. By the way I noticed that https://phabricator.kde.org/source/kdesrc-build/browse/master/sample-kde-env-master.sh;ac5cc6f1ba4c86770299cbe23bb6e61183071f65$79 already does something similar (also only with /usr). Therefore I would push it as it is now (plus a small comment) and if need be one can later readdress the /usr/local case.

OK thanks. Please commit whenever you're ready.

This revision was automatically updated to reflect the committed changes.