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

EAPI=8

CRATES="
"

RUST_MIN_VER="1.88.0"

inherit cargo eapi9-ver optfeature

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+"
# Autogenerated by pycargoebuild
# Dependent crate licenses
LICENSE+="
	MIT Unicode-3.0 ZLIB
	|| ( Apache-2.0 Boost-1.0 )
"
SLOT="0"
KEYWORDS="~amd64"

RDEPEND="
	net-wireless/iwd
	sys-apps/dbus
"

QA_FLAGS_IGNORED="usr/bin/iwmenu"

src_prepare() {
	default
	sed -i -e '/^lto =/d' Cargo.toml || die
}

src_install() {
	cargo_src_install

	local DOCS=( README.md )
	einstalldocs
}

pkg_postinst() {
	if ver_replacing -lt 0.4.0 && has_version gui-apps/walker; then
		ewarn "Walker launcher support is now dropped!"
	fi

	elog "Compatibility with:"
	elog "dev-libs/bemenu gui-apps/fuzzel x11-misc/dmenu x11-misc/rofi"
	elog "Use custom mode if your launcher is not supported."
	elog
	optfeature "using nerdfonts icons" media-fonts/symbols-nerd-font
	elog "Otherwise use \"--icon xdg\" for image-based icons from your XDG theme."
}
