1 |
|
# Copyright 2018-2021 Gentoo Authors
|
|
1 |
# Copyright 2018-2023 Gentoo Authors
|
2 |
2 |
# Distributed under the terms of the GNU General Public License v2
|
3 |
3 |
|
4 |
4 |
EAPI=7
|
5 |
5 |
|
6 |
|
inherit systemd udev
|
|
6 |
inherit systemd toolchain-funcs udev
|
7 |
7 |
|
8 |
8 |
DESCRIPTION="Led controller for Logitech G- Keyboards"
|
9 |
9 |
HOMEPAGE="https://github.com/MatMoul/g810-led"
|
... | ... | |
17 |
17 |
RDEPEND="
|
18 |
18 |
hidapi? ( dev-libs/hidapi:= )
|
19 |
19 |
!hidapi? ( virtual/libusb:= )
|
20 |
|
"
|
21 |
|
|
|
20 |
"
|
22 |
21 |
DEPEND="${RDEPEND}"
|
23 |
22 |
|
24 |
23 |
DOCS=("README.md" "sample_profiles" "sample_effects")
|
25 |
24 |
|
|
25 |
# Fix for GCC 13; Bug #895426
|
|
26 |
# See https://github.com/MatMoul/g810-led/pull/302
|
|
27 |
PATCHES=( "${FILESDIR}/g810-led-0.4.2_gcc13.patch" )
|
|
28 |
|
|
29 |
src_prepare() {
|
|
30 |
default
|
|
31 |
# See
|
|
32 |
# https://github.com/systemd/systemd/issues/4288
|
|
33 |
# https://sourceforge.net/p/sigrok/mailman/sigrok-devel/thread/12691365.gQiffmFRoU%40pebbles.site/
|
|
34 |
# We remove the MODE-bit since it's already set to 660+GROUP="input" by default udev rules
|
|
35 |
sed -i \
|
|
36 |
-e 's|MODE="666"|TAG+="uaccess",|' \
|
|
37 |
udev/g810-led.rules || die
|
|
38 |
}
|
|
39 |
|
26 |
40 |
src_compile() {
|
27 |
|
emake LIB="$(usex hidapi hidapi libusb)"
|
|
41 |
emake LIB="$(usex hidapi hidapi libusb)" CXX="$(tc-getCXX)" bin-linked
|
28 |
42 |
}
|
29 |
43 |
|
30 |
44 |
src_install() {
|
31 |
45 |
dolib.so "lib/libg810-led.so.${PV}"
|
32 |
46 |
dosym "libg810-led.so.${PV}" "/usr/$(get_libdir)/libg810-led.so"
|
33 |
47 |
|
|
48 |
insinto /etc/g810-led/
|
|
49 |
newins sample_profiles/group_keys profile
|
|
50 |
newins sample_profiles/all_off reboot
|
|
51 |
|
34 |
52 |
dobin bin/g810-led
|
35 |
|
local boards=(213 410 413 512 513 610 910 pro)
|
|
53 |
local boards=(213 410 413 512 513 610 815 910 pro)
|
36 |
54 |
local x
|
37 |
55 |
for x in "${boards[@]}"; do
|
38 |
56 |
dosym g810-led "/usr/bin/g${x}-led"
|
39 |
57 |
done
|
40 |
58 |
|
|
59 |
insinto /usr/include/g810-led
|
|
60 |
doins src/classes/*.h
|
|
61 |
|
41 |
62 |
systemd_dounit systemd/g810-led.service
|
42 |
63 |
systemd_dounit systemd/g810-led-reboot.service
|
43 |
64 |
|
... | ... | |
45 |
66 |
|
46 |
67 |
einstalldocs
|
47 |
68 |
}
|
|
69 |
|
|
70 |
pkg_postinst() {
|
|
71 |
elog "The file /etc/g810-led/profile is run on boot and device insertion."
|
|
72 |
elog "The default file can be replaced by other examples:"
|
|
73 |
elog "/usr/share/doc/${PF}/sample_profiles"
|
|
74 |
elog "Read the documentation in:"
|
|
75 |
elog "/usr/share/doc/${PF}/"
|
|
76 |
elog "to make your own."
|
|
77 |
if systemd_is_booted; then
|
|
78 |
elog "To turn off the LEDs on shutdown and save power, do:"
|
|
79 |
elog "systemctl enable g810-led-reboot.service"
|
|
80 |
fi
|
|
81 |
}
|