# Copyright 2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

inherit desktop

DESCRIPTION="3D animation program based of sandbox game Minecraft"
HOMEPAGE="https://www.mineimator.com"
SRC_URI="https://www.mineimator.com/dl/mineimator-${PV}-tar -> ${P}.tar.gz"

S="${WORKDIR}"

LICENSE="all-rights-reserved"
SLOT="0"
KEYWORDS="amd64"

QA_PRESTRIPPED="
	opt/${PN}/Mine-imator/Mine-imator
	opt/${PN}/Mine-imator/Data/Libraries/*
"

RDEPEND="
	app-crypt/mit-krb5
	dev-libs/libwacom
"
BDEPEND="app-arch/tar"

src_install() {
	insinto /opt/${PN}
	doins -r *

	fperms +x /opt/${PN}/Mine-imator/Mine-imator

	mkdir -p "${ED}/usr/bin" || die
	cat <<-'EOF' >"${ED}/usr/bin/mineimator"
		#!/bin/sh
		exec /opt/mineimator-bin/Mine-imator/Mine-imator "$@"
	EOF
	fperms +x /usr/bin/mineimator

	if [[ -f "${ED}/opt/${PN}/Mine-imator/Data/Splashes/peaceful_creeper.png" ]]; then
		newicon -s 256 "${ED}/opt/${PN}/Mine-imator/Data/Splashes/peaceful_creeper.png" mineimator.png
	fi

	make_desktop_entry \
		"mineimator" \
		"Mine-imator" \
		"mineimator" \
		"Graphics;3DGraphics;" \
		"Path=/opt/${PN}/Mine-imator"
}