Skip to content

Instantly share code, notes, and snippets.

@lambdalisue
Last active February 26, 2021 10:27
Show Gist options
  • Save lambdalisue/102a1f9985b243cd0e71 to your computer and use it in GitHub Desktop.
Save lambdalisue/102a1f9985b243cd0e71 to your computer and use it in GitHub Desktop.
An install script of GVim (+python/+python3) in Ubuntu/Debian
#!/bin/bash
#==============================================================================
# An install script of GVim in Ubuntu/Debian
#==============================================================================
echo "Installing required packages ..."
sudo apt-get install -yq build-essential curl
sudo apt-get install -yq \
libncurses5-dev \
libbonoboui2-dev \
libcario2-dev libxpm-dev \
libx11-dev libxt-dev \
libgnome2-dev libgnomeui-dev \
libgtk2.0-dev libatk1.0-dev
sudo apt-get install -yq \
lua5.2 liblua5.2-dev \
luajit libluajit-5.1
sudo apt-get install -yq \
libssl-dev zlib1g-dev libbz2-dev \
libreadline-dev libsqlite3-dev llvm
PYTHON2=$(pyenv install -l | \
grep -E "^ 2\.[0-9]+\.[0-9]+$" | \
tail -1 | sed -e 's/^[ ]*//')
PYTHON3=$(pyenv install -l | \
grep -E "^ 3\.[0-9]+\.[0-9]+$" | \
tail -1 | sed -e 's/^[ ]*//')
echo "Installing Python $PYTHON2 and $PYTHON3 ..."
CONFIGURE_OPTS="--enable-shared --enable-unicode-ucs4" \
pyenv install $PYTHON2
CONFIGURE_OPTS="--enable-shared" \
pyenv install $PYTHON3
echo "Downloading Vim repository ..."
if [[ -d vim ]]; then
rm -rf vim
fi
git clone --depth=1 https://github.com/vim/vim
cd vim
pyenv local ${PYTHON2} ${PYTHON3}
echo "Configure Vim installation ..."
make distclean
#./configure \
PREFIX="${HOME}/.anyenv/envs/pyenv/versions"
LDFLAGS="-Wl,-rpath=${PREFIX}/${PYTHON2}/lib:${PREFIX}/${PYTHON3}/lib" ./configure \
--enable-fail-if-missing \
--with-features=huge \
--with-luajit \
--enable-luainterp \
--enable-pythoninterp=dynamic \
--enable-python3interp=dynamic \
--enable-multibyte \
--enable-fontset \
--enable-gui=gnome2 | tee ../install_gvim.configure.log
echo
echo "Confirm 'install_gvim.configure.log' if the following lines are correct"
echo
echo " checking whether we can do without RTLD_GLOBAL for Python... yes"
echo " checking whether we can do without RTLD_GLOBAL for Python3... yes"
echo
echo "Otherwise you cannot switch python and python3 in a same Vim session."
echo "Then execute the following:"
echo
echo " make -j 12"
echo " sudo porg -lD 'make install'"
echo
@hjwp
Copy link

hjwp commented Jun 21, 2016

I'm seeing an error during the apt-get install:

E: Unable to locate package libcario2-dev

Is that a typo, should it be libcairo2-dev?

@hjwp
Copy link

hjwp commented Jun 21, 2016

also pyenv is a command not found. Change to a python3 -m venv? Not quite sure what those steps are trying to do tbh...

@hjwp
Copy link

hjwp commented Jun 21, 2016

according to this thread, it's a wild goose chase anyway: https://vi.stackexchange.com/questions/779/how-do-i-get-vim-to-be-able-to-run-both-python-and-python3-on-a-linux-system-in

but the workaround of apt-get install vim-gtk3 vim-gtk3-py2 is ok for now. sorry for the stream-of-consciousness comments on your nice script!

@lambdalisue
Copy link
Author

Sorry I haven't notice your comment. pyenv is used to build Python 2 and Python 3 with --enable-shared while Vim on Debian package was not compiled with that parameter.
And the command is https://github.com/yyuu/pyenv

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment