This is an extension to D15955, introducing dynamic determination of the clang builtin directory on Unix.
The builtin directory on typical Unix installs takes the for of /path/to/llvm-$clangMajor.0/lib/clang/$clangMajor.0.$clangMinor/include (e.g. /usr/lib/llvm-6.0/lib/clang/6.0.1/include for the offical LLVM packages for Debian/Ubuntu, or /opt/local/libexec/llvm-6.0/lib/clang/6.0.1/include for the MacPorts clang versions on Mac).
Minor version upgrades only change the penultimate path component. This patch updates the version in the hardcoded path to the version of the libclang actually used by dropping the last 2 components of the path and then adding the correct components.
This modification removes the need to rebuild all KDevelop packages to account for a single string change when a libclang update is pushed.
BUG: 402628