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

EAPI=8

CRATES="
"

inherit cargo

DESCRIPTION="Menu-driven Wi-Fi management interface for Linux"
HOMEPAGE="https://github.com/e-tho/iwmenu"
SRC_URI="https://github.com/e-tho/${PN}/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz"
SRC_URI+=" https://raw.githubusercontent.com/PPN-SD/vendor/refs/tags/${P}/${P}-crates.tar.xz"

LICENSE="GPL-3"
# Dependent crate licenses, autogenerated by pycargoebuild
LICENSE+="
	LGPL-2.1 MIT Unicode-DFS-2016
	|| ( Apache-2.0 Boost-1.0 )
"
SLOT="0"
KEYWORDS="~amd64"
IUSE="+nerdfonts"

DEPEND="
	net-wireless/iwd
	nerdfonts? ( media-fonts/symbols-nerd-font )
"
RDEPEND="${DEPEND}"

QA_FLAGS_IGNORED="usr/bin/iwmenu"

src_prepare() {
	default
	sed -i -e 's/^strip = true$/strip = false/g' Cargo.toml || die "failed to disable stripping"
}

src_install() {
	cargo_src_install

	local DOCS=(
		LICENSE.md README.md
	)
	einstalldocs
}

pkg_postinst() {
		elog "Compatibility with :"
		elog "gui-apps/fuzzel gui-apps/wofi x11-misc/dmenu x11-misc/rofi"
		elog "Use custom mode if your launcher is not supported."

	if use !nerdfonts; then
		elog "\nUse \"--icon xdg\" for image-based icons from your XDG theme."
	fi
}