build: Minor cleanups

 - Touches up the proto dependency hierarchy to properly specify
   generated headers
 - Build the IPMI module as a shared_module to guarantee it is never
   static
 - Build the common library as possibly shared for dedepulication
   between the IPMI module and blobtool

Change-Id: Idbc72b8e124e744a7ccfd58c482813df645d41a1
Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/meson.build b/meson.build
index 5b8da86..a113ae5 100644
--- a/meson.build
+++ b/meson.build
@@ -10,13 +10,6 @@
   ]
 )
 
-cpp = meson.get_compiler('cpp')
-cpp.has_header('boost/endian/arithmetic.hpp')
-cpp.has_header('nlohmann/json.hpp')
-protobuf_dep = dependency('protobuf')
-ipmi_blob_dep = dependency('phosphor-ipmi-blobs')
-phosphor_logging_dep = dependency('phosphor-logging')
-
 subdir('proto')
 subdir('include')
 subdir('src')
diff --git a/proto/meson.build b/proto/meson.build
index 02d46d9..5c2ec4a 100644
--- a/proto/meson.build
+++ b/proto/meson.build
@@ -7,24 +7,22 @@
     '@INPUT@'
   ],
   output: [
-    'binaryblob.pb.cc',
     'binaryblob.pb.h',
+    'binaryblob.pb.cc',
   ],
   input: 'binaryblob.proto')
 
 binaryblobproto_pre = declare_dependency(
   include_directories: include_directories('.'),
-  dependencies: dependency('protobuf')
-)
+  dependencies: dependency('protobuf'))
 
 binaryblobproto_lib = static_library(
   'binaryblob_proto',
-  src_pb,
+  src_pb[1],
   implicit_include_directories: false,
-  dependencies: binaryblobproto_pre
-)
+  dependencies: binaryblobproto_pre)
 
 binaryblobproto_dep = declare_dependency(
   dependencies: binaryblobproto_pre,
-  link_with: binaryblobproto_lib
-)
+  link_with: binaryblobproto_lib,
+  sources: src_pb[0])
diff --git a/src/meson.build b/src/meson.build
index ca4b091..94637a1 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -1,40 +1,32 @@
 binarystoreblob_pre = declare_dependency(
-  include_directories: [
-    include_directories('.'),
-    blobstore_includes,
-  ],
+  include_directories: blobstore_includes,
   dependencies: [
-    protobuf_dep,
-    ipmi_blob_dep,
-    phosphor_logging_dep,
+    dependency('phosphor-ipmi-blobs'),
+    dependency('phosphor-logging'),
     binaryblobproto_dep,
-  ]
-)
+  ])
 
-binarystoreblob_lib = static_library(
+binarystoreblob_lib = library(
   'binarystoreblob',
   'binarystore.cpp',
   'sys.cpp',
   'sys_file_impl.cpp',
   'handler.cpp',
-  src_pb,
   implicit_include_directories: false,
   dependencies: binarystoreblob_pre,
-)
+  install: true)
 
 binarystoreblob_dep = declare_dependency(
   link_with: binarystoreblob_lib,
-  dependencies: binarystoreblob_pre
-)
+  dependencies: binarystoreblob_pre)
 
-library(
+shared_module(
   'binarystore',
   'main.cpp',
   implicit_include_directories: false,
   dependencies: binarystoreblob_dep,
   install: true,
-  install_dir: get_option('libdir') / 'blob-ipmid'
-)
+  install_dir: get_option('libdir') / 'blob-ipmid')
 
 if not get_option('blobtool').disabled()
   executable(
@@ -42,6 +34,5 @@
     'blobtool.cpp',
     implicit_include_directories: false,
     dependencies: binarystoreblob_dep,
-    install: true
-  )
+    install: true)
 endif