build: Add meson build

Changes to note,
- `with_systemdsystemunitdir` and `with_tmpfilesdir` is removed since it
  is not being documented nor used in OpenBMC.
- Removed the Code coverage feature with `-DDHAVE_GCOV`, since it is not
  used and meson covers it.
- Removed `--enable-oe-sdk` for using the OpenBMC SDK. It should work
  directly with no change required.

Tested:
```
Jan 01 00:01:54 ipmid[709]: Try loading blob from persistent data
Jan 01 00:01:54 ipmid[709]: Stale blob data, resetting internals...
Jan 01 00:01:56 ipmid[709]: config loaded: /flash/bios
Jan 01 00:01:56 ipmid[709]: config loaded: /flash/image
Jan 01 00:01:56 ipmid[709]: config loaded: /flash/dummy
...
```

```
$ ls /usr/lib/blob-ipmid/
libfirmwareblob.so
libfirmwarecleanupblob.so  libversionblob.so
```

Testing the service,
```
$ echo "hello" > /tmp/test.txt
$ burn_my_bmc -command update -layout dummy -image /tmp/test.txt
Sending over the firmware image.
Opening the verification file
Committing to /flash/verify to trigger service
Calling stat on /flash/verify session to check status
running
success
Returned success
succeeded
```

On the BMC.
```
/run/initramfs$ cat dummy
hello
```

