-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild_latest_vim.sh
executable file
·85 lines (64 loc) · 1.71 KB
/
build_latest_vim.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
#!/bin/bash
# Globals & Constants
REPOSITORY_PATH=/tmp/vim.git
# Ensure all dependencies exist
sudo apt-get build-dep vim -y
# Clean up any existing downloads
if [ -d ${REPOSITORY_PATH} ]; then
echo "Removing existing repository"
rm -rf ${REPOSITORY_PATH}
fi
# Check out a clean repository
git clone /~https://github.com/vim/vim.git ${REPOSITORY_PATH}
if [ $? -ne 0 ]; then
echo "Failed to clone vim repository"
exit 1
fi
# Enter the repository
pushd ${REPOSITORY_PATH}
# Find the latest tag
LATEST_TAG=`git tag | grep ^v | sort | tail -n1`
echo "Building ${LATEST_TAG}"
git checkout ${LATEST_TAG}
# If rbenv is installed, make it use the system ruby for compile
type rbenv
if [ $? -eq 0 ]; then
echo "Setting local rbenv to system"
rbenv local system
fi
# Conigure the build
./configure --prefix=/usr/local \
--with-features=huge \
--enable-multibyte \
--enable-gui=no \
--enable-luainterp \
--enable-perlinterp \
--enable-pythoninterp \
--enable-python3interp \
--enable-tclinterp \
--enable-rubyinterp \
--without-x
if [ $? -ne 0 ]; then
echo "Failed to configure the build"
exit 1
fi
# Get the number of processors available for the compile
NUMBER_OF_PROCESSORS=`getconf _NPROCESSORS_ONLN`
if [ $? -ne 0 ]; then
NUMBER_OF_PROCESSORS=1
fi
echo "Using ${NUMBER_OF_PROCESSORS} processor(s)"
# Make and install
make -j${NUMBER_OF_PROCESSORS}
if [ $? -ne 0 ]; then
echo "Failed to make vim"
exit 1
fi
sudo make install
if [ $? -ne 0 ]; then
echo "Failed to install vim"
exit 1
fi
# TODO: Add this version of vim to the alternatives system
# Leave the repository
popd