# POWER Maintainer: Alexander Baldeck <alex.bldck@gmail.com>
# Maintainer: Lukas Fleischer <lfleischer@archlinux.org>
# Contributor: Dan McGee <dan@archlinux.org>
# Contributor: Tom Newsom <Jeepster@gmx.co.uk>
# Contributor: Jason Chu <jason@archlinux.org>

pkgname=cscope
pkgver=15.9
pkgrel=3.1
pkgdesc="A developers tool for browsing program code"
arch=(x86_64 powerpc64le powerpc64 powerpc riscv64)
url="http://cscope.sourceforge.net/"
license=('BSD')
depends=('ncurses' 'sh')
source=("https://sourceforge.net/projects/cscope/files/cscope/v${pkgver}/${pkgname}-${pkgver}.tar.gz")
sha512sums=('f3b95da5eb5c036cd39215785990c7cce7ce7b8eda4b18e60792e70d01ffb63809ce32ace310a9aefd88e6761c1609039ccfab0e8e49f81730bc1630babbcb80')

build() {
	cd "${srcdir}/${pkgname}-${pkgver}"
	sed -i 's|/usr/local/lib/cs|/usr/lib/cs|' contrib/ocs

	./configure --prefix=/usr
	make
}

package() {
	cd "${srcdir}/${pkgname}-${pkgver}"
	make DESTDIR="${pkgdir}" install

	install -d "${pkgdir}"/usr/lib/cs
	install -Dm644 COPYING "${pkgdir}"/usr/share/licenses/"${pkgname}"/LICENSE

	cd contrib/xcscope
	install -Dm644 xcscope.el "${pkgdir}"/usr/share/emacs/site-lisp/xcscope.el
	install -m755 cscope-indexer "${pkgdir}"/usr/bin
}
