Skip to content

Instantly share code, notes, and snippets.

@rodtreweek
Forked from jonschoning/build-install-vim.sh
Last active October 10, 2018 07:32
Show Gist options
  • Save rodtreweek/894f02a23bbc7e3691fa1a0f954e3a40 to your computer and use it in GitHub Desktop.
Save rodtreweek/894f02a23bbc7e3691fa1a0f954e3a40 to your computer and use it in GitHub Desktop.
#!/bin/bash
echo "[ build and install vim from source ]"
# Create directories...
sudo mkdir -p ~/fs/dev;
# This script needs "fpm". If you don't have it
# install ruby, etc. with:
sudo apt-get install ruby ruby-dev build-essential;
# then run "gem install fpm"
sudo gem install fpm;
# You also need to "apt-get install python-setuptools" (otherwise fpm fails)
sudo apt-get install python-setuptools;
# If you're working with Ubuntu/WSL you need to add the source url's to /etc/apt/sources.list
# Here's what I added:
echo "deb-src http://archive.ubuntu.com/ubuntu/ bionic main restricted universe multiverse" >> /etc/apt/sources.list;
sudo apt-get build-dep vim;
sudo apt-get install mercurial checkinstall;
# I opted to use the latest source from the Vim github repo:
cd ~/fs/dev;
git clone https://github.com/vim/vim.git vim;
echo "changing to src dir..."
cd ~/fs/dev/vim
if [ $? -ne 0 ]; then echo "cd to src dir failed"; exit 0; fi
echo "running configure..."
./configure \
--enable-perlinterp=dynamic \
--enable-pythoninterp \
--enable-python3interp \
--enable-rubyinterp \
--enable-luainterp=dynamic \
--enable-cscope \
--enable-gui=auto \
--enable-gtk2-check \
--enable-gnome-check \
--enable-multibyte \
--enable-fontset \
--with-features=huge \
--with-x \
--with-ruby-command=/usr/bin/ruby \
--with-compiledby="Rod Treweek <rtreweek@gmail.com>" \
--with-python-config-dir=/usr/lib/python2.7/config-x86_64-linux-gnu \
--with-python3-config-dir=/usr/lib/python3.6/config-3.6m-x86_64-linux-gnu
if [ $? -ne 0 ]; then echo "configure failed"; exit 0; fi
echo "running make"
make -j 9
if [ $? -ne 0 ]; then echo "make failed"; exit 0; fi
echo "removing installdir..."
rm -Rf /tmp/installdir
if [ $? -ne 0 ]; then echo "remove temp dir failed"; exit 0; fi
echo "installing to installdir..."
make install DESTDIR=/tmp/installdir
if [ $? -ne 0 ]; then echo "make install to temp dir failed"; exit 0; fi
echo "changing to installdir..."
cd /tmp/installdir
if [ $? -ne 0 ]; then echo "cd to temp dir failed"; exit 0; fi
echo "building deb package with FPM..."
fpm -s dir -t deb -n vim81 -v 8.1 .
if [ $? -ne 0 ]; then echo "make deb package with fpm failed"; exit 0; fi
echo "installing package..."
sudo dpkg --force-overwrite -i vim81_8.1_amd64.deb
if [ $? -ne 0 ]; then echo "dpkg install failed"; exit 0; fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment