-
Notifications
You must be signed in to change notification settings - Fork 0
/
vim-install.sh
executable file
·145 lines (116 loc) · 2.63 KB
/
vim-install.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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
#! /bin/bash
set -e
set -o pipefail
# -- Compiled by Name --
MYNAME="Jack Guo"
# -- Git --
REPO=https://github.com/vim/vim.git
# Version to checkout
# vim's master branch isn't too stable so its good use a known working version
VER=master
# Install to a system directory rather than ~/.local so theres no broken
# vim installations left over when moving distros while keeping /home
INSTALL_PREFIX=/usr/local/guoj-vim
# -- Compilation --
# Do some optimization for fun and maybe get a bit of extra speed
export CFLAGS="-Ofast -march=native"
CONFIG_OPTS=(
--enable-pythoninterp=no
--enable-python3interp=yes
--enable-perlinterp=yes
#--enable-luainterp=yes
#--enable-rubyinterp=yes
#--with-lua-prefix=/usr/local
--enable-cscope
--enable-autoservername
--enable-terminal
#--enable-gui=gtk3
#--enable-gtk3-check
--disable-gtktest
--with-features=huge
--with-x
--enable-fontset
--enable-multibyte
--enable-largefile
--with-compiledby="$MYNAME"
--enable-fail-if-missing
--prefix="$INSTALL_PREFIX"
)
UBUNTU_APT_PKGS=(
#lua5.1
#liblua5.1-0-dev
libperl-dev
#libpython-dev
libpython3-dev
python3-dev
python3-distutils
libx11-dev libxpm-dev libxt-dev
libtinfo-dev
)
do_git_clone() {
git clone "$REPO" vim
}
do_git_checkout() {
# Ensure all recent versions are here
git pull
git checkout "$VER"
}
do_apt_packages() {
sudo apt install "${UBUNTU_APT_PKGS[@]}"
}
do_configure() {
make clean distclean
./configure "${CONFIG_OPTS[@]}"
}
do_compile() {
make clean
make -j$(nproc)
}
do_install() {
echo "Installing..."
sudo make install
# Create some symlinks to .local
rm -f "$HOME/.local/bin/vim"
ln -s "$INSTALL_PREFIX/bin/vim" "$HOME/.local/bin/vim"
rm -f "$HOME/.local/bin/vimdiff"
ln -s "$INSTALL_PREFIX/bin/vimdiff" "$HOME/.local/bin/vimdiff"
}
do_clean() {
echo "Cleaning..."
make clean distclean || true
}
yn_prompt() {
local MESSAGE yn
MESSAGE="$1"
read -p "$MESSAGE" yn
if [ "$yn" = y ]; then
return 0
fi
return 1
}
if [ -d vim ]; then
cd vim
fi
if [ ! -f vim.h ] && [ ! -f src/vim.h ]; then
if yn_prompt "Clone Repository into folder: $PWD/vim [y/n]?"; then
do_git_clone
cd vim
else
echo "No repo available... exiting"
exit 1
fi
fi
if [ ! -f vim.h ]; then
cd src
fi
do_git_checkout
echo -e "The following apt packages are recommended for Ubuntu: ${UBUNTU_APT_PKGS[*]}\n"
if yn_prompt "install them [y/n]?"; then
do_apt_packages
fi
do_configure
do_compile
if yn_prompt "Install [y/n]?"; then
do_install
fi
do_clean