-
Notifications
You must be signed in to change notification settings - Fork 0
/
tools_lib.sh
executable file
·71 lines (62 loc) · 1.66 KB
/
tools_lib.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/bin/bash
INSTALL_PREFIX=${HOME}/Linux
DOWNLOAD_DIR=${HOME}/Repo/opensource
cmake_build() {
local cmake_args="-H. -Bbuild -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX} \
-DCMAKE_EXPORT_COMPILE_COMMANDS=YES"
cmake_args="$cmake_args $@"
cmake $cmake_args
cmake --build build -- -j5 && \
cmake --build build --target install
}
git_clone() {
if [ $# -eq 1 ]; then
repo=$(basename -- $1)
repo_name="${repo##*.}" # remove .git if exists
dst_dir=${DOWNLOAD_DIR}/${repo_name}/
else
dst_dir=$2/
fi
if [ -d ${dst_dir} ]; then
git -C ${dst_dir} pull
git -C ${dst_dir} submodule update --recursive
else
git clone --recurse-submodule -j5 https://github.com/$1 ${dst_dir}
fi
}
rtags_install() {
pushd .
git_clone "Andersbakken/rtags"
cd ${DOWNLOAD_DIR}/rtags
cmake_build -DBUILD_TESTING=OFF
popd
}
youcompleteme_install() {
pushd .
git_clone "Valloric/YouCompleteMe" "${HOME}/.vim/plugged/YouCompleteMe"
cd "${HOME}/.vim/plugged/YouCompleteMe"
./install.py --clang-completer
popd
}
powerline_fonts_install() {
pushd .
git_clone "powerline/fonts"
cd ${DOWNLOAD_DIR}/fonts
./install.sh
popd
}
cquery_install() {
pushd .
git_clone "cquery-project/cquery"
cd ${DOWNLOAD_DIR}/cquery
cmake_build
popd
}
urxvt_extensions() {
pushd .
mkdir -p $HOME/.urxvt/ext
wget -P $HOME/.urxvt/ext https://github.com/raw/majutsushi/urxvt-font-size/master/font-size
wget -P $HOME/.urxvt/ext https://github.com/raw/muennich/urxvt-perls/master/keyboard-select
popd
}