鼠标调节工具

This commit is contained in:
microcai 2023-02-18 02:03:01 +08:00
parent a3f17b3aae
commit 72a3638bad
5 changed files with 203 additions and 0 deletions

View File

@ -0,0 +1 @@
DIST libratbag-0.17.9.tar.gz 284953 BLAKE2B b4e37acea6b602402896d7cb17dddaf79626dfecea4a299a56df192aaca69ba36a0eac0a369ce67a6d8cbfa85bef716a03611d39979744231d41b3be1b605365 SHA512 a478e74329b2bf38e71485b324a148d8f6d912bcea2b500ac2cf10a7072fa396f691d131ade18ffec3d313eef5cd94ce646974b60ee864d2bd5937604e9d78fe

View File

@ -0,0 +1,69 @@
# Since musl doesn't provide error.h we need to check before adding it. If
# error.h is present in system only then we include it else we use err.h.
# Already there exists a bug report for this upstream [1]. The devs are open to
# a custom implementation of error but for now this patch for do it.
#
# [1]: https://github.com/libratbag/libratbag/issues/1253
#
# Closes: https://bugs.gentoo.org/830557
--- a/meson.build
+++ b/meson.build
@@ -74,8 +74,13 @@ dep_libevdev = dependency('libevdev')
dep_glib = dependency('glib-2.0')
dep_json_glib = dependency('json-glib-1.0')
dep_lm = cc.find_library('m')
+error_exists = cc.has_header('error.h')
dep_unistring = cc.find_library('unistring')
+if error_exists
+ add_global_arguments('-DHAVE_ERROR_H', language : 'c')
+endif
+
if get_option('logind-provider') == 'elogind'
dep_logind = dependency('libelogind', version : '>=227')
else
--- a/tools/hidpp10-dump-page.c
+++ b/tools/hidpp10-dump-page.c
@@ -23,7 +23,12 @@
#include <config.h>
#include <errno.h>
+#ifdef HAVE_ERROR_H
#include <error.h>
+#else
+#include <err.h>
+#define error(status, errno, ...) err(status, __VA_ARGS__)
+#endif
#include <fcntl.h>
#include <hidpp10.h>
--- a/tools/hidpp20-dump-page.c
+++ b/tools/hidpp20-dump-page.c
@@ -23,7 +23,12 @@
#include <config.h>
#include <errno.h>
+#ifdef HAVE_ERROR_H
#include <error.h>
+#else
+#include <err.h>
+#define error(status, errno, ...) err(status, __VA_ARGS__)
+#endif
#include <fcntl.h>
#include <hidpp20.h>
--- a/tools/hidpp20-reset.c
+++ b/tools/hidpp20-reset.c
@@ -23,7 +23,12 @@
#include <config.h>
#include <errno.h>
+#ifdef HAVE_ERROR_H
#include <error.h>
+#else
+#include <err.h>
+#define error(status, errno, ...) err(status, __VA_ARGS__)
+#endif
#include <fcntl.h>
#include <hidpp20.h>

View File

@ -0,0 +1,13 @@
#!/sbin/openrc-run
# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
description="system daemon to introspect and modify configurable mice"
pidfile="/run/${SVCNAME}.pid"
command="/usr/bin/ratbagd"
start_stop_daemon_args="--quiet"
command_background="true"
depend() {
need dbus
}

View File

@ -0,0 +1,105 @@
# 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 systemd udev
DESCRIPTION="Library to configure gaming mice"
HOMEPAGE="https://github.com/libratbag/libratbag"
SRC_URI="https://github.com/${PN}/${PN}/archive/ada99fb72e45e8e8555308ceb40ab8349e8d70b1.tar.gz -> ${P}.tar.gz"
S="${WORKDIR}/${PN}-ada99fb72e45e8e8555308ceb40ab8349e8d70b1"
LICENSE="MIT"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="doc elogind systemd test"
REQUIRED_USE="
${PYTHON_REQUIRED_USE}
^^ ( elogind systemd )
"
RESTRICT="mirror !test? ( test )"
BDEPEND="
${PYTHON_DEPS}
dev-lang/swig
virtual/pkgconfig
doc? (
$(python_gen_cond_dep '
dev-python/sphinx[${PYTHON_USEDEP}]
dev-python/sphinx-rtd-theme[${PYTHON_USEDEP}]
')
)
test? (
dev-libs/check
dev-libs/gobject-introspection
dev-util/valgrind
$(python_gen_cond_dep '
dev-python/pygobject:3[${PYTHON_USEDEP}]
dev-python/python-evdev[${PYTHON_USEDEP}]
')
)
"
RDEPEND="
${PYTHON_DEPS}
acct-group/plugdev
dev-libs/glib:2
dev-libs/json-glib
dev-libs/libevdev
dev-libs/libunistring:=
virtual/libudev:=
$(python_gen_cond_dep '
dev-python/pygobject:3[${PYTHON_USEDEP}]
dev-python/python-evdev[${PYTHON_USEDEP}]
')
elogind? ( sys-auth/elogind )
systemd? ( sys-apps/systemd )
"
DEPEND="
${RDEPEND}
dev-libs/gobject-introspection
"
src_prepare() {
default
if use elogind ; then
# Fix systemd includes for elogind
sed -i -e 's@include <systemd@include <elogind@' \
ratbagd/ratbag*.c || die
fi
}
src_configure() {
python_setup
local emesonargs=(
$(meson_use doc documentation)
$(meson_use systemd)
$(meson_use test tests)
-Ddbus-group="plugdev"
-Dlogind-provider=$(usex elogind elogind systemd)
-Dsystemd-unit-dir="$(systemd_get_systemunitdir)"
-Dudev-dir="${EPREFIX}$(get_udevdir)"
)
meson_src_configure
}
src_install() {
meson_src_install
python_fix_shebang "${ED}"/usr/bin/
newinitd "${FILESDIR}"/ratbagd.init ratbagd
}
pkg_postinst() {
if [[ -z "${REPLACING_VERSIONS}" ]] ; then
elog 'You need to be in "plugdev" group in order to access the'
elog 'ratbagd dbus interface'
fi
elog 'You may be required to create and/or be part of the "games" group if you intend on using piper'
}

View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<maintainer type="person" proxied="yes">
<email>alex@1stleg.com</email>
<name>Alex Barker</name>
</maintainer>
<maintainer type="project" proxied="proxy">
<email>proxy-maint@gentoo.org</email>
<name>Proxy Maintainers</name>
</maintainer>
<upstream>
<remote-id type="github">libratbag/libratbag</remote-id>
</upstream>
</pkgmetadata>