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

EAPI=8

DESCRIPTION="The first messaging network operating without user identifiers of any kind"
HOMEPAGE="https://github.com/simplex-chat/simplex-chat"
_PG="simplex-chat"
_PN="simplex-desktop"
SRC_URI="https://github.com/${_PG}/${_PG}/releases/download/v${PV}/${_PN}-ubuntu-22_04-x86_64.deb -> ${P}.deb"

LICENSE="AGPL-3"
SLOT="0"
KEYWORDS="~amd64"
IUSE=""

RDEPEND="
"
DEPEND="
    ${RDEPEND}
"

src_unpack() {
    mkdir "${S}"
    # cd "${S}"
    ar x "${DISTDIR}/${P}.deb"
    tar xf data.tar.zst -C "${S}"
}

src_prepare() {
    default
    # e.g. eapply_user
}

# src_configure() {
#     econf
# }

# src_compile() {
#     emake
# }

src_install() {
    # ls -la "${S}"
    insinto "/opt/"
    doins -r "${S}/opt/simplex"
    dosym "/opt/simplex/bin/simplex" "/bin/simplex-desktop"
}
