# Compiling Time: 0.04 SBU
# Maintainer: James Buren <ryuo@frugalware.org>
# Contributor: Miklos Vajna <vmiklos@frugalware.org>

pkgname=elvis
pkgver=2.2_0
pkgrel=5
pkgdesc="A free vi clone for Unix and other operating systems."
url="http://elvis.the-little-red-haired-girl.org/"
depends=('ncurses>=6.0-3')
groups=('apps-extra')
archs=('x86_64')
_F_archive_grepv="unofficial"
up2date="lynx -dump $url/gettingelvis/index.html | grep -m1 'elvis-\(.*\).tar.gz' | sed 's/.*-\(.*\).tar.*/\1/'"
source=(http://www.the-little-red-haired-girl.org/pub/$pkgname/$pkgname-$pkgver.tar.gz \
	elvis-patch-ref.patch)
sha1sums=('8c16574b6d36529735b8ced70972ddaf6275a477' \
          'b068feb18b764dbf71a4266a5bff98a162f725eb')

build()
{
	Fpatchall
	Fmkdir /bin /etc /usr/share/man/man1
	Fsed '/etc/elvis' "$Fdestdir/etc/elvis" Makefile.in
	# turn off color by default
	Fsed 'color' '"color' data/elvis.clr
	Fconf --docdir=$Fdestdir/usr/share/elvis/doc
	Fexec make CC="gcc $CFLAGS" || return 1
	export MANPATH=$Fdestdir/usr/share/man
	Fmakeinstall PREFIX=$Fdestdir/usr
	Fsed "$Fdestdir" "" $Fdestdir/{etc,usr/share}/elvis/README
}

# optimization OK
