ubuntu vim ソースからインストール

Ubuntu 20.04 のvim が8.1。最新のvim 8.2なので最新版を使いたいのでソースからビルドする

> \cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=20.04
DISTRIB_CODENAME=focal
DISTRIB_DESCRIPTION="Ubuntu 20.04.1 LTS"
> vim --version
VIM - Vi IMproved 8.1 (2018 May 18, compiled Apr 15 2020 06:40:31)
Included patches: 1-2269
Modified by team+vim@tracker.debian.org
Compiled by team+vim@tracker.debian.org
Huge version with GTK3 GUI.

vim インストール参考

www.vim.org

git clone

> git clone --depth=1 git@github.com:vim/vim.git
Cloning into 'vim'...
Warning: Permanently added the RSA host key for IP address '52.69.186.44' to the list of known hosts.
remote: Enumerating objects: 3546, done.
remote: Counting objects: 100% (3546/3546), done.
remote: Compressing objects: 100% (3174/3174), done.
remote: Total 3546 (delta 467), reused 1318 (delta 310), pack-reused 0
Receiving objects: 100% (3546/3546), 14.53 MiB | 6.25 MiB/s, done.
Resolving deltas: 100% (467/467), done.

build

> cd src
> make

error になる

checking whether stack_t has an ss_base field... no
checking --with-tlib argument... empty: automatic terminal library selection
checking for tgetent in -ltinfo... no
checking for tgetent in -lncurses... no
checking for tgetent in -ltermlib... no
checking for tgetent in -ltermcap... no
checking for tgetent in -lcurses... no
no terminal library found
checking for tgetent()... configure: error: NOT FOUND!
      You need to install a terminal library; for example ncurses.
      Or specify the name of the library with --with-tlib.
Makefile:304: auto/config.mk: No such file or directory
make: *** [Makefile:2056: auto/config.mk] Error 1

ncurses インストール

> sudo apt install libncurses-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
Suggested packages:
  ncurses-doc
The following NEW packages will be installed:
  libncurses-dev
0 upgraded, 1 newly installed, 0 to remove and 80 not upgraded.
Need to get 339 kB of archives.
After this operation, 2397 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu focal/main amd64 libncurses-dev amd64 6.2-0ubuntu2 [339 kB]
Fetched 339 kB in 2s (164 kB/s)
Selecting previously unselected package libncurses-dev:amd64.
(Reading database ... 55649 files and directories currently installed.)
Preparing to unpack .../libncurses-dev_6.2-0ubuntu2_amd64.deb ...
Unpacking libncurses-dev:amd64 (6.2-0ubuntu2) ...
Setting up libncurses-dev:amd64 (6.2-0ubuntu2) ...
Processing triggers for man-db (2.9.1-1) ...

再ビルド

> make
> sudo make install
> /usr/local/bin/vim --version
VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Oct  1 2020 20:27:19)
Included patches: 1-1778
Compiled by hoge
Huge version without GUI.

とりあえずソースからインストールは出来た