summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaciej Barć <xgqt@gentoo.org>2023-06-17 22:12:43 +0200
committerMaciej Barć <xgqt@gentoo.org>2023-06-17 22:17:53 +0200
commite4e08176055954b3e15e9a1d794869135e2fd29a (patch)
treeaf37f4748b07ec0b4d5a70f1ddffc3d7d3f654fa
parentsys-apps/openrazer: drop old 3.6.0 (diff)
downloadgentoo-e4e08176055954b3e15e9a1d794869135e2fd29a.tar.gz
gentoo-e4e08176055954b3e15e9a1d794869135e2fd29a.tar.bz2
gentoo-e4e08176055954b3e15e9a1d794869135e2fd29a.zip
sys-apps/openrazer: port to linux-mod-r1
Bug: https://bugs.gentoo.org/908692 Closes: https://bugs.gentoo.org/908695 Signed-off-by: Maciej Barć <xgqt@gentoo.org>
-rw-r--r--sys-apps/openrazer/openrazer-3.6.1-r1.ebuild165
1 files changed, 165 insertions, 0 deletions
diff --git a/sys-apps/openrazer/openrazer-3.6.1-r1.ebuild b/sys-apps/openrazer/openrazer-3.6.1-r1.ebuild
new file mode 100644
index 000000000000..f0e886f47110
--- /dev/null
+++ b/sys-apps/openrazer/openrazer-3.6.1-r1.ebuild
@@ -0,0 +1,165 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{9..11} )
+
+inherit readme.gentoo-r1 systemd udev xdg-utils distutils-r1 linux-mod-r1
+
+DESCRIPTION="Drivers and user-space daemon to control Razer devices on GNU/Linux"
+HOMEPAGE="https://openrazer.github.io/
+ https://github.com/openrazer/openrazer/"
+
+if [[ ${PV} == *9999* ]] ; then
+ inherit git-r3
+ EGIT_REPO_URI="https://github.com/${PN}/${PN}.git"
+else
+ SRC_URI="https://github.com/${PN}/${PN}/archive/${PV}.tar.gz
+ -> ${P}.tar.gz"
+ KEYWORDS="~amd64 ~x86"
+fi
+
+LICENSE="GPL-2+"
+SLOT="0"
+
+IUSE="+client +daemon"
+REQUIRED_USE="
+ client? ( daemon )
+ daemon? ( ${PYTHON_REQUIRED_USE} )
+ test? ( daemon )
+"
+
+RDEPEND="
+ client? ( dev-python/numpy[${PYTHON_USEDEP}] )
+ daemon? (
+ acct-group/plugdev
+ dev-python/daemonize[${PYTHON_USEDEP}]
+ dev-python/dbus-python[${PYTHON_USEDEP}]
+ dev-python/notify2[${PYTHON_USEDEP}]
+ dev-python/pygobject:3[${PYTHON_USEDEP}]
+ dev-python/pyudev[${PYTHON_USEDEP}]
+ dev-python/setproctitle[${PYTHON_USEDEP}]
+ x11-libs/gtk+:3[introspection]
+ x11-misc/xautomation
+ x11-misc/xdotool
+ )
+"
+BDEPEND="
+ ${RDEPEND}
+ virtual/linux-sources
+"
+
+DOCS=( README.md )
+
+DOC_CONTENTS="To successfully use OpenRazer: load desired kernel module
+(razeraccessory, razerkbd, razerkraken and/or razermouse),
+add your user to the \"plugdev\" group and start the OpenRazer daemon.
+To automatically start up the OpenRazer daemon on session login copy
+/usr/share/openrazer/openrazer-daemon.desktop file into Your user's
+~/.config/autostart/ directory."
+
+distutils_enable_tests unittest
+
+python_compile() {
+ if use daemon ; then
+ ( cd "${S}"/daemon || die ; distutils-r1_python_compile )
+ fi
+ if use client ; then
+ ( cd "${S}"/pylib || die ; distutils-r1_python_compile )
+ fi
+}
+
+python_install() {
+ if use daemon ; then
+ ( cd "${S}"/daemon || die ; distutils-r1_python_install )
+ python_scriptinto /usr/bin
+ python_newscript "${S}"/daemon/run_openrazer_daemon.py ${PN}-daemon
+ fi
+ if use client ; then
+ ( cd "${S}"/pylib || die ; distutils-r1_python_install )
+ fi
+}
+
+src_prepare() {
+ xdg_environment_reset
+ distutils-r1_src_prepare
+
+ # Remove bad tests.
+ rm "${S}"/daemon/tests/test_effect_sync.py || die
+}
+
+src_compile() {
+ local -a modargs=(
+ SUBDIRS="${S}"/driver
+ KERNELDIR="${KERNEL_DIR}"
+ )
+ local -a modlist=(
+ {razeraccessory,razerkbd,razerkraken,razermouse}="hid:${S}:driver"
+ )
+ linux-mod-r1_src_compile
+
+ distutils-r1_src_compile
+
+ if use daemon ; then
+ emake -C "${S}"/daemon PREFIX=/usr service
+ fi
+
+ readme.gentoo_create_doc
+}
+
+src_test() {
+ ( cd "${S}"/daemon/tests || die ; distutils-r1_src_test )
+}
+
+src_install() {
+ linux-mod-r1_src_install
+ distutils-r1_src_install
+
+ udev_dorules "${S}"/install_files/udev/99-razer.rules
+ exeinto "$(get_udevdir)"
+ doexe "${S}"/install_files/udev/razer_mount
+
+ # Install configuration example so that the daemon does not complain.
+ insinto /usr/share/${PN}
+ newins "${S}"/daemon/resources/razer.conf razer.conf.example
+
+ if use daemon ; then
+ # dbus service
+ insinto /usr/share/dbus-1/services
+ doins "${S}"/daemon/org.razer.service
+
+ # systemd unit
+ systemd_douserunit "${S}"/daemon/${PN}-daemon.service
+
+ # xdg autostart example file
+ insinto /usr/share/${PN}
+ doins "${S}"/install_files/desktop/openrazer-daemon.desktop
+
+ # Manpages
+ doman "${S}"/daemon/resources/man/${PN}-daemon.8
+ doman "${S}"/daemon/resources/man/razer.conf.5
+ fi
+}
+
+pkg_postinst() {
+ linux-mod-r1_pkg_postinst
+ udev_reload
+
+ if use daemon ; then
+ xdg_icon_cache_update
+ xdg_desktop_database_update
+ fi
+
+ readme.gentoo_print_elog
+}
+
+pkg_postrm() {
+ linux-mod-r1_pkg_postrm
+ udev_reload
+
+ if use daemon ; then
+ xdg_icon_cache_update
+ xdg_desktop_database_update
+ fi
+}