Move service file into its own repo

Move the service file for phosphor-time-manager from the bitbake recipe to
the source repository.

There is no need of making the root object path and
the busname as configurable variable,Hence this commit
also removes those configure variables.

Tested: Service file were getting installed where expected.

Signed-off-by: Ratan Gupta <ratagupt@linux.vnet.ibm.com>
Change-Id: Ib297b4a1b35400ce34962b1bdaa59c6441f24b19
diff --git a/meson.build b/meson.build
index af453fe..528b1d5 100644
--- a/meson.build
+++ b/meson.build
@@ -45,8 +45,6 @@
 # Get the config data and enable options
 
 conf_data = configuration_data()
-conf_data.set_quoted('BUSNAME', get_option('busname'))
-conf_data.set_quoted('OBJPATH_BMC', get_option('obj_path_bmc'))
 conf_data.set('DEFAULT_TIME_MODE', get_option('default_time_mode'))
 
 configure_file(output: 'config.h', configuration: conf_data)
@@ -69,6 +67,20 @@
                                  dependencies : deps)
 ############################################################################
 
+# Install the files into the build directory
+
+systemd = dependency ('systemd')
+systemd_system_unit_dir = systemd.get_pkgconfig_variable('systemdsystemunitdir',
+                                                         define_variable: ['prefix',
+                                                                           get_option('prefix')
+                                                                          ])
+configure_file(input : 'xyz.openbmc_project.Time.Manager.service',
+               output : 'xyz.openbmc_project.Time.Manager.service',
+               copy : true,
+               install_dir : systemd_system_unit_dir)
+
+#############################################################################
+
 # Build binaries
 
 executable('phosphor-time-manager',
diff --git a/meson_options.txt b/meson_options.txt
index 8f03101..92d1f11 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -11,15 +11,7 @@
 # otherwise default value will be considered
 # Command: meson configure -Doption=value
 
-# Ex: meson configure -Dobj_path_bmc=path
-
-option ( 'busname', type : 'string',
-          value : 'xyz.openbmc_project.Time.Manager',
-          description : 'The Time Manager DBus busname to own')
-
-option ( 'obj_path_bmc', type : 'string',
-          value : '/xyz/openbmc_project/time/bmc',
-          description : 'The bmc epoch Dbus root')
+# Ex: meson configure -Ddefault_time_mode=Mode::Manual
 
 option ( 'default_time_mode', type : 'combo',
           choices: ['Mode::Manual', 'Mode::NTP'],
diff --git a/types.hpp b/types.hpp
index 0f9f57c..f490823 100644
--- a/types.hpp
+++ b/types.hpp
@@ -2,6 +2,14 @@
 
 #include <xyz/openbmc_project/Time/Synchronization/server.hpp>
 
+namespace // anonymous
+{
+
+constexpr auto OBJPATH_BMC = "/xyz/openbmc_project/time/bmc";
+constexpr auto BUSNAME = "xyz.openbmc_project.Time.Manager";
+
+} // namespace
+
 namespace phosphor
 {
 namespace time
diff --git a/xyz.openbmc_project.Time.Manager.service b/xyz.openbmc_project.Time.Manager.service
new file mode 100644
index 0000000..8089316
--- /dev/null
+++ b/xyz.openbmc_project.Time.Manager.service
@@ -0,0 +1,16 @@
+[Unit]
+Description=Phosphor Time Manager daemon
+Wants=mapper-wait@-xyz-openbmc_project-time-sync_method.service
+After=mapper-wait@-xyz-openbmc_project-time-sync_method.service
+Wants=mapper-wait@-xyz-openbmc_project-state-host0.service
+After=mapper-wait@-xyz-openbmc_project-state-host0.service
+
+[Service]
+Restart=always
+ExecStart=/usr/bin/env phosphor-timemanager
+SyslogIdentifier=phosphor-timemanager
+Type=dbus
+BusName=xyz.openbmc_project.Time.Manager
+
+[Install]
+WantedBy=multi-user.target