-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.sh
executable file
·153 lines (135 loc) · 4.95 KB
/
build.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
146
147
148
149
150
151
152
153
#!/bin/bash
set -eaux
SCRIPT="$(readlink -f $0)"
SCRIPT_DIR="$(dirname ${SCRIPT})"
INSTALL_DIR="${SCRIPT_DIR}/${BUILD_NAME:-build-linux}"
CMAKE=${CMAKE:-cmake}
CORES=${CORES:-4}
unset PYTHONPATH
unset PYTHONUSERBASE
unset PYTHONHOME
${CMAKE} --version
############################# build neovim
if [ ! -f "${INSTALL_DIR}"/bin/nvim ]; then
echo "Building Neovim"
cd "${SCRIPT_DIR}"/neovim
mkdir -p .deps
cd .deps
${CMAKE} ../third-party -DCMAKE_BUILD_TYPE=Release > "${SCRIPT_DIR}"/neovim.log
make >> "${SCRIPT_DIR}"/neovim.log
cd "${SCRIPT_DIR}"/neovim
mkdir -p build
cd build
${CMAKE} .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}" >> "${SCRIPT_DIR}"/neovim.log
make -j${CORES} >> "${SCRIPT_DIR}"/neovim.log
make install >> "${SCRIPT_DIR}"/neovim.log
mv "${INSTALL_DIR}/bin/nvim" "${INSTALL_DIR}/bin/nvim-binary"
cp "${SCRIPT_DIR}/launcher.sh" "${INSTALL_DIR}/bin/nvim"
fi
############################# build xsel
if [ ! -f "${INSTALL_DIR}"/bin/xsel ]; then
echo "Building xsel"
cd "${SCRIPT_DIR}"/xsel*
mkdir -p build
cd build
../configure --prefix="${INSTALL_DIR}"
make
make install
fi
############################ build zlib
if [ ! -f "${INSTALL_DIR}"/lib/libz.so ]; then
echo "Building zlib"
cd "${SCRIPT_DIR}"/zlib*
mkdir -p build
cd build
${CMAKE} .. -DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}" > "${SCRIPT_DIR}"/zlib.log
make install >> "${SCRIPT_DIR}"/zlib.log
fi
############################ build openssl
if [ ! -f "${INSTALL_DIR}"/lib/libssl.a ]; then
echo "Building OpenSSL"
cd "${SCRIPT_DIR}"/openssl
./Configure linux-x86_64 no-shared \
-fPIC \
-I"${INSTALL_DIR}"/include \
-L"${INSTALL_DIR}"/lib \
--prefix="${INSTALL_DIR}" \
--openssldir="${INSTALL_DIR}/ssl" > "${SCRIPT_DIR}"/openssl.log
make >> "${SCRIPT_DIR}"/openssl.log
make install >> "${SCRIPT_DIR}"/openssl.log
fi
############################ build python3
if [ ! -f "${INSTALL_DIR}"/bin/python3 ]; then
echo "Building Python 3"
cd "${SCRIPT_DIR}"/Python-3.*
mkdir -p build
cd build
../configure \
--prefix="${INSTALL_DIR}" \
--enable-shared \
LDFLAGS="-Wl,-rpath=${INSTALL_DIR}/lib" > "${SCRIPT_DIR}"/python-3.log
make -j${CORES} >> "${SCRIPT_DIR}"/python-3.log
make install >> "${SCRIPT_DIR}"/python-3.log
"${INSTALL_DIR}"/bin/pip3 install neovim >> "${SCRIPT_DIR}"/python-3.log
"${INSTALL_DIR}"/bin/pip3 install 'python-language-server[all]' >> "${SCRIPT_DIR}"/python-3.log
"${INSTALL_DIR}"/bin/pip3 install 'pycodestyle' >> "${SCRIPT_DIR}"/python-3.log
fi
############################# build python2
if [ ! -f "${INSTALL_DIR}"/bin/python2 ]; then
echo "Building Python 2"
cd "${SCRIPT_DIR}"/Python-2.*
mkdir -p build
cd build
../configure \
--prefix="${INSTALL_DIR}" \
--enable-unicode=ucs4 \
--enable-shared \
--with-ensurepip=install \
LDFLAGS="-Wl,-rpath=${INSTALL_DIR}/lib" > "${SCRIPT_DIR}"/python-2.log
make -j${CORES} >> "${SCRIPT_DIR}"/python-2.log
make install >> "${SCRIPT_DIR}"/python-2.log
"${INSTALL_DIR}"/bin/pip2.7 install neovim >> "${SCRIPT_DIR}"/python-2.log
"${INSTALL_DIR}"/bin/pip2.7 install 'python-language-server[all]' >> "${SCRIPT_DIR}"/python-2.log
"${INSTALL_DIR}"/bin/pip2.7 install 'pycodestyle' >> "${SCRIPT_DIR}"/python-2.log
fi
export PATH="${INSTALL_DIR}/bin":$PATH
############################# build LLVM and Clang
if [ ! -f "${INSTALL_DIR}"/lib/libclang.so ]; then
echo "Building LLVM and clang"
cd "${SCRIPT_DIR}"/llvm*
mkdir -p build
cd build
${CMAKE} .. \
-DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \
-DCMAKE_BUILD_TYPE=Release \
-DPYTHON_EXECUTABLE="${INSTALL_DIR}/bin/python2.7" \
> "${SCRIPT_DIR}"/llvm.log
make -j${CORES} >> "${SCRIPT_DIR}"/llvm.log
make install >> "${SCRIPT_DIR}"/llvm.log
cd ..
cp ./tools/clang/tools/clang-format/clang-format.py ${INSTALL_DIR}/bin
fi
############################# build cquery
if [ ! -f "${INSTALL_DIR}"/bin/cquery ]; then
echo "Building cquery"
cd "${SCRIPT_DIR}"/cquery
./waf configure \
--llvm-config="${INSTALL_DIR}/bin/llvm-config" \
--variant=release \
--prefix="${INSTALL_DIR}"
./waf build
./waf install
fi
############################# Vim-plug
if [ ! -f "${INSTALL_DIR}"/share/nvim/runtime/autoload/plug.vim ]; then
cd "${SCRIPT_DIR}/vim-plug"
cp plug.vim "${INSTALL_DIR}"/share/nvim/runtime/autoload/plug.vim
fi
############################# Fix neovim python host programs
cat > "${INSTALL_DIR}"/share/nvim/sysinit.vim << EOF
let g:python_host_prog = \$NVIM_PYTHON_HOST_PROGRAM
let g:python3_host_prog = \$NVIM_PYTHON3_HOST_PROGRAM
let g:clang_format_path = \$NVIM_CLANG_FORMAT_BINARY_PATH
EOF
############################## Remove hidden directories
find "${INSTALL_DIR}" -ignore_readdir_race -name '.*' -prune -exec rm -rf {} \;