]> xenbits.xensource.com Git - libvirt.git/commitdiff
meson: allow systemd unitdir to be changed
authorDaniel P. Berrangé <berrange@redhat.com>
Thu, 6 Jun 2024 11:57:08 +0000 (12:57 +0100)
committerDaniel P. Berrangé <berrange@redhat.com>
Fri, 7 Jun 2024 13:04:19 +0000 (14:04 +0100)
We currently hardcode the systemd unitdir, but it is desirable to be
able to choose a different location in some cases. For examples, Fedora
flatpak builds change the RPM %_unitdir macro, but we can't currently
honour that.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
libvirt.spec.in
meson.build
meson_options.txt
src/meson.build

index 343015ad1d4166e7d3b53120bb403a00e5ab7c3e..244e5e824c87be8e0c16a84c5ea10c9f2a966a2f 100644 (file)
@@ -1327,6 +1327,7 @@ export SOURCE_DATE_EPOCH=$(stat --printf='%Y' %{_specdir}/libvirt.spec)
 %meson \
            -Drunstatedir=%{_rundir} \
            -Dinitconfdir=%{_sysconfdir}/sysconfig \
+           -Dunitdir=%{_unitdir} \
            %{?arg_qemu} \
            %{?arg_openvz} \
            %{?arg_lxc} \
index 62e49be37df0f957355f0dd39d46021ff85883d5..295613fd938d551a36ae7d7885124e4eba45bd7e 100644 (file)
@@ -95,6 +95,11 @@ if initconfdir == ''
   endif
 endif
 
+unitdir = get_option('unitdir')
+if unitdir == ''
+  unitdir = prefix / 'lib' / 'systemd' / 'system'
+endif
+
 bindir = prefix / get_option('bindir')
 datadir = prefix / get_option('datadir')
 includedir = prefix / get_option('includedir')
index cdc86877952233067076e1727f0f7a4ba8b9f00f..a4f1dd769f675079b50f17869721c5a63e3f913f 100644 (file)
@@ -4,6 +4,7 @@ option('packager_version', type: 'string', value: '', description: 'Extra packag
 option('system', type: 'boolean', value: false, description: 'Set install paths to system ones')
 option('runstatedir', type: 'string', value: '', description: 'State directory for temporary sockets, pid files, etc')
 option('initconfdir', type: 'string', value: '', description: 'directory for init script configuration files')
+option('unitdir', type: 'string', value: '', description: 'directory for systemd unit files')
 # dep:tests
 option('expensive_tests', type: 'feature', value: 'auto', description: 'set the default for enabling expensive tests (long timeouts)')
 option('test_coverage', type: 'boolean', value: false, description: 'turn on code coverage instrumentation')
index dd2682ec19fcccc99be47158464e9765373c0302..8cce42c7ad92e352b8d186bc0f42476cb14c1c6e 100644 (file)
@@ -812,11 +812,9 @@ endforeach
 if conf.has('WITH_LIBVIRTD')
   # Generate systemd service and socket unit files
   if init_script == 'systemd'
-    systemd_unit_dir = prefix / 'lib' / 'systemd' / 'system'
-
     install_data(
       guest_unit_files,
-      install_dir: systemd_unit_dir,
+      install_dir: unitdir,
     )
 
     if conf.has('WITH_POLKIT')
@@ -855,7 +853,7 @@ if conf.has('WITH_LIBVIRTD')
         output: service_out,
         configuration: unit_conf,
         install: true,
-        install_dir: systemd_unit_dir,
+        install_dir: unitdir,
       )
 
       foreach socket : unit.get('sockets', [ 'main', 'ro', 'admin' ])
@@ -881,7 +879,7 @@ if conf.has('WITH_LIBVIRTD')
           output: socket_out,
           configuration: unit_conf,
           install: true,
-          install_dir: systemd_unit_dir,
+          install_dir: unitdir,
         )
       endforeach
     endforeach