# Contributor: Michael Mason <ms13sp@gmail.com>
# Maintainer: Dan Theisen <djt@hxx.in>
pkgname=nano
pkgver=4.8
pkgrel=0
pkgdesc="Enhanced clone of the Pico text editor"
url="https://www.nano-editor.org"
arch="all"
license="GPL-3.0+"
depends=""
makedepends="file-dev ncurses-dev"
subpackages="$pkgname-doc $pkgname-lang"
source="https://www.nano-editor.org/dist/v${pkgver%.*}/$pkgname-$pkgver.tar.xz"

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
		--with-wordbounds
	make
}

check() {
	make check
}

package() {
	make DESTDIR="$pkgdir" install
	install -Dm644 doc/sample.nanorc \
		"$pkgdir"/etc/nanorc

	# Proper syntax highlighting for APKBUILDs
	sed -i "/syntax/s/\"$/\" \"APKBUILD&/" \
		"$pkgdir"/usr/share/nano/sh.nanorc

	rm -rf "$pkgdir"/usr/lib/charset.alias
}

sha512sums="9799d93f322ac12d95784b6ecc7f7f9037f0a395be0cafe238b9e0ae2d8d93181a8a114a11ccccb20bcf07375ddaf842f49f7d23372f0d330ce67a66d0318ae8  nano-4.8.tar.xz"