Upstream: https://gitlab.freedesktop.org/bolt/bolt/merge_requests/103 (rebased)
From 3330913f5979208c622d5525ff358a12c0973d98 Mon Sep 17 00:00:00 2001
From: Rasmus Thomsen <cogitri@exherbo.org>
Date: Tue, 28 Aug 2018 23:25:41 +0200
Subject: [PATCH] build: optionalise systemd unit installation
--- meson.build
+++ meson.build
@@ -76,7 +76,6 @@ libudev = dependency('libudev')
 unix    = dependency('gio-unix-2.0')
 udev    = dependency('udev')
 polkit  = dependency('polkit-gobject-1')
-systemd = dependency('systemd')
 libsysd = dependency('libsystemd')
 
 git     = find_program('git', required: false)
@@ -95,7 +94,12 @@ mandir = get_option('mandir')
 
 dbdir = get_option('db-path')
 udevdir = udev.get_pkgconfig_variable('udevdir')
-unitdir = systemd.get_pkgconfig_variable('systemdsystemunitdir')
+
+unitdir = ''
+if get_option('systemd')
+  systemd = dependency('systemd')
+  unitdir = systemd.get_pkgconfig_variable('systemdsystemunitdir')
+endif
 
 version_split = meson.project_version().split('.')
 version_major = version_split[0]
@@ -262,9 +266,11 @@ unit_file = configure_file(
   configuration: subs
 )
 
-install_data(unit_file,
-  install_dir: unitdir
-)
+if unitdir != ''
+  install_data(unit_file,
+    install_dir: unitdir
+  )
+endif
 
 install_data('data/90-bolt.rules',
   install_dir: join_paths(udevdir, 'rules.d')
--- meson_options.txt
+++ meson_options.txt
@@ -1,3 +1,4 @@
 option('db-path', type: 'string', value: '/var/lib/boltd', description: 'Directory for the device database')
 option('man', type: 'combo', choices: ['auto', 'true', 'false'], value: 'auto', description: 'Build man pages')
 option('privileged-group', type: 'string', value: 'wheel', description: 'Name of privileged group')
+option('systemd', type: 'boolean', value: 'true', description: 'Whether or not to install the systemd unit')
