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

# Autogenerated by pycargoebuild 0.13.2

EAPI=8

CRATES="
"

inherit cargo

DESCRIPTION="Terminal file manager inspired by ranger"
HOMEPAGE="https://github.com/kamiyaa/joshuto"
SRC_URI="
	https://github.com/kamiyaa/joshuto/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz
	https://github.com/gentoo-zh-drafts/joshuto/releases/download/v${PV}/${P}-crates.tar.xz
	${CARGO_CRATE_URIS}
"

LICENSE="LGPL-3"
# Dependent crate licenses
LICENSE+="
	Apache-2.0 BSD Boost-1.0 CC0-1.0 ISC MIT MIT-0 MPL-2.0
	Unicode-DFS-2016 ZLIB
"
SLOT="0"
KEYWORDS="~amd64"

IUSE="X wayland +fzf"

RDEPEND="
	fzf? ( app-shells/fzf )
	wayland? ( gui-apps/wl-clipboard )
	X? (
		x11-misc/xclip
		x11-misc/xsel
	)
"

# rust does not use *FLAGS from make.conf, silence portage warning
# update with proper path to binaries this crate installs, omit leading /
QA_FLAGS_IGNORED="usr/bin/${PN}"

src_compile() {
	# project set strip=true in [profile.release]
	# portage complains: QA Notice: Pre-stripped files found
	# let portage do the strip
	export CARGO_PROFILE_RELEASE_STRIP=false
	cargo_src_compile
}

pkg_postinst() {
	elog ""
	elog "For proper devicons support, correct patched font is needed"
	elog "For example:"
	elog "https://github.com/ryanoasis/nerd-fonts"
	elog "or media-fonts/nerd-fonts"
	elog ""
}