Last active
December 18, 2015 18:49
-
-
Save tkfm-yamaguchi/5828401 to your computer and use it in GitHub Desktop.
installation script for vim
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# coding: utf-8 | |
set -ex | |
# -------------------- | |
VIM_NAME=vim | |
VIM_SRC_DIR="$HOME/local/src/github.com/vim/vim" | |
VIM_GITHUB="https://github.com/vim/vim.git" | |
COMPILED_BY="ymgch <[email protected]>" | |
# -------------------- | |
if [ ! -d "$VIM_SRC_DIR" ]; then | |
echo "Cloning Vim sources" | |
git clone "$VIM_GITHUB" "$VIM_SRC_DIR" | |
fi | |
# -------------------- | |
# Ubuntu 12.04 | |
# PKGPYTHON3=python3-dev | |
# Ubuntu 13.04 and later | |
# PKGPYTHON3=libpython3-dev | |
# apt-get build-dep vim | |
# apt-get install mercurial \ | |
# gettext \ | |
# paco \ | |
# libncurses5-dev \ | |
# libxmu-dev \ | |
# libgnomeui-dev \ | |
# libperl-dev \ | |
# ruby-dev \ | |
# python-dev \ | |
# ${PKGPYTHON3} | |
# luajit luajit-*.* | |
# -------------------- | |
# Reserve the directory path for applying the patches | |
PATCHDIR="$(cd "$(dirname "$([ -L $0 ] && readlink -f $0 || echo $0)")/../patches"; pwd)" | |
# Since paco was abandoned and renamed to 'porg', | |
# we switch to the enable one. | |
SOFTWARE_MANAGER="paco" | |
if command -v "porg" >/dev/null 2>&1 ; then | |
SOFTWARE_MANAGER="porg" | |
fi | |
# -------------------- | |
# # Ubuntu 12.04: | |
# CONFDIRPYTHON3=/usr/lib/python3.2/config-3.2mu | |
# # Ubuntu 13.04: | |
# CONFDIRPYTHON3=/usr/lib/python3.3/config-3.3m-x86_64-linux-gnu | |
# # Ubuntu 14.04: | |
# CONFDIRPYTHON3=/usr/lib/python3.4/config-3.4m-x86_64-linux-gnu | |
# if pyenv is used (replace `*` with appropriate number) ... | |
# $ env PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install 2.7.* | |
# $ env PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install 3.*.* | |
# $ pyenv global 2.7.* 3.*.* | |
# -------------------- | |
cd $VIM_SRC_DIR | |
# -------------------- | |
# Clean local repository at first | |
git checkout -- . | |
echo "Updating repository" | |
git pull | |
# -------------------- | |
echo "Applying local patches" | |
for patchfile in `find $PATCHDIR -maxdepth 1 -name '*.patch'`; do | |
patch -p1 -E < $patchfile | |
done | |
# -------------------- | |
read -p "Continue? [Y/n] > " ANS | |
if [[ $ANS =~ ^n|^N ]]; then | |
echo Quit to update | |
exit 0 | |
fi | |
# -------------------- | |
make clean | |
make distclean | |
./configure \ | |
--enable-fail-if-missing \ | |
--prefix="$HOME/local" \ | |
--disable-darwin \ | |
--disable-selinux \ | |
--enable-fontset \ | |
--enable-gnome-check \ | |
--enable-gui=gtk2 \ | |
--enable-multibyte \ | |
--enable-perlinterp \ | |
--enable-pythoninterp=dynamic \ | |
--enable-python3interp=dynamic \ | |
--enable-rubyinterp \ | |
--enable-luainterp \ | |
--with-vim-name=${VIM_NAME} \ | |
--with-compiledby="${COMPILED_BY}" \ | |
--with-features=huge \ | |
--with-tlib=ncurses \ | |
--with-luajit \ | |
# --with-python3-config-dir="${CONFDIRPYTHON3}" | |
# configure status check | |
status=$? | |
if [ $status -ne 0 ]; then | |
echo "configure failed with status $status. abort." | |
exit $status | |
fi | |
make | |
# -------------------- | |
read -p "Replace current vim. Press [Enter] key to continue..." | |
# uninstall | |
sudo $SOFTWARE_MANAGER --remove --batch $VIM_NAME | |
# sudo make install | |
sudo $SOFTWARE_MANAGER --log --package=${VIM_NAME} make install |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
about pyenv: