Do not hardcode "/usr/local/share" directory in the
configuration file for the firmware and uboot paths.

Use meson's configure_file()/configuration_data()
to substitute it with the "datadir" value.

Signed-off-by: Roman Bogorodskiy <[email protected]>
---
 src/bhyve/{bhyve.conf => bhyve.conf.in} |  4 ++--
 src/bhyve/meson.build                   | 13 +++++++++++--
 2 files changed, 13 insertions(+), 4 deletions(-)
 rename src/bhyve/{bhyve.conf => bhyve.conf.in} (87%)

diff --git a/src/bhyve/bhyve.conf b/src/bhyve/bhyve.conf.in
similarity index 87%
rename from src/bhyve/bhyve.conf
rename to src/bhyve/bhyve.conf.in
index a845937d87..5ed6a14db5 100644
--- a/src/bhyve/bhyve.conf
+++ b/src/bhyve/bhyve.conf.in
@@ -4,12 +4,12 @@
 
 # Path to a directory with firmware files. By default it's pointing
 # to the directory that sysutils/bhyve-firmware installs files into.
-#firmware_dir = "/usr/local/share/uefi-firmware"
+#firmware_dir = "@DATADIR@/uefi-firmware"
 
 # Path to the U-Boot loader for the arm64 guests.
 # By default it's pointing to the loader installed
 # by the sysutils/u-boot-bhyve-arm64 port
-#uboot_path = "/usr/local/share/u-boot/u-boot-bhyve-arm64/u-boot.bin"
+#uboot_path = "@DATADIR@/u-boot/u-boot-bhyve-arm64/u-boot.bin"
 
 # Set timeout for the bhyveload(8) command. This might be necessary
 # because in case of errors bhyveload(8) drops to an interactive
diff --git a/src/bhyve/meson.build b/src/bhyve/meson.build
index 11920d9c3e..564b7e5db2 100644
--- a/src/bhyve/meson.build
+++ b/src/bhyve/meson.build
@@ -50,12 +50,21 @@ if conf.has('WITH_BHYVE')
     ],
   }
 
-  virt_conf_files += files('bhyve.conf')
+  bhyve_conf_data = configuration_data({
+    'DATADIR': datadir,
+  })
+  bhyve_conf = configure_file(
+    input: 'bhyve.conf.in',
+    output: 'bhyve.conf',
+    configuration: bhyve_conf_data,
+  )
+
+  virt_conf_files += bhyve_conf
   virt_aug_files += files('libvirtd_bhyve.aug')
   virt_test_aug_files += {
     'name': 'test_libvirtd_bhyve.aug',
     'aug': files('test_libvirtd_bhyve.aug.in'),
-    'conf': files('bhyve.conf'),
+    'conf': bhyve_conf,
     'test_name': 'libvirtd_bhyve',
     'test_srcdir': meson.current_source_dir(),
     'test_builddir': meson.current_build_dir(),
-- 
2.52.0

Reply via email to