11/13/16

Compiling Vim 8.0 - Mac OS X Sierra


I know Homebrew but I hate those tools which pollute my system. This is mine. I want to pollute it myself !

1. Compile gettext


I want gettext but if you don't care about, you can safely skip this step and directly go to 2.
% cd && mkdir -p src/tarball && cd src
% curl http://ftp.gnu.org/pub/gnu/gettext/gettext-0.19.8.1.tar.gz -o tarball/!#:^:t
% tar xvzf !$
% cd !$:t:r:r
% ./configure
% make
% sudo make install
% sudo rm -rf /usr/local/share/doc/gettext/examples/

You can close the dialog box about Java.


2. Compile lua


I need lua support to test neocomplete but, as for 1., if you don't care about, you can safely skip this step and directly go to 3.
% cd && mkdir -p src/tarball && cd src
% curl http://www.lua.org/ftp/lua-5.3.3.tar.gz -o tarball/!#:^:t
% tar xvzf !$
% cd !$:t:r:r
% make macosx test
% sudo make install

3. Compile Vim


% cd && mkdir -p src/tarball && cd src

a) Copy and paste the text below in a file inside the src directory and name it: configuration_vim8
export CONF_OPT_X="--without-x"
export CONF_OPT_GUI="--disable-gui"
export CONF_OPT_PYTHON="--enable-pythoninterp"
export CONF_OPT_RUBY="--enable-rubyinterp"
export CONF_OPT_CSCOPE="--enable-cscope"
export CONF_OPT_MULTIBYTE="--enable-multibyte"
export CONF_OPT_FEAT="--with-features=huge"
export CONF_OPT_FAIL="--enable-fail-if-missing"
export CPPFLAGS="-isystem /usr/local/include"
export CONF_OPT_COMPBY="--with-compiledby='your name <your email>'"
export CONF_OPT_LUA="--enable-luainterp"
export CONF_OPT_LUA_PREFIX="--with-lua-prefix=/usr/local"

If you skipped the lua compilation (2.), you should remove CONF_OPT_LUA and CONF_OPT_LUA_PREFIX from the configuration file (or copy without the last 2 lines).

Anyway, you should modify the CONF_OPT_COMPBY option to put your name and email.



b) Copy and paste the text below in a file inside the src directory and name it: apply_patches_vim80
PATCHES=../vim80-patches/*;
for f in $PATCHES; do
  echo "Applying patch $f";
  patch -p0 < $f;
done

c) Get the vim 8.0 sources:
% curl ftp://ftp.vim.org/pub/vim/unix/vim-8.0.tar.bz2 -o tarball/!#:^:t
% bzip2 -dc !$ | tar xvf -

d) Get the patches for vim 8.0:

The vim sources in the tarball are already patched until .0069 version so we only get patches we are interested in.

% mkdir vim80-patches && cd !#:^
% ftp ftp://ftp.vim.org/pub/vim/patches/8.0/
ftp> prompt
ftp> mget *.007*
ftp> mget *.008*
ftp> quit

At the date of writing this article, patch 8.0.0083 is the last.


e) Apply the patches:
% cd ../vim80
% sh ../apply_patches_vim80

f) Set up the environment variables for the compilation:
% source ../configuration_vim8
% env | grep -E 'CONF|CPPFLAGS'

The above command should show you the environment variables fixed by the configuration_vim8 file. If this is not the case, then we are in trouble. Ensure you have not mistyped something in the configuration file.


g) Compile vim:
% cd src
% make distclean
% make

At this stage, you can use the produced binary to see if vim is correctly build with your options:

% ./vim --version

You should see +ruby, +pyhton, +gettext and +lua (for the last two, only if you followed the steps 1. and 2.)


h) If all is fine, you can install vim:
% sudo make install

4. Make the new vim accessible


Create a link for vi

% cd /usr/local/bin
% sudo ln -s ./vim vi

Modify your ~./bashrc

export PATH=/usr/local/bin:$PATH

Source your .bashrc

% . ~/.bashrc
Done.

0 Commentaire

Post a Comment