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

EAPI=8

MY_PN="${PN/-bin/}"

DESCRIPTION='A free and open-source Monero desktop wallet.'
HOMEPAGE='https://featherwallet.org/ https://github.com/feather-wallet/feather'
RELEASE_URI='https://github.com/feather-wallet/feather'
SRC_URI="
	amd64? ( ${RELEASE_URI}/releases/download/${PV}/${MY_PN}-${PV}-linux.zip -> ${P}.amd64.zip )
	arm64? ( ${RELEASE_URI}/releases/download/${PV}/${MY_PN}-${PV}-arm64.AppImage -> ${P}.arm64.AppImage )
	arm? ( ${RELEASE_URI}/releases/download/${PV}/${MY_PN}-${PV}-arm.AppImage -> ${P}.arm.AppImage )
	riscv? ( ${RELEASE_URI}/releases/download/${PV}/${MY_PN}-${PV}-riscv64.AppImage -> ${P}.riscv64.AppImage )
"
S="${WORKDIR}"
LICENSE='BSD'
SLOT='0'
KEYWORDS='~amd64 ~arm ~arm64 ~riscv'
RESTRICT='strip'
RDEPEND='sys-fs/fuse:0'
BDEPEND='app-arch/unzip'
QA_PREBUILT='*'

inherit desktop unpacker

src_install() {
	if use amd64; then
		unpack "${P}.amd64.zip"
		newbin "${MY_PN}-${PV}" feather
	elif use arm64; then
		newbin "${DISTDIR}/${P}.arm64.AppImage" feather
	elif use arm; then
		newbin "${DISTDIR}/${P}.arm.AppImage" feather
	elif use riscv; then
		newbin "${DISTDIR}/${P}.riscv64.AppImage" feather
	fi
	doicon -s 256x256 "${FILESDIR}"/feather.png
	make_desktop_entry "${PN}" Feather feather 'Utility;'
}