New package: libratbag-0.9.902.

This commit is contained in:
maxice8 2018-08-16 08:09:07 -03:00
parent 4119248849
commit a9312d8b6a
No known key found for this signature in database
GPG Key ID: 543B9D4F4299F06B
6 changed files with 259 additions and 0 deletions

1
srcpkgs/libratbag-devel Symbolic link
View File

@ -0,0 +1 @@
libratbag

View File

@ -0,0 +1,3 @@
#!/bin/sh
sv check dbus >/dev/null || exit 1
exec ratbagd

View File

@ -0,0 +1,116 @@
From ac384137bd56b0a4fa6c51f77015ef60eb964a97 Mon Sep 17 00:00:00 2001
From: maxice8 <30738253+maxice8@users.noreply.github.com>
Date: Thu, 16 Aug 2018 19:33:42 -0300
Subject: [PATCH] meson.build meson_options.txt: Add systemd switch (#510)
Allows systems that provide libelogind (which provides a portion of
libsystemd that libratbag uses) to also compile without having to patch
out the rest of the build to remove the full systemd dependency.
This commit:
- Adds a systemd swith on meson_options.txt, a boolean set to true as
default to keep expected behaivour
- Adds a check on meson.build for the systemd switch and adds
dep_systemd
- Guards sections meant to generate systemd service units under the
systemd switch
---
meson.build | 56 +++++++++++++++++++++++++++--------------------
meson_options.txt | 6 +++++
2 files changed, 38 insertions(+), 24 deletions(-)
--- meson.build
+++ meson.build
@@ -50,10 +50,14 @@ pkgconfig = import('pkgconfig')
dep_udev = dependency('libudev')
dep_libevdev = dependency('libevdev')
dep_libsystemd = dependency('libsystemd', version : '>=227')
-dep_systemd = dependency('systemd')
dep_glib = dependency('glib-2.0')
dep_lm = cc.find_library('m')
+enable_systemd = get_option('systemd')
+if enable_systemd
+ dep_systemd = dependency('systemd')
+endif
+
#### libutil.a ####
src_libutil = [
'src/libratbag-util.c',
@@ -437,35 +441,39 @@ configure_file(input : 'dbus/org.freedesktop.ratbag_devel1.conf.in',
configuration : config_ratbagd_devel)
#### unit file ####
-unitdir = get_option('systemd-unit-dir')
-if unitdir == ''
- libdir = get_option('libdir')
- default_unitdir = dep_systemd.get_pkgconfig_variable('systemdsystemunitdir')
- # Fedora uses lib64 but systemd is in lib. Hack around this so it
- # works out of the box.
- intended_unitdir = join_paths(get_option('prefix'), get_option('libdir'), 'systemd')
- if get_option('prefix') == '/usr' and intended_unitdir != default_unitdir
- message('''
- systemd unitdir libdir mismatch detected, changing unitdir to
- @0@
- or specify with
- mesonconf -Dsystemd-unit-dir=<path>
-
- See https://github.com/libratbag/libratbag/issues/188
- '''.format(default_unitdir))
- unitdir = default_unitdir
- else
- unitdir = intended_unitdir
+if enable_systemd
+ unitdir = get_option('systemd-unit-dir')
+ if unitdir == ''
+ libdir = get_option('libdir')
+ default_unitdir = dep_systemd.get_pkgconfig_variable('systemdsystemunitdir')
+ # Fedora uses lib64 but systemd is in lib. Hack around this so it
+ # works out of the box.
+ intended_unitdir = join_paths(get_option('prefix'), get_option('libdir'), 'systemd')
+ if get_option('prefix') == '/usr' and intended_unitdir != default_unitdir
+ message('''
+ systemd unitdir libdir mismatch detected, changing unitdir to
+ @0@
+ or specify with
+ mesonconf -Dsystemd-unit-dir=<path>
+
+ See https://github.com/libratbag/libratbag/issues/188
+ '''.format(default_unitdir))
+ unitdir = default_unitdir
+ else
+ unitdir = intended_unitdir
+ endif
endif
endif
config_bindir = configuration_data()
config_bindir.set('bindir', join_paths(get_option('prefix'), get_option('bindir')))
-configure_file(input : 'ratbagd/ratbagd.service.in',
- output : 'ratbagd.service',
- configuration : config_bindir,
- install_dir : unitdir)
+if enable_systemd
+ configure_file(input : 'ratbagd/ratbagd.service.in',
+ output : 'ratbagd.service',
+ configuration : config_bindir,
+ install_dir : unitdir)
+endif
dbusdir = get_option('dbus-root-dir')
if dbusdir == ''
--- meson_options.txt
+++ meson_options.txt
@@ -27,3 +27,9 @@ option('dbus-group',
type: 'string',
value : '',
description : 'The UNIX group that is granted access to the ratbagd D-Bus service. By default all users may access it.')
+
+option('systemd',
+ type : 'boolean',
+ value : true,
+ description : 'Build systemd unit files'
+)

View File

@ -0,0 +1,24 @@
Source: maxice8
Upstream: https://github.com/libratbag/libratbag/pull/507
Reason: fixes errors of PATH_MAX being undeclared due to limits.h not being included
--- src/libratbag-data.c
+++ src/libratbag-data.c
@@ -28,6 +28,7 @@
#include <assert.h>
#include <stdlib.h>
#include <glib.h>
+#include <limits.h>
#include "libratbag.h"
#include "libratbag-private.h"
--- tools/lur-command.c
+++ tools/lur-command.c
@@ -31,6 +31,7 @@
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
+#include <limits.h>
#include <liblur.h>
#include <libratbag-util.h>

View File

@ -0,0 +1,76 @@
Source: maxice8
Upstream: No, but feel free
Reason: removes usage of non-portable of error.h
--- tools/hidpp10-dump-page.c
+++ tools/hidpp10-dump-page.c
@@ -23,7 +23,7 @@
#include <config.h>
#include <errno.h>
-#include <error.h>
+#include <err.h>
#include <fcntl.h>
#include <hidpp10.h>
@@ -95,7 +95,7 @@ main(int argc, char **argv)
path = argv[argc - 1];
fd = open(path, O_RDWR);
if (fd < 0)
- error(1, errno, "Failed to open path %s", path);
+ err(errno, "Failed to open path %s", path);
hidpp_device_init(&base, fd);
dev = hidpp10_device_new(&base, HIDPP_WIRED_DEVICE_IDX, HIDPP10_PROFILE_UNKNOWN, 5);
--- tools/hidpp20-dump-page.c
+++ tools/hidpp20-dump-page.c
@@ -23,7 +23,7 @@
#include <config.h>
#include <errno.h>
-#include <error.h>
+#include <err.h>
#include <fcntl.h>
#include <hidpp20.h>
@@ -112,12 +112,12 @@ main(int argc, char **argv)
path = argv[argc - 1];
fd = open(path, O_RDWR);
if (fd < 0)
- error(1, errno, "Failed to open path %s", path);
+ err(errno, "Failed to open path %s", path);
hidpp_device_init(&base, fd);
dev = hidpp20_device_new(&base, 0xff);
if (!dev)
- error(1, 0, "Failed to open %s as a HID++ 2.0 device", path);
+ err(0, "Failed to open %s as a HID++ 2.0 device", path);
hidpp20_onboard_profiles_get_profiles_desc(dev, &info);
--- tools/hidpp20-reset.c
+++ tools/hidpp20-reset.c
@@ -23,7 +23,7 @@
#include <config.h>
#include <errno.h>
-#include <error.h>
+#include <err.h>
#include <fcntl.h>
#include <hidpp20.h>
@@ -88,12 +88,12 @@ main(int argc, char **argv)
path = argv[argc - 1];
fd = open(path, O_RDWR);
if (fd < 0)
- error(1, errno, "Failed to open path %s", path);
+ err(errno, "Failed to open path %s", path);
hidpp_device_init(&base, fd);
dev = hidpp20_device_new(&base, 0xff);
if (!dev)
- error(1, 0, "Failed to open %s as a HID++ 2.0 device", path);
+ err(0, "Failed to open %s as a HID++ 2.0 device", path);
hidpp20_onboard_profiles_get_profiles_desc(dev, &info);

View File

@ -0,0 +1,39 @@
# Template file for 'libratbag'
pkgname=libratbag
version=0.9.902
revision=1
build_style=meson
configure_args="-Denable-tests=false -Dsystemd-unit-dir=''
-Dsystemd=false"
hostmakedepends="pkg-config git swig"
makedepends="elogind-devel eudev-libudev-devel libglib-devel libevdev-devel
python3-devel"
depends="dbus python3-evdev python3-gobject"
short_desc="DBus daemon to configure gaming mice"
maintainer="maxice8 <thinkabit.ukim@gmail.com>"
license="MIT"
homepage="https://github.com/libratbag/libratbag"
distfiles="https://github.com/libratbag/libratbag/archive/v${version}.tar.gz"
checksum=01c0dac6b8cd997c3bec84a51c0a86fc8727e3a20635bf7e2c5e0f0b8c5df34c
if [ "$CROSS_BUILD" ]; then
case "$XBPS_TARGET_MACHINE" in
x86_64*|i686*) ;;
*) broken="Requires gobject introspection"
esac
fi
post_install() {
vsv ratbagd
vlicense COPYING
}
libratbag-devel_package() {
depends="libratbag-${version}_${revision}"
short_desc+=" - development files"
pkg_install() {
vmove usr/include
vmove usr/lib/pkgconfig
vmove "usr/lib/*.so"
}
}