meson: fix the missing root mfg flag

The existing meson support missed this root mfg config so that root user
is bypassed. This patch fixed it.

After this change, Redfish/IPMI tests on meson built pacakge starts
working.

Tested:
1. QEMU tests all pass
2. Tested on real hardware, user-manager creats the root user upon
startup. I don't have ldap server but I tested the ldap config APIs
which worked fine.

Signed-off-by: Nan Zhou <nanzhoumails@gmail.com>
Change-Id: I57cd2829bc952d8062709b715c88a8efe02c349c
diff --git a/meson.build b/meson.build
index ab9d2d9..a60e22b 100644
--- a/meson.build
+++ b/meson.build
@@ -9,6 +9,10 @@
         ]
 )
 
+if get_option('root_user_mgmt').enabled()
+    add_project_arguments('-DENABLE_ROOT_USER_MGMT', language:'cpp')
+endif
+
 conf_data = configuration_data()
 
 conf_data.set_quoted('USER_MANAGER_BUSNAME', 'xyz.openbmc_project.User.Manager',
@@ -118,54 +122,34 @@
     pkgconfig: 'systemdsystemunitdir'
 )
 
-busconfig_dir = get_option('datadir') / 'dbus-1' / 'system.d'
-
-cert_manager_dir = get_option('datadir') / 'phosphor-certificate-manager'
-
-certs = []
-
-busconfig = []
-
-systemd_alias = []
-
-certs += 'nslcd'
-
-busconfig += 'phosphor-nslcd-cert-config.conf'
-
-systemd_alias += [[
-        '../phosphor-certificate-manager@.service',
-        'multi-user.target.wants/phosphor-certificate-manager@nslcd.service'
-]]
-
-
 install_data(
-    busconfig,
-    install_dir: busconfig_dir,
+    'phosphor-nslcd-cert-config.conf',
+    install_dir: get_option('datadir') / 'dbus-1' / 'system.d',
 )
 
 install_data(
-    certs,
-    install_dir: cert_manager_dir,
+    'nslcd',
+    install_dir: get_option('datadir') / 'phosphor-certificate-manager',
 )
 
-foreach service: systemd_alias
-    # Meson 0.61 will support this:
-    #install_symlink(
-    #      service,
-    #      install_dir: systemd_system_unit_dir,
-    #      pointing_to: link,
-    #  )
-    meson.add_install_script(
-        'sh', '-c',
-        'mkdir -p $(dirname $DESTDIR/@0@/@1@)'.format(systemd_system_unit_dir,
-            service[1]),
-    )
-    meson.add_install_script(
-        'sh', '-c',
-        'ln -s @0@ $DESTDIR/@1@/@2@'.format(service[0], systemd_system_unit_dir,
-            service[1]),
-    )
-endforeach
+# Figure out how to use install_symlink to install symlink to a file of another
+# recipe
+#install_symlink(
+#      'phosphor-certificate-manager@nslcd.service',
+#      install_dir: systemd_system_unit_dir / 'multi-user.target.wants',
+#      pointing_to: systemd_system_unit_dir / 'phosphor-certificate-manager@.service',
+#  )
+meson.add_install_script(
+    'sh', '-c',
+    'mkdir -p $(dirname $DESTDIR/@0@/@1@)'.format(systemd_system_unit_dir,
+        'multi-user.target.wants/phosphor-certificate-manager@nslcd.service'),
+)
+meson.add_install_script(
+    'sh', '-c',
+    'ln -s @0@ $DESTDIR/@1@/@2@'.format('../phosphor-certificate-manager@.service',
+        systemd_system_unit_dir,
+        'multi-user.target.wants/phosphor-certificate-manager@nslcd.service'),
+)
 
 subdir('phosphor-ldap-config')
 
diff --git a/meson_options.txt b/meson_options.txt
index cdf492c..b68ef14 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -1 +1,2 @@
 option('tests', type: 'feature', description: 'Build tests', value: 'enabled')
+option('root_user_mgmt', type: 'feature', description: 'Enable management of the root user', value: 'enabled')