# Contributor: Francesco Colista <fcolista@alpinelinux.org>
# Maintainer: Francesco Colista <fcolista@alpinelinux.org>
pkgname=expect
pkgver=5.45.4
pkgrel=5
pkgdesc="A tool for automating interactive applications"
url="https://core.tcl-lang.org/expect/index"
arch="all"
# https://expect.sourceforge.net/FAQ.html#q6
license="NIST-PD"
makedepends="autoconf automake tcl-dev"
subpackages="$pkgname-dev $pkgname-doc"
source="https://downloads.sourceforge.net/project/expect/Expect/$pkgver/expect$pkgver.tar.gz
	07-file-handle.patch
	09-unsafe-traps.patch
	10-manpage.patch
	12-fdout.patch
	22-segfault-with-stubs.patch
	24-format.patch
	expect-5.45.4-covscan-fixes.patch
	expect-c99.patch
	expect-configure-c99.patch
"
builddir="$srcdir"/$pkgname$pkgver

prepare() {
	default_prepare
	update_config_sub
	autoreconf -i
}

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--localstatedir=/var \
		--mandir=/usr/share/man \
		--with-tcl=/usr/lib \
		--with-tclinclude=/usr/include \
		--disable-rpath
	make
}

check() {
	make test
}

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

sha512sums="
a8dc25e8175f67e029e15cbcfca1705165c1c4cb2dd37eaaaebffb61e3ba132d9519cd73ca5add4c3358a2b0b7a91e878279e8d0b72143ff2c287fce07e4659a  expect5.45.4.tar.gz
ccdff94648a732cfb12cb079e37449913579b536d43f46a1e95687c3be8d4ce84b01be6748b34b59a4b4bf1cbc755de96f8f7882d5bc5c9a704cb5ef3103836f  07-file-handle.patch
e8a3c4c6d634c135e1f3b7ccfb543281fdbaa83870670ff87bdd0aaf07c803f79353b512e49b311ecd8f701c9e2d0d3e2994a3d5b344cdd6f0220d92fc1cea7d  09-unsafe-traps.patch
f7760ba5ce60659cce4d64beaf3cf50ecd6a8af7714b704bbd08ba970e0883b0eb7ddfd83522f21bf1bbe86cdbe26d70d4517f9d58030128c2a311e6d18c6b30  10-manpage.patch
8675a93f3344e4eeb5024faa487bdcdfb0bc8ec86ed0abcf5612e130e346b35f7d9bf7d601714cc6acb32ccc77ecc309e51e39e0a0ad17f0a3ceeacc5031f6ce  12-fdout.patch
f4c7789feea3eae471c988d7c78ce78da1bd4ab765d142e7fce5a7a2a92e887310ba571ea2a010110f7e0859102fadfb56b2b7e1638c52586657299e6e332c91  22-segfault-with-stubs.patch
38b542330d26ca0dade87bfad20f71f7411fc2951d4d53706f938f83a862ed4868990bc24bdbffb09c9591cca22cca913e073605216311a36a008550c00b1b78  24-format.patch
0610e7e901857b773be7d5b01cae6a1844914b7f9ff1a7c5f02dc89e14dd6318711a2417f97a10fb28866fed77e16c7757ca6c6ca65e5603defddb551e9a14a3  expect-5.45.4-covscan-fixes.patch
dc0078b3ccd7aacfd86e24249b0570b3c0cdbf1c0b660a1414df0b28d32503995e7fca3b582d08dc94a4855ef3cc280f2fc9233c331f07e30c23ff6e8a9f1b27  expect-c99.patch
5e48866ffa0891f7c28edf871d563d67e7b720743feea1a199766b76b54316b97be4121a05c4de205b00eaa4efea8659349699d78fe12cb9777c89a36f2d6b78  expect-configure-c99.patch
"
