build: add meson support
Port the existing autotools build system to meson, add meson wrap files
for all openbmc dependencies, and add appropriate meson rules to
gitignore.
Tested:
Verified executables all build, test cases pass, and executables
install. Checked configuration files are all installed into the same
locations as a Yocto-built autotools version of the package. Manually
checked the symlinks for the systemd service files.
```
$ DESTDIR=/tmp/certificate_test ninja install
$ find /tmp/certificate_test/lib /tmp/certificate_test/usr/local/share/phosphor-certificate-manager/
/tmp/certificate_test/lib
/tmp/certificate_test/lib/systemd
/tmp/certificate_test/lib/systemd/system
/tmp/certificate_test/lib/systemd/system/multi-user.target.wants
/tmp/certificate_test/lib/systemd/system/multi-user.target.wants/phosphor-certificate-manager@authority.service
/tmp/certificate_test/lib/systemd/system/multi-user.target.wants/phosphor-certificate-manager@bmcweb.service
/tmp/certificate_test/lib/systemd/system/bmc-vmi-ca-manager.service
/tmp/certificate_test/lib/systemd/system/phosphor-certificate-manager@.service
/tmp/certificate_test/usr/local/share/phosphor-certificate-manager/
/tmp/certificate_test/usr/local/share/phosphor-certificate-manager/authority
/tmp/certificate_test/usr/local/share/phosphor-certificate-manager/bmcweb
$ ls -n /tmp/certificate_test/lib/systemd/system/multi-user.target.wants
total 0
lrwxrwxrwx 1 1000 1000 40 Dec 3 15:37 phosphor-certificate-manager@authority.service -> ../phosphor-certificate-manager@.service
lrwxrwxrwx 1 1000 1000 40 Dec 3 15:37 phosphor-certificate-manager@bmcweb.service -> ../phosphor-certificate-manager@.service
```
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: Ib9700b5a3bb437ccc157a2d060067b8e2b777981
diff --git a/dist/meson.build b/dist/meson.build
new file mode 100644
index 0000000..7ed6046
--- /dev/null
+++ b/dist/meson.build
@@ -0,0 +1,67 @@
+systemd_system_unit_dir = systemd_dep.get_variable(
+ pkgconfig: 'systemdsystemunitdir'
+)
+busconfig_dir = get_option('datadir') / 'dbus-1' / 'system.d'
+cert_manager_dir = get_option('datadir') / 'phosphor-certificate-manager'
+
+certs = []
+busconfig = []
+service_files = [ 'phosphor-certificate-manager@.service' ]
+systemd_alias = []
+
+if not get_option('ca-cert-extension').disabled()
+ busconfig += 'busconfig/bmc-vmi-ca.conf'
+ service_files += 'bmc-vmi-ca-manager.service'
+endif
+
+if not get_option('config-bmcweb').disabled()
+ busconfig += 'busconfig/phosphor-bmcweb-cert-config.conf'
+ certs += 'env/bmcweb'
+ systemd_alias += [[
+ '../phosphor-certificate-manager@.service',
+ 'multi-user.target.wants/phosphor-certificate-manager@bmcweb.service'
+ ]]
+endif
+
+if not get_option('config-nslcd').disabled()
+ busconfig += 'busconfig/phosphor-nslcd-authority-cert-config.conf'
+ certs += 'env/authority'
+ systemd_alias += [[
+ '../phosphor-certificate-manager@.service',
+ 'multi-user.target.wants/phosphor-certificate-manager@authority.service'
+ ]]
+endif
+
+install_data(
+ service_files,
+ install_dir: systemd_system_unit_dir,
+)
+
+install_data(
+ busconfig,
+ install_dir: busconfig_dir,
+)
+
+install_data(
+ certs,
+ install_dir: cert_manager_dir,
+)
+
+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