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

# Autogenerated by pycargoebuild 0.16.0

EAPI=8

CRATES="
	aho-corasick@1.1.5
	android_system_properties@0.1.6
	annotate-snippets@0.11.5
	anstream@1.0.0
	anstyle@1.0.14
	anstyle-parse@1.0.0
	anstyle-query@1.1.5
	anstyle-wincon@3.0.11
	anyhow@1.0.104
	ash@0.38.0+1.3.281
	async-channel@2.5.0
	async-executor@1.14.0
	async-fs@2.2.0
	async-io@2.6.0
	async-lock@3.4.2
	async-net@2.0.0
	async-process@2.5.0
	async-signal@0.2.14
	async-task@4.7.1
	atomic-waker@1.1.2
	autocfg@1.5.1
	bindgen@0.65.1
	bindgen@0.72.1
	bitflags@1.3.2
	bitflags@2.13.1
	blocking@1.6.2
	bumpalo@3.20.3
	byteorder@1.5.0
	cc@1.4.2
	cexpr@0.6.0
	cfg-expr@0.20.8
	cfg-if@1.0.4
	cfg_aliases@0.2.2
	chrono@0.4.45
	clang-sys@1.9.1
	colorchoice@1.0.5
	concurrent-queue@2.5.0
	convert_case@0.8.0
	cookie-factory@0.3.3
	core-foundation@0.10.1
	core-foundation-sys@0.8.7
	core-graphics@0.24.0
	core-graphics-types@0.2.0
	crossbeam-utils@0.8.22
	dbus@0.9.12
	ddc@0.2.2
	ddc-hi@0.4.1
	ddc-i2c@0.2.2
	ddc-macos@0.2.2
	ddc-winapi@0.2.2
	defmt@1.1.1
	defmt-macros@1.1.1
	defmt-parser@1.0.0
	downcast-rs@1.2.1
	drm-fourcc@2.2.0
	dtoa@0.4.8
	edid@0.3.0
	either@1.17.0
	env_filter@2.0.0
	env_logger@0.11.11
	equivalent@1.0.2
	errno@0.3.14
	event-listener@5.4.2
	event-listener-strategy@0.5.4
	fastrand@2.5.0
	find-msvc-tools@0.1.10
	foreign-types@0.5.0
	foreign-types-macros@0.2.4
	foreign-types-shared@0.3.1
	futures-core@0.3.33
	futures-io@0.3.33
	futures-lite@2.6.1
	futures-macro@0.3.33
	futures-task@0.3.33
	futures-util@0.3.33
	glob@0.3.4
	hashbrown@0.17.1
	heck@0.5.0
	hermit-abi@0.5.2
	home@0.5.12
	i2c@0.1.0
	i2c-linux@0.1.2
	i2c-linux-sys@0.2.1
	iana-time-zone@0.1.65
	iana-time-zone-haiku@0.1.2
	indexmap@2.14.0
	inotify@0.11.4
	inotify-sys@0.1.8
	io-kit-sys@0.4.1
	is_terminal_polyfill@1.70.2
	itertools@0.13.0
	itertools@0.15.0
	itoa@1.0.18
	jiff@0.2.35
	jiff-core@0.1.0
	jiff-static@0.2.35
	js-sys@0.3.104
	lazy_static@1.5.0
	lazycell@1.3.0
	libc@0.2.189
	libdbus-sys@0.2.7
	libloading@0.8.9
	libspa@0.9.2
	libspa-sys@0.9.2
	libudev-sys@0.1.4
	linked-hash-map@0.5.6
	linux-raw-sys@0.12.1
	linux-raw-sys@0.4.15
	log@0.4.33
	mach2@0.4.3
	macro_rules_attribute@0.2.3
	macro_rules_attribute-proc_macro@0.2.3
	mccs@0.1.3
	mccs-caps@0.1.3
	mccs-db@0.1.3
	memchr@1.0.2
	memchr@2.8.3
	minimal-lexical@0.2.1
	mio@1.2.2
	nix@0.30.1
	nom@3.2.1
	nom@7.1.3
	nom@8.0.0
	num-traits@0.2.19
	nvapi@0.1.4
	nvapi-sys@0.1.3
	once_cell@1.21.4
	once_cell_polyfill@1.70.2
	parking@2.2.1
	pastey@0.2.3
	peeking_take_while@0.1.2
	pin-project-lite@0.2.17
	piper@0.2.5
	pipewire@0.9.2
	pipewire-sys@0.9.2
	pkg-config@0.3.33
	polling@3.11.0
	portable-atomic@1.14.0
	portable-atomic-util@0.2.7
	prettyplease@0.2.37
	proc-macro2@1.0.107
	quick-xml@0.41.0
	quote@1.0.47
	regex@1.13.1
	regex-automata@0.4.18
	regex-syntax@0.8.11
	resize-slice@0.1.3
	rustc-hash@1.1.0
	rustc-hash@2.1.3
	rustix@0.38.44
	rustix@1.1.4
	rustversion@1.0.23
	ryu@1.0.23
	serde@1.0.229
	serde_core@1.0.229
	serde_derive@1.0.229
	serde_spanned@1.1.1
	serde_yaml@0.7.5
	serde_yaml@0.9.34+deprecated
	shlex@1.3.0
	shlex@2.0.1
	signal-hook-registry@1.4.8
	slab@0.4.12
	smallvec@1.15.2
	smol@2.0.2
	smol-macros@0.1.1
	socket2@0.6.5
	syn@2.0.119
	syn@3.0.3
	system-deps@7.0.8
	target-lexicon@0.13.5
	thiserror@1.0.69
	thiserror@2.0.20
	thiserror-impl@1.0.69
	thiserror-impl@2.0.20
	tokio@1.53.1
	toml@1.1.4+spec-1.1.0
	toml_datetime@1.1.1+spec-1.1.0
	toml_parser@1.1.3+spec-1.1.0
	toml_writer@1.1.2+spec-1.1.0
	udev@0.2.0
	unicode-ident@1.0.24
	unicode-segmentation@1.13.3
	unicode-width@0.2.2
	uninitialized@0.0.2
	unsafe-libyaml@0.2.11
	utf8parse@0.2.2
	v4l@0.14.0
	v4l-sys@0.3.0
	version-compare@0.2.1
	void@1.0.2
	wasi@0.11.1+wasi-snapshot-preview1
	wasm-bindgen@0.2.127
	wasm-bindgen-macro@0.2.127
	wasm-bindgen-macro-support@0.2.127
	wasm-bindgen-shared@0.2.127
	wayland-backend@0.3.16
	wayland-client@0.31.15
	wayland-protocols@0.32.13
	wayland-protocols-plasma@0.3.12
	wayland-protocols-wlr@0.3.12
	wayland-scanner@0.31.11
	wayland-sys@0.31.11
	which@4.4.2
	widestring@1.2.1
	winapi@0.3.9
	winapi-i686-pc-windows-gnu@0.4.0
	winapi-x86_64-pc-windows-gnu@0.4.0
	windows-core@0.62.2
	windows-implement@0.60.2
	windows-interface@0.59.3
	windows-link@0.2.1
	windows-result@0.4.1
	windows-strings@0.5.1
	windows-sys@0.59.0
	windows-sys@0.61.2
	windows-targets@0.52.6
	windows_aarch64_gnullvm@0.52.6
	windows_aarch64_msvc@0.52.6
	windows_i686_gnu@0.52.6
	windows_i686_gnullvm@0.52.6
	windows_i686_msvc@0.52.6
	windows_x86_64_gnu@0.52.6
	windows_x86_64_gnullvm@0.52.6
	windows_x86_64_msvc@0.52.6
	winnow@1.0.4
	xdg@3.0.0
	yaml-rust@0.4.5
"

inherit cargo udev systemd

DESCRIPTION="Automatic brightness adjustment based on screen contents and ALS"
HOMEPAGE="https://github.com/maximbaz/wluma"
SRC_URI="
	https://github.com/maximbaz/wluma/archive/refs/tags/${PV}.tar.gz -> ${P}.gh.tar.gz
	${CARGO_CRATE_URIS}
"

LICENSE="ISC"
# Dependent crate licenses
LICENSE+="
	Apache-2.0 Apache-2.0-with-LLVM-exceptions BSD ISC MIT Unicode-3.0
"
SLOT="0"
KEYWORDS="~amd64"

DEPEND="
	media-libs/libv4l:=
	media-libs/vulkan-loader:=
"
RDEPEND="${DEPEND}"

RUST_MIN_VER="1.88"

# 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}"

DOCS=(
	README.md
)

src_install() {
	cargo_src_install
	einstalldocs

	udev_dorules 90-wluma-backlight.rules
	systemd_douserunit "${PN}.service"
}

pkg_postinst() {
	udev_reload
}

pkg_postrm() {
	udev_reload
}