# SliTaz package receipt.

PACKAGE="gens-gs"
VERSION="2.15.5_gs_r7"
CATEGORY="games"
SHORT_DESC="An emulator for Sega Genesis, Sega CD and 32X."
MAINTAINER="slaxemulator@gmail.com"
LICENSE="GPL2"
_VERSION=gs-r7
TARBALL="Gens-${_VERSION}.tar.gz"
WEB_SITE="http://info.sonicretro.org/Gens/GS"
WGET_URL="https://retrocdn.net/images/6/6d/$TARBALL"
TAGS="emulator sega"

DEPENDS="gtk+ libsdl libglu-mesa"
BUILD_DEPENDS="gtk+-dev libsdl libsdl-dev nasm autoconf automake"

# What is the latest version available today?
current_version()
{
	wget -O - https://raw.githubusercontent.com/lutris/gens/master/ChangeLog.txt 2>/dev/null | \
	sed '/new in Gens/!d;s|.*v||;s|/.*|_gs_r7|;q'
}

# Rules to configure and make the package.
compile_rules()
{
	cd $src
	patch -Np1 -i $stuff/gens-gtk.patch || return 1
	chmod +x install-sh
	./configure $CONFIGURE_ARGS
	find -name "Makefile" | xargs sed -i 's|-DGTK_DISABLE_DEPRECATED||g' 
	make -j1 && make -j1 DESTDIR=$DESTDIR install
}

# Rules to gen a SliTaz package suitable for Tazpkg.
genpkg_rules()
{
	mkdir -p $fs/usr/share $fs/usr/lib/mdp
	cp -a $install/usr/bin $fs/usr
	cp -a $install/usr/lib/mdp/*.so  $fs/usr/lib/mdp
	cp -a $install/usr/share/applications $fs/usr/share
	cp -a $install/usr/share/gens $fs/usr/share
}