# Contributor: rubicon <rubicon@mailo.com>
# Maintainer: rubicon <rubicon@mailo.com>
pkgname=es-shell
pkgver=0.9.2_git20220315
_gitrev=0993c96404973c70888696c23a9d7cb016871fd0
pkgrel=1
pkgdesc="Shell with higher-order functions"
url="https://wryun.github.io/es-shell/"
arch="all !ppc64le" # error: expected expression at end of input
license="Public-Domain"
makedepends="autoconf automake byacc libtool readline-dev"
options="!check"
subpackages="$pkgname-doc"
source="$pkgname-$pkgver.tar.gz::https://github.com/wryun/es-shell/archive/$_gitrev.tar.gz
	configure.ac.patch
	"
builddir="$srcdir/$pkgname-$_gitrev"

prepare() {
	default_prepare

	libtoolize -qi
	autoupdate
	autoreconf -fvi
}

build() {
	./configure \
		--build="$CBUILD" \
		--target="$CTARGET" \
		--prefix=/usr \
		--with-readline
	make
}

package() {
	make DESTDIR="$pkgdir" install

	sed -i 's|#! /bin/es|#!/usr/bin/es|' esdebug

	install -Dvm644 README.md CHANGES COPYING esdebug \
		initial.es trip.es doc/usenix-w93.ps \
		doc/ERRATA doc/TODO doc/es-list.gz \
		-t "$pkgdir"/usr/share/doc/$pkgname

	cp -vr examples "$pkgdir"/usr/share/doc/$pkgname/
}

sha512sums="
20c92cc99669c2cc5ea9767545e1c749d38143d166e3e5b4b1940b8c551bc65d012bd47aa60dc8e97697c693e31ba462f0d08fc38df52adb64e76c62fc3ccc04  es-shell-0.9.2_git20220315.tar.gz
3d51fdfa2ea196d3e6b1dff79b1efadb5254566942ea61dba4a9792aae417c0ca05d1681a334a2c81ee674e8f63971dd6e7bcdbe56e6fa41fe7d7081928f578b  configure.ac.patch
"
