2023-02-13 10:26:01 -07:00
|
|
|
#!/bin/bash
|
|
|
|
|
2023-04-29 06:43:54 -07:00
|
|
|
while (($# > 0)); do
|
|
|
|
case $1 in
|
|
|
|
--test) # install test dependencies
|
|
|
|
TEST=1
|
|
|
|
shift
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
2023-02-13 10:26:01 -07:00
|
|
|
os=$(uname -s)
|
|
|
|
if [[ $os == Linux ]]; then
|
2023-09-09 01:36:42 -07:00
|
|
|
sudo apt-get update
|
2023-11-04 14:38:25 -07:00
|
|
|
sudo apt-get install -y build-essential cmake curl gettext ninja-build
|
2023-10-08 14:05:23 -07:00
|
|
|
|
|
|
|
if [[ $CC == clang ]]; then
|
|
|
|
DEFAULT_CLANG_VERSION=$(echo | clang -dM -E - | grep __clang_major | awk '{print $3}')
|
2024-03-16 06:15:23 -07:00
|
|
|
CLANG_VERSION=18
|
2023-10-08 14:05:23 -07:00
|
|
|
if ((DEFAULT_CLANG_VERSION >= CLANG_VERSION)); then
|
|
|
|
echo "Default clang version is $DEFAULT_CLANG_VERSION, which equal or larger than wanted version $CLANG_VERSION. Aborting!"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
wget https://apt.llvm.org/llvm.sh
|
|
|
|
chmod +x llvm.sh
|
|
|
|
sudo ./llvm.sh $CLANG_VERSION
|
|
|
|
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-$CLANG_VERSION 100
|
|
|
|
sudo update-alternatives --set clang /usr/bin/clang-$CLANG_VERSION
|
|
|
|
fi
|
|
|
|
|
2023-04-29 06:43:54 -07:00
|
|
|
if [[ -n $TEST ]]; then
|
2024-02-07 04:28:35 -07:00
|
|
|
sudo apt-get install -y locales-all cpanminus attr libattr1-dev gdb fswatch
|
2024-03-29 05:20:43 -07:00
|
|
|
|
|
|
|
# Use default CC to avoid compilation problems when installing Python modules
|
|
|
|
CC=cc python3 -m pip -q install --user --upgrade pynvim
|
2023-04-29 06:43:54 -07:00
|
|
|
fi
|
2023-02-13 10:26:01 -07:00
|
|
|
elif [[ $os == Darwin ]]; then
|
|
|
|
brew update --quiet
|
2023-04-29 06:43:54 -07:00
|
|
|
brew install ninja
|
|
|
|
if [[ -n $TEST ]]; then
|
2024-02-07 04:28:35 -07:00
|
|
|
brew install cpanminus fswatch
|
2024-03-29 05:20:43 -07:00
|
|
|
|
|
|
|
# Use default CC to avoid compilation problems when installing Python modules
|
|
|
|
CC=cc python3 -m pip -q install --user --upgrade --break-system-packages pynvim
|
2023-04-29 06:43:54 -07:00
|
|
|
fi
|
2023-02-13 10:26:01 -07:00
|
|
|
fi
|