Updates scripts for LLVM/Clang versions that are double digits #2386
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
TL;DR:
Version additions for LLVM/CLANG + fix typo. Should be low impact.
Overview:
eng/build.sh
amd64
for intel/amd 64bit from theuname
command issued.$lowerI
appears to be left over from when some of the scripts were consolidated and a new function was made to lowercase thingseng/common/native/find-native-compiler.sh
eng/gen-buildsys-clang.sh
find-native-compiler.sh
Unnecessarily detailed stackexchange-like explanation:
uname
does not have many POSIX compliant options that can be passed to it. So trying to make the script use only POSIX complaintuname
options and understand what is returned by them would be too much of a hassle; output can be different from Linux distro to distro and even stranger outside the world of Linux even if the sameuname -option
is passed! The script tries to work around quirks in different Linux distros as it is. A simple|amd64
is added to thex86_64
case to cover how FreeBSD returns theuname
issued to it.Before the changes noted above, the script would work under most environments without issue unless someone tried to pass
-clangx.y
. This would fail as$lowerI
evaluated to, um, empty string(?)...empty variable(?)... NULL(?). Fallback would usecommand -v clang
and this is the compiler that ships with the base OS for most BSD-like (and the odd linux distro). This is unacceptable on FreeBSD (and likely other BSD) as the compiler that ships with the OS is for the OS and not for the user. The update also handles cases likeclang11
orclang-11
but the user still must use-clangx.y
(e.g.,-clang11.0
). The fallback is maintained as this behavior was there originally and is likely acceptable on other OSes. The detection of newer non-dotted (typically double digit) LLVM/CLANG are placed at the end of the if/else block to respect preference for dotted revision LLVM/CLANG (e.g., 3.8, 3.9)Finally, this does not fix actually building FOR FreeBSD as I thought it would be cleaner to separate the detection code from the FreeBSD work. That will, hopefully, be coming later.