sys-power/switcheroo-control: add 3.0

Signed-off-by: Pacho Ramos <pacho@gentoo.org>
This commit is contained in:
Pacho Ramos
2025-09-27 18:01:52 +02:00
parent 7993a3e94e
commit f9597875e6
2 changed files with 88 additions and 0 deletions

View File

@@ -1 +1,2 @@
DIST switcheroo-control-2.6.tar.xz 29996 BLAKE2B 98204a1d0f3b92cc2b98ad9f382313aed4da5877ac6be607c48ee9386bd25087301e249907a7e1385eea357f0a3ce5fb2936fac688923dfa3555a9870f0d2e58 SHA512 ac8867a839ae958676f5c5c7bb4c25cbbcf70eb35a696bb3d80b388c31a9722e75311c041c4c60b8f1d00f405af97dd9173e99780a2be3c621ac759c4986a2d2
DIST switcheroo-control-3.0.tar.xz 33380 BLAKE2B 3d69968383b34f624ec0068bd986cb2b0be408d5617af350b128c0583511e3bfe7618e49826308ef87ef19b6cf681c41e786d9ab5fdd3cd1b868be5dd409ee18 SHA512 f2b3df3f0254a13f2e046269b612f90d15c4f6ce22f9e6463b156a03de271d30519fed9002f7faae76ca84a5e6001550d8003901d5a228694375ae56a640ad61

View File

@@ -0,0 +1,87 @@
# Copyright 2021-2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
PYTHON_COMPAT=( python3_{11..13} )
inherit meson python-single-r1 systemd udev
DESCRIPTION="D-Bus service to check the availability of dual-GPU"
HOMEPAGE="https://gitlab.freedesktop.org/hadess/switcheroo-control/"
SRC_URI="https://gitlab.freedesktop.org/hadess/switcheroo-control/-/releases/${PV}/downloads/${P}.tar.xz"
LICENSE="GPL-3"
SLOT="0"
KEYWORDS="~amd64 ~arm ~arm64 ~loong ~ppc64 ~riscv ~x86"
IUSE="gtk-doc selinux test video_cards_amdgpu video_cards_nouveau"
REQUIRED_USE="${PYTHON_REQUIRED_USE}"
RDEPEND="${PYTHON_DEPS}
$(python_gen_cond_dep 'dev-python/pygobject:3[${PYTHON_USEDEP}]')
>=dev-libs/glib-2.56.0:2
>=dev-libs/libgudev-232:=
>=x11-libs/libdrm-2.4.97[video_cards_amdgpu?,video_cards_nouveau?]
selinux? ( sec-policy/selinux-switcheroo )
"
DEPEND="${RDEPEND}"
BDEPEND="
$(python_gen_cond_dep 'dev-python/pygobject:3[${PYTHON_USEDEP}]')
dev-util/gdbus-codegen
gtk-doc? ( dev-util/gtk-doc )
test? (
$(python_gen_cond_dep 'dev-python/python-dbusmock[${PYTHON_USEDEP}]')
dev-util/umockdev
)
"
RESTRICT="!test? ( test )"
python_check_deps() {
if use test; then
python_has_version "dev-python/python-dbusmock[${PYTHON_USEDEP}]" &&
python_has_version "dev-python/pygobject:3[${PYTHON_USEDEP}]"
else
python_has_version "dev-python/pygobject:3[${PYTHON_USEDEP}]"
fi
}
src_prepare() {
default
# GPU detection fails when running on sandbox
sed -i -e '/discrete-detection/d' tests/meson.build || die
}
src_configure() {
local emesonargs=(
-Drulesdir="$(get_udevdir)"/rules.d
-Dsystemdsystemunitdir="$(systemd_get_systemunitdir)"
$(meson_use gtk-doc gtk_doc)
$(meson_use test tests)
)
meson_src_configure
}
src_install() {
meson_src_install
python_fix_shebang "${ED}"/usr/bin/switcherooctl
newinitd "${FILESDIR}"/${PN}-init.d ${PN}
}
pkg_postinst() {
udev_reload
if [[ -z "${REPLACING_VERSIONS}" ]]; then
elog "You need to enable the service:"
if systemd_is_booted; then
elog "# systemctl enable ${PN}"
else
elog "# rc-update add ${PN} default"
fi
fi
}
pkg_postrm() {
udev_reload
}