# Maintainer: Taner Tas <taner76@gmail.com>
pkgname=advancemame
pkgver=3.7
pkgrel=1
pkgdesc="A port of the MAME emulator for Arcade Monitors and TVs but also for LCDs and PC monitors"
url="http://www.advancemame.it"
arch="all"
license="GPL"
makedepends="clang-dev sdl2-dev alsa-lib-dev freetype-dev zlib-dev expat-dev
	slang-dev linux-headers"
subpackages="$pkgname-doc $pkgname-data::noarch $pkgname-mess $pkgname-menu"
source="https://github.com/amadvance/${pkgname}/releases/download/v${pkgver}/${pkgname}-${pkgver}.tar.gz"
options="!check"

prepare() {
	default_prepare
}

build() {
	cd "$builddir"

export CC=clang
export CXX=clang++
export LD="g++ -fuse-ld=gold"

	./configure \
		--build=$CBUILD \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--localstatedir=/var \
		--enable-fb \
		--enable-sdl2
	make
}

package() {
	cd "$builddir"
	make bindir="${pkgdir}/usr/bin/" \
	datadir="${pkgdir}/usr/share/" \
	mandir="${pkgdir}/usr/share/man/" \
	pkgdocdir="${pkgdir}/usr/share/doc/${pkgname}/" \
	install
}

data() {
	pkgdesc="Distrubition files for advancemame"
	depends="$pkgname"
	mkdir -p "$subpkgdir"/usr/share/advance
	mv "$pkgdir"/usr/share/advance/* "$subpkgdir"/usr/share/advance/
}

mess() {
	pkgdesc="Advancemame port of MESS."
	mkdir -p "$subpkgdir"/usr/bin
	mv "$pkgdir"/usr/bin/advmess "$subpkgdir"/usr/bin/

}

menu() {
	pkgdesc="An emulator frontend with sound and animated previews of your games."
	mkdir -p "$subpkgdir"/usr/bin
	mv "$pkgdir"/usr/bin/advmenu "$subpkgdir"/usr/bin/

}
sha512sums="b5af59cdd3cf70dfae0769ed35eb6ce00a6f01d05eefcb687f322420faa2ee5aabf83394249c2ab7f7f1241d3fd09c2f0412666b2dbd27b91e7bc3622f925f74  advancemame-3.7.tar.gz"
