From 5876e997c9355c1a84d7c63fa034d069bc3eb3da Mon Sep 17 00:00:00 2001 From: Morgan Rockett Date: Mon, 1 Jul 2024 19:08:02 -0400 Subject: [PATCH] perf: changing clang and llvm to use distro version This commit made with the assistance of github copilot Signed-off-by: Morgan Rockett --- scripts/install-build-tools.sh | 52 ++++++++++++++++++---------------- 1 file changed, 28 insertions(+), 24 deletions(-) diff --git a/scripts/install-build-tools.sh b/scripts/install-build-tools.sh index 592e8929b..70993c015 100755 --- a/scripts/install-build-tools.sh +++ b/scripts/install-build-tools.sh @@ -15,35 +15,39 @@ if (( $EUID != 0 )); then fi if [[ "$OSTYPE" == "darwin"* ]]; then - CPUS=$(sysctl -n hw.ncpu) - # ensure development environment is set correctly for clang - $SUDO xcode-select -switch /Library/Developer/CommandLineTools - brew install llvm@14 googletest google-benchmark lcov make wget cmake curl - CLANG_TIDY=/usr/local/bin/clang-tidy - if [ ! -L "$CLANG_TIDY" ]; then - $SUDO ln -s $(brew --prefix)/opt/llvm@14/bin/clang-tidy /usr/local/bin/clang-tidy - fi - - GMAKE=/usr/local/bin/gmake - if [ ! -L "$GMAKE" ]; then - $SUDO ln -s $(xcode-select -p)/usr/bin/gnumake /usr/local/bin/gmake - fi + CPUS=$(sysctl -n hw.ncpu) + # ensure development environment is set correctly for clang + $SUDO xcode-select -switch /Library/Developer/CommandLineTools + brew install llvm googletest google-benchmark lcov make wget cmake curl + CLANG_TIDY=/usr/local/bin/clang-tidy + if [ ! -L "$CLANG_TIDY" ]; then + $SUDO ln -s $(brew --prefix)/opt/llvm/bin/clang-tidy /usr/local/bin/clang-tidy + fi + GMAKE=/usr/local/bin/gmake + if [ ! -L "$GMAKE" ]; then + $SUDO ln -s $(xcode-select -p)/usr/bin/gnumake /usr/local/bin/gmake + fi fi if [[ "$OSTYPE" == "linux-gnu"* ]]; then - $SUDO apt update - $SUDO apt install -y build-essential wget cmake libgtest-dev libbenchmark-dev lcov git software-properties-common rsync unzip - - wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | $SUDO apt-key add - - $SUDO add-apt-repository "deb http://apt.llvm.org/focal/ llvm-toolchain-focal-14 main" - $SUDO apt install -y clang-format-14 clang-tidy-14 - $SUDO ln -s -f $(which clang-format-14) /usr/local/bin/clang-format - $SUDO ln -s -f $(which clang-tidy-14) /usr/local/bin/clang-tidy + $SUDO apt update -y + $SUDO apt install -y build-essential wget cmake libgtest-dev libbenchmark-dev lcov git software-properties-common rsync unzip + + # Add LLVM GPG key (apt-key is deprecated in Ubuntu 21.04+ so using gpg) + wget -qO - https://apt.llvm.org/llvm-snapshot.gpg.key | \ + gpg --dearmor -o /usr/share/keyrings/llvm-archive-keyring.gpg + echo "deb [signed-by=/usr/share/keyrings/llvm-archive-keyring.gpg] http://apt.llvm.org/focal/ llvm-toolchain-focal main" | \ + $SUDO tee /etc/apt/sources.list.d/llvm.list + + $SUDO apt update -y + $SUDO apt install -y clang-format clang-tidy + $SUDO ln -sf $(which clang-format) /usr/local/bin/clang-format + $SUDO ln -sf $(which clang-tidy) /usr/local/bin/clang-tidy fi PYTHON_TIDY=/usr/local/bin/run-clang-tidy.py if [ ! -f "${PYTHON_TIDY}" ]; then - echo -e "${green}Copying run-clang-tidy to /usr/local/bin${end}" - wget https://raw.githubusercontent.com/llvm/llvm-project/e837ce2a32369b2e9e8e5d60270c072c7dd63827/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py - $SUDO mv run-clang-tidy.py /usr/local/bin + echo -e "${green}Copying run-clang-tidy to /usr/local/bin${end}" + wget https://raw.githubusercontent.com/llvm/llvm-project/main/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py + $SUDO mv run-clang-tidy.py /usr/local/bin fi