Change-Id: I21c7c33bd62c0ee40681cb40da90125c125bea2f
Signed-off-by: Willy Tu <wltu@google.com>
diff --git a/bmc/firmware-handler/meson.build b/bmc/firmware-handler/meson.build
new file mode 100644
index 0000000..7d6b719
--- /dev/null
+++ b/bmc/firmware-handler/meson.build
@@ -0,0 +1,126 @@
+firmware_inc = include_directories('.')
+
+# phosphor-ipmi-flash config
+config_data = []
+if get_option('update-type') == 'static-layout'
+  if get_option('reboot-update')
+    config_data += 'config-static-bmc-reboot.json'
+  else
+    if get_option('update-status')
+      config_data += 'config-static-bmc-with-update-status.json'
+    else
+      config_data += 'config-static-bmc.json'
+    endif
+  endif
+endif
+
+if get_option('host-bios')
+  config_data += 'config-bios.json'
+endif
+
+foreach data : config_data
+  configure_file(
+    input: data + '.in',
+    output: data,
+    configuration: conf_data,
+    install: true,
+    install_dir: get_option('datadir') / 'phosphor-ipmi-flash')
+endforeach
+
+# temp files
+install_data(
+  'phosphor-ipmi-flash.conf',
+  install_dir: get_option('libdir') / 'tmpfiles.d')
+
+# systemd configs
+systemd_data = [
+  'phosphor-ipmi-flash-bmc-prepare.target',
+  'phosphor-ipmi-flash-bmc-verify.target',
+  'phosphor-ipmi-flash-bmc-update.target',
+]
+
+if get_option('host-bios')
+  systemd_data += [
+    'phosphor-ipmi-flash-bios-prepare.target',
+    'phosphor-ipmi-flash-bios-verify.target',
+    'phosphor-ipmi-flash-bios-update.target']
+endif
+
+systemd = dependency('systemd')
+if systemd.found()
+  foreach data : systemd_data
+    configure_file(
+      input: data + '.in',
+      output: data,
+      configuration: conf_data,
+      install: true,
+      install_dir: systemd.get_variable(pkgconfig: 'systemdsystemunitdir'))
+  endforeach
+endif
+
+firmware_source = [
+  'firmware_handlers_builder.cpp',
+  'firmware_handler.cpp',
+  'lpc_handler.cpp']
+
+if (get_option('lpc-type') == 'aspeed-lpc' or
+    not get_option('tests').disabled())
+  firmware_source += 'lpc_aspeed.cpp'
+endif
+
+if (get_option('lpc-type') == 'nuvoton-lpc' or
+    not get_option('tests').disabled())
+  firmware_source += 'lpc_nuvoton.cpp'
+endif
+
+if (get_option('p2a-type') == 'aspeed-p2a' or
+    not get_option('tests').disabled())
+  firmware_source += 'pci_handler.cpp'
+endif
+
+if get_option('p2a-type') == 'nuvoton-p2a-vga'
+  firmware_source += 'pci_nuvoton_handler.cpp'
+endif
+
+if get_option('p2a-type') == 'nuvoton-p2a-mbox'
+  firmware_source += 'pci_nuvoton_handler.cpp'
+endif
+
+if get_option('net-bridge')
+  firmware_source += 'net_handler.cpp'
+endif
+
+firmware_pre = declare_dependency(
+  include_directories: [root_inc, bmc_inc, firmware_inc],
+  dependencies : [
+    dependency('sdbusplus', fallback: ['sdbusplus', 'sdbusplus_dep']),
+    common_dep,
+    blobs_dep,
+    sys_dep,
+    phosphor_logging_dep])
+
+firmware_lib = static_library(
+  'firmwareblob',
+  firmware_source,
+  conf_h,
+  implicit_include_directories: false,
+  dependencies: firmware_pre)
+
+firmware_dep = declare_dependency(
+  link_with: firmware_lib,
+  dependencies: firmware_pre)
+
+shared_module(
+  'firmwareblob',
+  'main.cpp',
+  implicit_include_directories: false,
+  dependencies: [
+    firmware_dep,
+    dependency('libipmid'),
+  ],
+  install: true,
+  install_dir: get_option('libdir') / 'blob-ipmid')
+
+if not get_option('tests').disabled()
+  subdir('test')
+endif
\ No newline at end of file
diff --git a/bmc/firmware-handler/test/meson.build b/bmc/firmware-handler/test/meson.build
new file mode 100644
index 0000000..38a8a1c
--- /dev/null
+++ b/bmc/firmware-handler/test/meson.build
@@ -0,0 +1,42 @@
+firmware_tests = [
+  'handler',
+  'stat',
+  'canhandle',
+  'write',
+  'writemeta',
+  'open',
+  'close',
+  'sessionstat',
+  'commit',
+  'state_notyetstarted',
+  'state_uploadinprogress',
+  'state_verificationpending',
+  'state_verificationstarted',
+  'state_verificationcompleted',
+  'state_updatepending',
+  'state_updatestarted',
+  'state_updatecompleted',
+  'state_notyetstarted_tarball',
+  'multiplebundle',
+  'json',
+  'skip']
+
+foreach t : firmware_tests
+  test(
+    t,
+    executable(
+      t.underscorify(), 'firmware_' + t + '_unittest.cpp',
+      build_by_default: false,
+      implicit_include_directories: false,
+      include_directories: [root_inc, bmc_test_inc, firmware_inc],
+      dependencies: [firmware_dep, gtest, gmock]))
+endforeach
+
+file_handler_test = executable(
+  'file_handler',
+  'file_handler_unittest.cpp',
+  build_by_default: false,
+  implicit_include_directories: false,
+  include_directories: [root_inc, bmc_inc, bmc_test_inc, firmware_inc],
+  dependencies: [common_dep, blobs_dep, gtest, gmock])
+test('file_handler', file_handler_test)
diff --git a/bmc/meson.build b/bmc/meson.build
new file mode 100644
index 0000000..0ccd3c2
--- /dev/null
+++ b/bmc/meson.build
@@ -0,0 +1,25 @@
+bmc_inc = include_directories('.')
+
+common_pre = declare_dependency(
+  include_directories: [root_inc, bmc_inc])
+
+common_lib = static_library(
+  'common',
+  'buildjson.cpp',
+  'file_handler.cpp',
+  'fs.cpp',
+  'general_systemd.cpp',
+  'skip_action.cpp',
+  implicit_include_directories: false,
+  dependencies: common_pre)
+
+common_dep = declare_dependency(
+  link_with: common_lib,
+  dependencies: common_pre)
+
+if not get_option('tests').disabled()
+  subdir('test')
+endif
+
+subdir('firmware-handler')
+subdir('version-handler')
\ No newline at end of file
diff --git a/bmc/test/meson.build b/bmc/test/meson.build
new file mode 100644
index 0000000..c579ec8
--- /dev/null
+++ b/bmc/test/meson.build
@@ -0,0 +1 @@
+bmc_test_inc = include_directories('.')
diff --git a/bmc/version-handler/meson.build b/bmc/version-handler/meson.build
new file mode 100644
index 0000000..f5b4694
--- /dev/null
+++ b/bmc/version-handler/meson.build
@@ -0,0 +1,35 @@
+version_inc = include_directories('.')
+
+version_pre = declare_dependency(
+  include_directories: [root_inc, version_inc],
+  dependencies : [
+    common_dep,
+    firmware_dep,
+  ])
+
+version_lib = static_library(
+  'versionblob',
+  'version_handler.cpp',
+  'version_handlers_builder.cpp',
+  implicit_include_directories: false,
+  dependencies: version_pre)
+
+
+version_dep = declare_dependency(
+  link_with: version_lib,
+  dependencies: common_pre)
+
+shared_module(
+  'versionblob',
+  'main.cpp',
+  implicit_include_directories: false,
+  dependencies: [
+    version_dep,
+    dependency('libipmid'),
+  ],
+  install: true,
+  install_dir: get_option('libdir') / 'blob-ipmid')
+
+if not get_option('tests').disabled()
+  subdir('test')
+endif
\ No newline at end of file
diff --git a/bmc/version-handler/test/meson.build b/bmc/version-handler/test/meson.build
new file mode 100644
index 0000000..4c12464
--- /dev/null
+++ b/bmc/version-handler/test/meson.build
@@ -0,0 +1,19 @@
+version_tests = [
+  'json',
+  'canhandle_enumerate',
+  'createhandler',
+  'open',
+  'close',
+  'read',
+  'stat']
+
+foreach t : version_tests
+  test(
+    t,
+    executable(
+      t.underscorify(), 'version_' + t + '_unittest.cpp',
+      build_by_default: false,
+      implicit_include_directories: false,
+      include_directories: [root_inc, bmc_test_inc, version_inc],
+      dependencies: [version_dep, blobs_dep, gtest, gmock]))
+endforeach