summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Rasmus Thomsen <cogitri@exherbo.org> 2018-08-30 14:07:13 +0200
committerAvatar Rasmus Thomsen <cogitri@exherbo.org> 2018-08-30 18:33:38 +0200
commit13e7dab1cc7a55c229922f6fc8e675c009a43389 (patch)
treed8c68bfb0ce3c4769370721aa84d05239f567cce
parent4fd366fcf489a00c2d327e45f907689d24e53f27 (diff)
downloadcogitri-13e7dab1cc7a55c229922f6fc8e675c009a43389.tar.gz
cogitri-13e7dab1cc7a55c229922f6fc8e675c009a43389.tar.xz
libratbag: allow building with elogind
-rw-r--r--packages/dev-libs/libratbag/files/0001-build-support-building-with-elogind.patch58
-rw-r--r--packages/dev-libs/libratbag/files/ac384137bd56b0a4fa6c51f77015ef60eb964a97.patch119
-rw-r--r--packages/dev-libs/libratbag/libratbag-0.9-r2.exheres-0 (renamed from packages/dev-libs/libratbag/libratbag-0.9-r1.exheres-0)4
-rw-r--r--packages/dev-libs/libratbag/libratbag.exlib20
4 files changed, 197 insertions, 4 deletions
diff --git a/packages/dev-libs/libratbag/files/0001-build-support-building-with-elogind.patch b/packages/dev-libs/libratbag/files/0001-build-support-building-with-elogind.patch
new file mode 100644
index 0000000..69d8304
--- /dev/null
+++ b/packages/dev-libs/libratbag/files/0001-build-support-building-with-elogind.patch
@@ -0,0 +1,58 @@
+Upstream: https://github.com/libratbag/libratbag/pull/524
+From e6aa1bbb54ce94f9e1827d119be0daa573922016 Mon Sep 17 00:00:00 2001
+From: Rasmus Thomsen <cogitri@exherbo.org>
+Date: Thu, 30 Aug 2018 17:59:41 +0200
+Subject: [PATCH] build: support building with elogind
+
+---
+ meson.build | 9 +++++++--
+ meson_options.txt | 6 ++++++
+ 2 files changed, 13 insertions(+), 2 deletions(-)
+
+diff --git a/meson.build b/meson.build
+index 3081b35..0fa900a 100644
+--- a/meson.build
++++ b/meson.build
+@@ -50,10 +50,15 @@ config_h.set_quoted('LIBRATBAG_DATA_DIR', libratbag_data_dir)
+ pkgconfig = import('pkgconfig')
+ dep_udev = dependency('libudev')
+ dep_libevdev = dependency('libevdev')
+-dep_libsystemd = dependency('libsystemd', version : '>=227')
+ dep_glib = dependency('glib-2.0')
+ dep_lm = cc.find_library('m')
+
++if get_option('elogind')
++ logind_provider_dep = dependency('libelogind', version : '>=227')
++else
++ logind_provider_dep = dependency('libsystemd', version : '>=227')
++endif
++
+ enable_systemd = get_option('systemd')
+ if enable_systemd
+ dep_systemd = dependency('systemd')
+@@ -402,7 +407,7 @@ src_ratbagd = [
+
+ deps_ratbagd = [
+ dep_udev,
+- dep_libsystemd,
++ logind_provider_dep,
+ dep_libratbag,
+ ]
+
+diff --git a/meson_options.txt b/meson_options.txt
+index 7e51778..e2be8ce 100644
+--- a/meson_options.txt
++++ b/meson_options.txt
+@@ -33,3 +33,9 @@ option('systemd',
+ value : true,
+ description : 'Build systemd unit files'
+ )
++
++option('elogind',
++ type : 'boolean',
++ value : false,
++ description : 'Whether to use elogind or not (use systemd-logind instead)'
++)
+--
+2.18.0
+
diff --git a/packages/dev-libs/libratbag/files/ac384137bd56b0a4fa6c51f77015ef60eb964a97.patch b/packages/dev-libs/libratbag/files/ac384137bd56b0a4fa6c51f77015ef60eb964a97.patch
new file mode 100644
index 0000000..ce82913
--- /dev/null
+++ b/packages/dev-libs/libratbag/files/ac384137bd56b0a4fa6c51f77015ef60eb964a97.patch
@@ -0,0 +1,119 @@
+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(-)
+
+diff --git a/meson.build b/meson.build
+index 546ca5e9..58a8f170 100644
+--- a/meson.build
++++ b/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 == ''
+diff --git a/meson_options.txt b/meson_options.txt
+index b5f99328..7e517784 100644
+--- a/meson_options.txt
++++ b/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'
++)
diff --git a/packages/dev-libs/libratbag/libratbag-0.9-r1.exheres-0 b/packages/dev-libs/libratbag/libratbag-0.9-r2.exheres-0
index 84beecf..23867af 100644
--- a/packages/dev-libs/libratbag/libratbag-0.9-r1.exheres-0
+++ b/packages/dev-libs/libratbag/libratbag-0.9-r2.exheres-0
@@ -5,3 +5,7 @@ require libratbag
PLATFORMS="~amd64"
+DEFAULT_SRC_PREPARE_PATCHES+=(
+ "${FILES}"/ac384137bd56b0a4fa6c51f77015ef60eb964a97.patch
+)
+
diff --git a/packages/dev-libs/libratbag/libratbag.exlib b/packages/dev-libs/libratbag/libratbag.exlib
index fcea95d..0ee6cae 100644
--- a/packages/dev-libs/libratbag/libratbag.exlib
+++ b/packages/dev-libs/libratbag/libratbag.exlib
@@ -9,7 +9,9 @@ SUMMARY="A library to configure gaming mice "
LICENCES="MIT"
SLOT="0"
-MYOPTIONS=""
+MYOPTIONS="
+ ( providers: elogind systemd ) [[ number-selected = exactly-one ]]
+"
DEPENDENCIES="
build:
@@ -17,20 +19,30 @@ DEPENDENCIES="
build+run:
dev-lang/python:*[>=3]
dev-libs/glib:2
- sys-apps/systemd[>=227]
+ providers:elogind? ( sys-auth/elogind[>=227] )
+ providers:systemd? ( sys-apps/systemd[>=227] )
test:
app-admin/chrpath
dev-libs/check[>=0.9.10]
dev-util/valgrind
"
+DEFAULT_SRC_PREPARE_PATCHES=(
+ "${FILES}"/0001-build-support-building-with-elogind.patch
+)
+
MESON_SRC_CONFIGURE_PARAMS=(
-Dudev-dir=/usr/$(exhost --target)/lib/udev
- -Dudev-dir=/usr/$(exhost --target)/lib/systemd/system
+ -Dsystemd-unit-dir=/usr/$(exhost --target)/lib/systemd/system
-Denable-documentation=false
)
+MESON_SRC_CONFIGURE_OPTION_SWITCHES=(
+ providers:elogind
+ providers:systemd
+)
+
MESON_SRC_CONFIGURE_TESTS=(
- '-Denable-tests=true -Denable-tests=false'
+ '-Dtests=true -Dtests=false'
)