pkgname=('cmatrix')
pkgver=2.0
pkgrel=1
pkgdesc="A curses-based scrolling 'Matrix'-like screen"
arch=('i686' 'x86_64')
url="http://www.asty.org/cmatrix/"
msys2_repository_url="https://github.com/abishekvashok/cmatrix"
license=('spdx:GPL-3.0-or-later')
depends=('ncurses')
makedepends=('ncurses-devel' 'make' 'autotools' 'gcc')
source=("${pkgname}-${pkgver}.tar.gz"::"https://github.com/abishekvashok/cmatrix/archive/refs/tags/v${pkgver}.tar.gz"
		"define_TIOCSTI.patch")
sha256sums=('ad93ba39acd383696ab6a9ebbed1259ecf2d3cf9f49d6b97038c66f80749e99a'
            '70b3c94813427355490b5fad29ad8a116bae87e198033e1951ca218683317874')

prepare() {
	cd "${srcdir}/${pkgname}-${pkgver}"

	patch -p1 -i "${srcdir}/define_TIOCSTI.patch"
}

build() {
	cd "${srcdir}/${pkgname}-${pkgver}"

	autoreconf -i
	./configure --prefix=/usr --mandir=/usr/share/man

	make
}

package() {
	cd "${srcdir}/${pkgname}-${pkgver}"

	make DESTDIR="$pkgdir" install

	for i in AUTHORS NEWS COPYING README ChangeLog INSTALL; do
		install -Dm644 $i "$pkgdir/usr/share/doc/cmatrix/$i"
	done
}
