You are here

Buliding Vim 7.3 RPM packages for 64-bit CentOS 5 / 6

Vim 7.3 has one really useful built-in feature - Blowfish encryption. With Blowfish encryption, strong encryption of files is now possible using vim. Here is a short tutorial on how to build RPM packages for Vim 7.3 on 64-bit CentOS 5 and CentOS 6. I have built the packages as user 'root'. However, it is generally not recommended to build packages as 'root'. Instead, this should be done as a normal user. I have not tried this but if you are interested, you can look at the links in the References section.

  1. Install rpmbuild and some other tools.
    # yum install rpm-build redhat-rpm-config
    # yum install make gcc
    
  2. Download and install vim 7.3 SRPM.
    # wget "http://download.fedora.redhat.com/pub/fedora/linux/releases/15/Everything/source/SRPMS/vim-7.3.138-1.fc15.src.rpm"
    # mkdir -p /usr/src/redhat/ #(for CentOS 5 only)
    # rpm --nomd5 -ivh vim-7.3.138-1.fc15.src.rpm
    
  3. Install vim build dependencies
    # grep -i 'BuildRequires:' /usr/src/redhat/SPECS/vim.spec
    # yum install hunspell-devel python-devel ncurses-devel gettext perl-devel \
    perl-ExtUtils-Embed libacl-devel gpm-devel autoconf libselinux-devel ruby-devel ruby \
    desktop-file-utils gtk2-devel libSM-devel libXt-devel libXpm-devel
    

    For CentOS 5 only, upgrade autoconf and m4 packages, and remove build dependency on 'perl-devel'.

    # wget "ftp://rpmfind.net/linux/sourceforge/h/project/hp/hphp/CentOS%205%2064bit/RPM/autoconf-2.63-3.noarch.rpm"
    # wget "ftp://rpmfind.net/linux/sourceforge/h/project/hp/hphp/CentOS%205%2064bit/RPM/m4-1.4.13-4.x86_64.rpm"
    # rpm -Uvh autoconf-2.63-3.noarch.rpm m4-1.4.13-4.x86_64.rpm
    
    # sed -i 's/ perl-devel//' /usr/src/redhat/SPECS/vim.spec
    

    Alternatively, for CentOS 6, you can install the build dependencies using "yum-builddep" command.

    # yum install yum-utils
    # yum-builddep --nogpgcheck vim-7.3.138-1.fc15.src.rpm
    
  4. Finally build vim rpms using rpmbuild.
    # rpmbuild -ba /usr/src/redhat/SPECS/vim.spec #(for CentOS 5)
    # rpmbuild -ba ~/rpmbuild/SPECS/vim.spec #(for CentOS 6)
    

    You should find the rpms in /usr/src/redhat/RPMS/x86_64/ (CentOS 5) or ~/rpmbuild/RPMS/x86_64/ (CentOS 6). Unfortunately while the build was successful in CentOS 5, it failed in CentOS 6.

Vim plugin for transparent editing of gpg encrypted files

Although Vim now offers Blowfish encryption, I highly recommend using Vim's gnupg plugin. The reason being apart from providing strong encryption, this plugin also takes care of not creating swap files and not writing any information to .viminfo file. The easiest way to convert any text file to GPG symmetric encrypted file is by running the command:

# gpg -ac passwords.txt

This will create the file "passwords.txt.asc". Once the gnupg plugin is installed, vim can be used to open and modify this file.

References

Category: 

Comments

hi, i tried to build vim 7.3 following your steps + updated libtool to 2.2.6 , still getting this error:

configure.in:2552: error: possibly undefined macro: AC_TYPE_UINT32_T
If this token and others are legitimate, please use m4_pattern_allow.
See the Autoconf documentation.
error: Bad exit status from /var/tmp/rpm-tmp.42424 (%build)

any ideas?
thanks

I vaguely remember getting that error before upgrading m4. Are you sure that you have upgraded m4? You can check the version of m4 that you have installed. Also, are you using 32-bit or 64-bit OS?

I got this error before installing autoconf.

Thanks for the great guide. I got this running on CentOS 5. Some minor notes:
2. The vim source I got from here:
http://dl.fedoraproject.org/pub/fedora/linux/releases/15/Everything/sour...

3. Some packages were not available. I just went ahead ignoring these missing packages and everything still built fine.
No package hunspell-devel available.
No package perl-devel available.
No package perl-ExtUtils-Embed available.

Also, the autoconf and m4 links didn't work for me. Instead I used:
ftp://fr2.rpmfind.net/linux/sourceforge/h/hp/hphp/CentOS%205%2064bit/RPM...
ftp://fr2.rpmfind.net/linux/sourceforge/h/hp/hphp/CentOS%205%2064bit/RPM...

After that, the RPMs built to /usr/src/redhat/RPMS. I just installed from there using rpm -ivh package.

Add new comment