-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild_neovim.sh
executable file
·58 lines (48 loc) · 1.72 KB
/
build_neovim.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
#!/usr/bin/env bash
# Prerequisites, according to
# https://github.com/neovim/neovim/wiki/Building-Neovim#build-prerequisites
#
# Ubuntu/Debian:
# sudo apt-get install ninja-build gettext libtool libtool-bin autoconf automake cmake g++ pkg-config unzip
#
# macOS:
# brew install ninja libtool automake cmake pkg-config gettext
software_name="neovim"
git_uri="https://github.com/neovim/neovim.git"
this_script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
source ${this_script_dir}/_utils/build_helper_functions.sh
init_build_script
get_default__nr_cpus
get_default__clone_dir
get_default__repo_dir ${software_name}
get_default__install_dir ${software_name}
get_default__git_tag
print_help_additional_options() {
:
}
print_help_additional_options_description() {
:
}
while getopts ":s:t:T:j:Ch" opt; do
case ${opt} in
s) clone_dir=$OPTARG ;;
t) install_dir=$OPTARG ;;
T) git_tag=$OPTARG; echo "Using git_tag=${git_tag}" ;;
j) nr_cpus=$OPTARG ;;
C) opt_clean_install_dir=1 ;;
h) print_help; exit 0 ;;
:) echo "Option -$OPTARG requires an argument."; arg_err=1 ;;
\?) echo "Invalid option -$OPTARG"; arg_err=1 ;;
esac
done
[[ -z "$clone_dir" ]] && { echo "Missing option -s"; arg_err=1; }
[[ -z "$install_dir" ]] && { echo "Missing option -t"; arg_err=1; }
[[ ! -z "$arg_err" ]] && { print_help; exit 1; }
repo_dir=${clone_dir}/${software_name}
check_variables
clone_or_update_repo ${git_uri} ${repo_dir} ${git_tag}
# Compile and install
cd ${repo_dir}
make CMAKE_BUILD_TYPE=Release CMAKE_EXTRA_FLAGS="-DCMAKE_INSTALL_PREFIX=${install_dir}"
[[ ! -z "${opt_clean_install_dir}" ]] && clean_install_dir ${install_dir}
make install || { echo "Attempting superuser installation"; sudo make install; }