service_files: Add a simple service file

Tested: Verified that the @BINDIR@ is correctly overwritten

Signed-off-by: Brandon Kim <brandonkim@google.com>
Change-Id: I89feb7a133b3cabd75f8de7ee2b0c86d8003e8a4
diff --git a/meson.build b/meson.build
index ce64c4b..2366091 100644
--- a/meson.build
+++ b/meson.build
@@ -10,3 +10,6 @@
   ])
 
 subdir('src')
+
+# installation of systemd service files
+subdir('service_files')
diff --git a/service_files/meson.build b/service_files/meson.build
new file mode 100644
index 0000000..6b4dd8c
--- /dev/null
+++ b/service_files/meson.build
@@ -0,0 +1,9 @@
+systemd = dependency('systemd')
+conf_data = configuration_data()
+conf_data.set('BINDIR', get_option('prefix') / get_option('bindir'))
+configure_file(
+  input: 'xyz.openbmc_project.bios_bmc_smm_error_logger.service.in',
+  output: 'xyz.openbmc_project.bios_bmc_smm_error_logger.service',
+  configuration: conf_data,
+  install: true,
+  install_dir: systemd.get_variable(pkgconfig: 'systemdsystemunitdir'))
diff --git a/service_files/xyz.openbmc_project.bios_bmc_smm_error_logger.service.in b/service_files/xyz.openbmc_project.bios_bmc_smm_error_logger.service.in
new file mode 100644
index 0000000..35c67dc
--- /dev/null
+++ b/service_files/xyz.openbmc_project.bios_bmc_smm_error_logger.service.in
@@ -0,0 +1,9 @@
+[Unit]
+Description=BIOS BMC SMM Error Logger
+
+[Service]
+Type=simple
+ExecStart=@BINDIR@/bios-bmc-smm-error-logger
+
+[Install]
+WantedBy=multi-user.target