# Contributor: Lee Hinman <hinman@gmail.com>
# Maintainer: Cág <ca6c@bitmessage.ch>
pkgname=mg
pkgver=20171014
pkgrel=0
pkgdesc="microscopic EMACS style editor"
url="http://homepage.boetes.org/software/mg"
arch="all"
license="Public-Domain"
depends=
makedepends="ncurses-dev libbsd-dev bsd-compat-headers"
install=
subpackages="$pkgname-doc"
source="http://homepage.boetes.org/software/mg/$pkgname-$pkgver.tar.gz
	missing-defines.patch
	"

_builddir="$srcdir"/$pkgname-$pkgver

prepare() {
	cd "$_builddir"
	for i in $source; do
		case $i in
		*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
		esac
	done
}

build() {
	cd "$_builddir"
	make prefix=/usr mandir=/usr/share/man || return 1
}

package() {
	cd "$_builddir"
	make INSTALL=install DESTDIR="$pkgdir" prefix=/usr \
		mandir=/usr/share/man install || return 1
	install -Dm644 tutorial "$pkgdir"/usr/share/doc/$pkgname/tutorial
}

sha512sums="d55818308421aa523fb30b6e4725bb122f37637a822fabafeba9f9da3b97fd7f6af6431fce3015c969d0e656a48e89ed49b790deefc69fbdbb7e257f8a1aeb56  mg-20171014.tar.gz
f1967dd33a025e11ff63ba797c2fb64ac0679cd6c09a332241a28e0976b96db467894e1e3573c5bc88b7feaecdb430695aa4f8fa2712b227d0947b3d8b05c97c  missing-defines.patch"
