SUMMARY="A highly configurable text editor"
DESCRIPTION="Vim is a highly configurable text editor built to enable \
efficient text editing. It is an improved version of the vi editor \
distributed with most UNIX systems.

Vim is often called a \"programmer's editor,\" and so useful for programming \
that many consider it an entire IDE. It's not just for programmers, though. \
Vim is perfect for all kinds of text editing, from composing email to editing \
configuration files.
Despite this, Vim can be configured to work in a very simple (Notepad-like) \
way, called evim or Easy Vim."
HOMEPAGE="http://www.vim.org"
COPYRIGHT="Bram Moleenar et al."
LICENSE="Vim"
REVISION="3"
SOURCE_URI="ftp://ftp.vim.org/pub/vim/unix/vim-7.4.tar.bz2"
CHECKSUM_SHA256="d0f5a6d2c439f02d97fa21bd9121f4c5abb1f6cd8b5a79d3ca82867495734ade"
SOURCE_DIR="vim74"
PATCHES="vim-7.4.patchset"

ARCHITECTURES="x86_gcc2 x86 x86_64"

PROVIDES="
	vim = $portVersion
	cmd:ex = $portVersion
	cmd:gview = $portVersion
	cmd:gvim = $portVersion
	cmd:gvimdiff = $portVersion
	cmd:rgview = $portVersion
	cmd:rgvim = $portVersion
	cmd:rview = $portVersion
	cmd:rvim = $portVersion
	cmd:vi = $portVersion
	cmd:vim = $portVersion
	cmd:vimdiff = $portVersion
	cmd:vimtutor = $portVersion
	cmd:view = $portVersion
	cmd:xxd = $portVersion
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libncurses
	lib:libintl
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	ncurses_devel
	gettext
	"
BUILD_PREREQUIRES="
	cmd:make
	cmd:autoconf
	cmd:gcc
	cmd:find
	cmd:grep
	cmd:sed
	"

BUILD()
{
	cd src
	autoconf
	runConfigure ./configure --disable-gui --with-features=big --with-compiledby=$packager
	make $jobArgs
	cp vim vim.con # preserve gui-less executable
	rm objects/*.o
	runConfigure ./configure --with-features=big --with-compiledby=$packager
	make $jobArgs
}

INSTALL()
{
	make install

	# Make arrow keys, backspace, delete, etc behave as expected.
	echo "set nocompatible" > $dataDir/vim/vimrc

	ln -s vim $binDir/vi
}
