[New] Use Clang as C/C++ compiler if we detected it, close #902#1300
[New] Use Clang as C/C++ compiler if we detected it, close #902#1300ljharb merged 3 commits intonvm-sh:masterfrom
Conversation
|
Looks like we need clang v3.5+ |
|
Looks like clang version output may have different format: Ubuntu 14.04: Ubuntu 15.04: Ubuntu 16.04: FreeBSD 10.3: ArchLinux: Debian 8.6: |
05b0bc7 to
7e9e2ca
Compare
| - clang --version | ||
| - clang++ --version | ||
| - if [ -n "${SHELLCHECK-}" ]; then sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 575159689BEFB442 && echo 'deb http://download.fpcomplete.com/ubuntu precise main' | sudo tee /etc/apt/sources.list.d/fpco.list && sudo apt-get update && sudo apt-get install stack bc -y && stack setup && stack install ShellCheck && shellcheck --version ; fi | ||
| - if [ -z "${SHELLCHECK-}" ]; then wget -O - http://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - && echo -e "deb http://apt.llvm.org/precise/ llvm-toolchain-precise main\ndeb http://apt.llvm.org/precise/ llvm-toolchain-precise-3.8 main" | sudo tee /etc/apt/sources.list.d/clang.list && sudo apt-get update && sudo apt-get install clang-3.8 lldb-3.8 -y --force-yes && sudo ln -sf /usr/bin/clang-3.8 /usr/bin/clang && sudo ln -sf /usr/bin/clang++-3.8 /usr/bin/clang++ && clang --version ; fi |
There was a problem hiding this comment.
are these not things that can be installed by travis in the "addons: apt" section above?
There was a problem hiding this comment.
clang in Ubuntu 12.04 is too old ( < v3.5)
There was a problem hiding this comment.
Will this installation process be cached, like the shellcheck build is?
There was a problem hiding this comment.
I don't think so, do we have cache on the apt packages?
There was a problem hiding this comment.
There was a problem hiding this comment.
I think this only cache the ~/.stack, not the package in system level, am I right?
There was a problem hiding this comment.
The shellcheck build is very very slow, and once the first one was built, it didn't need to be rebuilt on successive builds.
I want to ensure that we don't need to build clang more than the once.
There was a problem hiding this comment.
We install clang from binary, no build needed.
There was a problem hiding this comment.
ah ok, that's good. is caching the download worth it?
There was a problem hiding this comment.
I don't think so, as the time will be mainly used to solve the dependencies, not on the package downloading.
| fi | ||
| } | ||
|
|
||
| nvm_clang_version() { |
There was a problem hiding this comment.
let's add some unit tests for this
There was a problem hiding this comment.
@ljharb where should I put the test script? Thanks.
| elif [ "${NVM_OS}" = 'aix' ]; then | ||
| make='gmake' | ||
| fi | ||
| if nvm_has "clang++" && nvm_has "clang" && nvm_version_greater_than_or_equal_to nvm_clang_version 3.5 ; then |
There was a problem hiding this comment.
are both clang and clang++ needed?
There was a problem hiding this comment.
e96cd9b to
f6d8f04
Compare
|
@ljharb I think we are good to go now 😄 |
f6d8f04 to
a6f95db
Compare
[New] `nvm install -s`: Use clang as C/C++ compiler if detected Fixes nvm-sh#902
Fixes #902.