diff --git a/sys-power/power-profiles-daemon/Manifest b/sys-power/power-profiles-daemon/Manifest new file mode 100644 index 0000000..c70075d --- /dev/null +++ b/sys-power/power-profiles-daemon/Manifest @@ -0,0 +1,6 @@ +AUX messon-allow-building-with-orcrun.patch 1589 BLAKE2B 7a015117c4f5cc10ad2fed8aec8db170b4c1142cb3b7475c7bcd03748e7b0a79e7faf06b00ec8a31b766a66e5d32841cd2d779e12fe29705ef6e21075283fea3 SHA512 1de72c48b3a85b6b904e94ba1a087c97c9300dc62b8a9db71db449237f5c3d9767e80c5561a59fa47b3c29d1d4d2d9299aa8be615ddd44dba19084f84e892928 +AUX power-profiles-daemon.confd 49 BLAKE2B 22d24c4826d99e27dfe3fd7ece09af8e610c09fac6e3cd85bcec976a0cae52eac244383fc9606546e3dd08b0ba0207cccac9e035b25ffcbb46b4c81c5d81ec9f SHA512 6f8fdcc7f7cd3e8d0aea8a61befc168dcf3e5701c9b814de72b47b95f5280e1c2a646b7f45a68895c73a9625a9b5cb379233b1935fd2a6a39427cff2160fe323 +AUX power-profiles-daemon.initd 681 BLAKE2B 8da1cebbc48c653c138744656f43deee20f7d89dce6f2a48d7289a58bfc791eeb1fd188041adddc3cb4fb43858b7d5b36f8c139278a21833fc301879d29ef184 SHA512 e7b7820d7084cfce4abda398c622c50961366ed7f24dc91ea654d9821ec55b7954ea33781da107971bb4b1b111800f18b930b402cf12a668a5adba7c5a2e71a9 +AUX power-profiles-daemon.tmpfiles 58 BLAKE2B 4448feb0622ee95017b38dd0cc54a012df20132d4e409dc80ddea2137132892c3d596f752829b5644dc5f4aa420a6f0b050824e775881920982b96fdd9783ee5 SHA512 35a32bb666e3bc84c304823775e4671b736fdaf07f74ee0806e6c201edbd9c76121d11e96457eb1a126136c7ba4d2516aa9f691d24813da62c06c7da39519199 +DIST power-profiles-daemon-0.12.tar.bz2 47846 BLAKE2B 7fb10e78c5ab6da32a4b460c8046e510c66bb0d31ca4c7e14db5772c547c420be078f3086b6b98e70063fed0924e783f5b26580a97e0898474040a2724b87f91 SHA512 d34e51deeed13ed307b9efac08336ce36879d7deeac5af803207d1c69f641993a509d96e149c3f150c5d20437867f3cbc6502fce6f63e08f0b23f23c7f90d948 +EBUILD power-profiles-daemon-0.12-r2.ebuild 2286 BLAKE2B 731d8f8e568e196d620a7b5d595086ed4f8b6062d6cd1c5a4817c3c564ccff204c020002e83e25501ea4733af35a5f60cf30f7837ffde7099432936079865a56 SHA512 09b76429d4d01b53697e39ef9995c3317a76ac0d28a2ef07c449a5d859f5506fbec9101e4ab359c4ad61bf759b724fc730374888d8b279583c7ade77beaae585 diff --git a/sys-power/power-profiles-daemon/files/messon-allow-building-with-orcrun.patch b/sys-power/power-profiles-daemon/files/messon-allow-building-with-orcrun.patch new file mode 100644 index 0000000..b249622 --- /dev/null +++ b/sys-power/power-profiles-daemon/files/messon-allow-building-with-orcrun.patch @@ -0,0 +1,42 @@ +diff -upr a/data/meson.build b/data/meson.build +--- a/data/meson.build 2023-03-19 15:50:13.898777755 +0300 ++++ b/data/meson.build 2023-03-19 16:29:38.607135861 +0300 +@@ -1,12 +1,14 @@ + data_conf = configuration_data() + data_conf.set('libexecdir', libexecdir) + +-configure_file( +- input: 'power-profiles-daemon.service.in', +- output: 'power-profiles-daemon.service', +- configuration: data_conf, +- install_dir: systemd_system_unit_dir, +-) ++if systemd_system_unit_dir != 'no' ++ configure_file( ++ input: 'power-profiles-daemon.service.in', ++ output: 'power-profiles-daemon.service', ++ configuration: data_conf, ++ install_dir: systemd_system_unit_dir, ++ ) ++endif + + configure_file( + input: 'net.hadess.PowerProfiles.conf.in', +diff -upr a/meson.build b/meson.build +--- a/meson.build 2023-03-19 15:50:13.898777755 +0300 ++++ b/meson.build 2023-03-19 16:16:50.064136551 +0300 +@@ -27,9 +27,11 @@ dbusconfdir = get_option('datadir') / 'd + dbusservicedir = get_option('datadir') / 'dbus-1' / 'system-services' + + systemd_system_unit_dir = get_option('systemdsystemunitdir') +-if systemd_system_unit_dir == 'auto' +- systemd_dep = dependency('systemd') +- systemd_system_unit_dir = systemd_dep.get_pkgconfig_variable('systemdsystemunitdir') ++if systemd_system_unit_dir != 'no' ++ if systemd_system_unit_dir == 'auto' ++ systemd_dep = dependency('systemd') ++ systemd_system_unit_dir = systemd_dep.get_pkgconfig_variable('systemdsystemunitdir') ++ endif + endif + gio_dep = dependency('gio-2.0') + gudev_dep = dependency('gudev-1.0', version: '>= 234') diff --git a/sys-power/power-profiles-daemon/files/power-profiles-daemon.confd b/sys-power/power-profiles-daemon/files/power-profiles-daemon.confd new file mode 100644 index 0000000..de3fd31 --- /dev/null +++ b/sys-power/power-profiles-daemon/files/power-profiles-daemon.confd @@ -0,0 +1,3 @@ +# /etc/conf.d/power-profiles-daemon + +#PPDARGS="" diff --git a/sys-power/power-profiles-daemon/files/power-profiles-daemon.initd b/sys-power/power-profiles-daemon/files/power-profiles-daemon.initd new file mode 100644 index 0000000..85013e2 --- /dev/null +++ b/sys-power/power-profiles-daemon/files/power-profiles-daemon.initd @@ -0,0 +1,28 @@ +#!/sbin/openrc-run +# Copyright 2022-2023 Calculate Linux Desktop Gnome by nemofsan +# Distributed under the terms of the GNU General Public License v2 + +name="power-profiles-daemon" +description="Access to power profile processing via D-bus" + +pidfile="/run/power-profiles-daemon.pid" +command="/usr/libexec/power-profiles-daemon" +command_args="${PPDARGS}" +supervisor="supervise-daemon" +command_args_foreground="" +command_background=true + +depend() { + use clock logger + need dbus +} + +start_pre() { + checkpath -d /var/lib/power-profiles-daemon +} + +reload() { + ebegin "Reloading ${RC_SVCNAME}" + ${supervisor} ${RC_SVCNAME} --signal HUP --pidfile "${pidfile}" + eend $? +} diff --git a/sys-power/power-profiles-daemon/files/power-profiles-daemon.tmpfiles b/sys-power/power-profiles-daemon/files/power-profiles-daemon.tmpfiles new file mode 100644 index 0000000..8b8c70d --- /dev/null +++ b/sys-power/power-profiles-daemon/files/power-profiles-daemon.tmpfiles @@ -0,0 +1 @@ +f /var/lib/power-profiles-daemon/state.ini 0644 root root diff --git a/sys-power/power-profiles-daemon/power-profiles-daemon-0.12-r2.ebuild b/sys-power/power-profiles-daemon/power-profiles-daemon-0.12-r2.ebuild new file mode 100644 index 0000000..a73dbdb --- /dev/null +++ b/sys-power/power-profiles-daemon/power-profiles-daemon-0.12-r2.ebuild @@ -0,0 +1,93 @@ +# Copyright 1999-2023 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 +PYTHON_COMPAT=( python3_{9..11} ) + +inherit meson python-single-r1 tmpfiles systemd + +DESCRIPTION="Makes power profiles handling available over D-Bus" +HOMEPAGE="https://gitlab.freedesktop.org/hadess/power-profiles-daemon/" +SRC_URI="https://gitlab.freedesktop.org/hadess/${PN}/-/archive/${PV}/${P}.tar.bz2" + +LICENSE="GPL-3+" +SLOT="0" +KEYWORDS="~amd64" + +IUSE="gtk-doc test orcrun" +REQUIRED_USE="${PYTHON_REQUIRED_USE}" + +RESTRICT="!test? ( test )" + +RDEPEND="${PYTHON_DEPS} + $(python_gen_cond_dep 'dev-python/pygobject:3[${PYTHON_USEDEP}]') + dev-libs/glib:2 + >=dev-libs/libgudev-234 + >=sys-auth/polkit-0.114 + sys-power/upower +" +DEPEND="${RDEPEND}" +BDEPEND=" + gtk-doc? ( dev-util/gi-docgen ) + test? ( + dev-util/umockdev + $(python_gen_cond_dep ' + dev-python/pygobject:3[${PYTHON_USEDEP}] + dev-python/python-dbusmock[${PYTHON_USEDEP}] + ') + ) +" + +PATCHES=( + # Add orcrun support + "${FILESDIR}/messon-allow-building-with-orcrun.patch" +) + +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_configure() { + local emesonargs=( + $(meson_use gtk-doc gtk_doc) + $(meson_use test tests) + ) + if use orcrun; then + emesonargs+=( + -Dsystemdsystemunitdir=no + ) + else + emesonargs+=( + -Dsystemdsystemunitdir="$(systemd_get_systemunitdir)" + ) + fi + meson_src_configure +} + +src_install() { + meson_src_install + python_fix_shebang "${D}"/usr/bin/powerprofilesctl + if use orcrun; then + newinitd "${FILESDIR}/power-profiles-daemon.initd" power-profiles-daemon + newconfd "${FILESDIR}/power-profiles-daemon.confd" power-profiles-daemon + newtmpfiles "${FILESDIR}/power-profiles-daemon.tmpfiles" power-profiles-daemon.conf + fi +} + +pkg_postinst() { + tmpfiles_process power-profiles-daemon.conf + if [[ -z "${REPLACING_VERSIONS}" ]]; then + if systemd_is_booted; then + elog "You need to enable the service:" + elog "# systemctl enable ${PN}" + else + elog "Don't forget to enable \"${PN}\" service, by runnning:" + elog "rc-update add ${PN} default && rc-service ${PN} start" + fi + fi +}