# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

inherit desktop wrapper

DESCRIPTION="A tetris game with physics"
HOMEPAGE="https://stabyourself.net/nottetris2/"
SRC_URI="https://stabyourself.net/dl.php?file=${PN}2/${PN}2-source.zip -> ${P}.zip"

S="${WORKDIR}"

LICENSE="GPL-2"
SLOT="0"

# Currently not usable with love-0.8.0.
# Waiting for fixes from upstream.
KEYWORDS="~amd64 ~arm ~x86"

DEPEND=">=games-engines/love-0.8.0:*"
RDEPEND="${DEPEND}"
BDEPEND="app-arch/unzip"

src_unpack() {
	default
	#it is only one .love file (but with crappy name), so we can use asterisk
	mv *.love "${P}.zip"
	unpack "./${P}.zip"
	rm "${P}.zip"
}

src_install() {
	local dir="${GAMES_DATADIR}/love/${PN}"
	insinto "${dir}"
	doins -r .
	make_wrapper "${PN}" "love /usr/share/games/love/${PN}"
	make_desktop_entry "${PN}"
}

pkg_postinst() {
	elog "${PN} savegames and configurations are stored in:"
	elog "~/.local/share/love/${PN}/"
}