# Contributor: Jean-Louis Fuchs <ganwell@fangorn.ch>
# Maintainer: Jean-Louis Fuchs <ganwell@fangorn.ch>
pkgname=vice
pkgver=3.1
pkgrel=0
pkgdesc="emulates the C64/DTV, C128, VIC20, almost all PETs, PLUS4 and CBM-II"
url="http://vice-emu.sourceforge.net/"
arch="all"
license="GPL"
makedepends="sdl2-dev giflib-dev ffmpeg-dev jpeg-dev libpng-dev alsa-lib-dev
	linux-headers texinfo automake autoconf bison flex"
subpackages="$pkgname-doc"
source="http://downloads.sourceforge.net/vice-emu/vice-$pkgver.tar.gz
	disable-fc-cache.patch
	fix__u_char.patch"
builddir="$srcdir/$pkgname-$pkgver"

prepare() {
	sed -i 's/\r//' "$builddir/src/opencbm.h"
	default_prepare
	sed -i 's/lib64/lib/g' configure.ac
	autoreconf -fi
}

build() {
	cd "$builddir"
	./configure --prefix=/usr \
		--libdir=/usr/lib \
		--enable-sdlui2 \
		--disable-no-pic \
		--enable-external-ffmpeg
	make
}

package() {
	cd "$builddir"
	make DESTDIR="$pkgdir" realdocdir="/usr/share/doc/vice" install
}

check() {
	make -C "$builddir" check
}

md5sums="f9018ca464b863da0bb1a82c56374432  vice-3.1.tar.gz
b1dee4fef59f835534683fabbe1fbbce  disable-fc-cache.patch
f562fcd4ce5b6a72008cc46d9ed19881  fix__u_char.patch"
sha256sums="3eb8159633816095006dec36c5c3edd055a87fd8bda193a1194a6801685d1240  vice-3.1.tar.gz
8058210e092c4943a55baeff47e6d5f3661aeb3686fd1f75e07f47888da9cc98  disable-fc-cache.patch
6e888ea744659e1da2f1d4df57e0bf9bf031b8ad8414b08581f085c6336c9a77  fix__u_char.patch"
sha512sums="bc02a3597a17dadb37c487e6942192c0e9dc1a7d4e440fbf0dc8a165dbb2dee60ddf157697a020d2780ddef56a0a67802768d5c6d117b9cf5cdc124de45bc579  vice-3.1.tar.gz
ed6fee34eefcb04c42b4575591dfeffca8548eae354dee66dabdbc4abac0311cbbedcdc07cdfcb01da4840d57ab331a31583e17160820462a2c064835a75d75d  disable-fc-cache.patch
3132be50c402068865b530ed9df71a073012623ce48e3fa162f33af7bdcdd6d890590955868bb5591e018c17359e860ccff9eb0cde9bfd99582ac921400e8f2f  fix__u_char.patch"
