ericpruitt / static-glibc-vim

Makefile that creates a statically linked Vim binary
28 stars 12 forks source link

static-vim

This repository contains a Makefile and patches to produce a fully statically linked Vim binary. Normally, when compiling Vim with LDFLAGS="-static" to produce a statically linked executable, the generated binary still has hard dependencies on the glibc version of the system that built the binary; a few warnings like this one will be emitted during the build process:

misc1.c:…: warning: … requires … the glibc version used for linking

By making some relatively minor changes to the Vim codebase, the glibc version dependency can be completely eliminated. As of February 1st, 2016, the resulting Vim binary has the following feature set which has been tweaked from what is normally generated with --with-features=normal to suit my personal preferences:

Normal version without GUI.  Features included (+) or not (-):
+acl             -farsi           -mouse_sgr       +tag_old_static
-arabic          +file_in_path    -mouse_sysmouse  -tag_any_white
+autocmd         +find_in_path    -mouse_urxvt     -tcl
-balloon_eval    +float           +mouse_xterm     +terminfo
-browse          +folding         +multi_byte      +termresponse
+builtin_terms   -footer          +multi_lang      +textobjects
+byte_offset     +fork()          -mzscheme        +title
-channel         -gettext         -netbeans_intg   -toolbar
+cindent         -hangul_input    +path_extra      +user_commands
-clientserver    +iconv           -perl            +vertsplit
-clipboard       +insert_expand   +persistent_undo +virtualedit
+cmdline_compl   +jumplist        +postscript      +visual
+cmdline_hist    -keymap          +printer         +visualextra
+cmdline_info    -langmap         -profile         +viminfo
+comments        -libcall         -python          +vreplace
+conceal         +linebreak       -python3         +wildignore
+cryptv          +lispindent      +quickfix        +wildmenu
-cscope          +listcmds        +reltime         +windows
+cursorbind      +localmap        -rightleft       +writebackup
+cursorshape     -lua             -ruby            -X11
+dialog_con      +menu            +scrollbind      -xfontset
+diff            +mksession       -signs           -xim
+digraphs        +modify_fname    +smartindent     -xsmp
-dnd             +mouse           -sniff           -xterm_clipboard
-ebcdic          -mouseshape      +startuptime     -xterm_save
-emacs_tags      -mouse_dec       +statusline      -xpm
+eval            -mouse_gpm       -sun_workshop
+ex_extra        -mouse_jsbterm   +syntax
+extra_search    -mouse_netterm   +tag_binary

In short there is little to no:

Licensing

The Makefiles and launcher script are licensed under the 2-clause BSD license.

Instructions

The Makefile provides a number of different targets. The most important ones are as follows:

There are several variables defined in the Makefile that may be overridden: INSTALLDIR, which defaults to ~/vim/, determines where the vim and xxd binaries and the Vim runtime folder will be stored. BINDIR is the directory where symlinks to the xxd binary and Vim launcher will be placed and should be a folder listed in the PATH environment variable. DISTEXTENSION, which defaults to tar.bz2, determines the extension and type of the distributable archive.

The vim.sh script is a wrapper used to launch the statically compiled Vim binary with VIMRUNTIME set to the appropriate directory and will automatically be installed or bundled as necessary.