build: move all shared_library/module to library with version suffix

The version suffix will create `.so`, `.so.0`, and `.so.0.1` and will be
compatiable with existing bitbake setup for phosphor-ipmi-host.

Also moved the dbus-sdr library output the `dbus-sdr` folder since the
shared module depends on libipmi20, but it can't find it due to the it
being in a different folder. Moving it to the same meson file fixes that
issue.

Also removed all unused declare_dependency. Built fine without it.

Tested:
dbus-sdr works now
```
ipmitool sdr
cpu0             | disabled          | ns
cpu0_core0       | disabled          | ns
cpu0_core1       | disabled          | ns
cpu0_core2       | disabled          | ns
...
```

Change-Id: Ib13a79c1b27a7c122c5a29237716898cd2e29b4c
Signed-off-by: Willy Tu <wltu@google.com>
diff --git a/dbus-sdr/meson.build b/dbus-sdr/meson.build
index cbed418..bfdbde1 100644
--- a/dbus-sdr/meson.build
+++ b/dbus-sdr/meson.build
@@ -17,16 +17,7 @@
   ])
 
 dbus_sdr_src = [
-  'sdrutils.cpp',
-  'sensorcommands.cpp',
-  'storagecommands.cpp'
+  'dbus-sdr/sdrutils.cpp',
+  'dbus-sdr/sensorcommands.cpp',
+  'dbus-sdr/storagecommands.cpp'
 ]
-
-shared_module(
-  'dynamiccmds',
-  dbus_sdr_src,
-  implicit_include_directories: false,
-  dependencies: dbus_sdr_pre,
-  install: true,
-  install_dir: get_option('libdir') / 'ipmid-providers')
-
diff --git a/libipmid-host/meson.build b/libipmid-host/meson.build
index b3a310a..e646b13 100644
--- a/libipmid-host/meson.build
+++ b/libipmid-host/meson.build
@@ -2,15 +2,10 @@
   sdbusplus_dep,
 ]
 
-libipmid_host = library(
+library(
   'ipmid-host',
   dependencies: ipmid_pre,
   version: meson.project_version(),
   include_directories: root_inc,
   install: true,
   install_dir: get_option('libdir'))
-
-ipmid_host_dep = declare_dependency(
-  dependencies: ipmid_pre,
-  include_directories: root_inc,
-  link_with: libipmid_host)
diff --git a/meson.build b/meson.build
index d933e36..bfb417f 100644
--- a/meson.build
+++ b/meson.build
@@ -123,7 +123,6 @@
   whitelist_pre = declare_dependency(
     include_directories: root_inc,
     dependencies: [
-      channellayer_dep,
       crypto,
       ipmid_dep,
       phosphor_dbus_interfaces_dep,
@@ -132,20 +131,18 @@
     ],
   )
 
-  whitelist_lib = shared_module(
+  whitelist_lib = library(
     'whitelist',
     'whitelist-filter.cpp',
     'ipmiwhitelist.cpp',
     implicit_include_directories: false,
     dependencies: whitelist_pre,
+    version: meson.project_version(),
+    override_options: ['b_lundef=false'],
     install: true,
     install_dir: get_option('libdir') / 'ipmid-providers')
 endif
 
-whitelist_dep = declare_dependency(
-  link_with: whitelist_lib,
-  dependencies: whitelist_pre)
-
 # libsysintfcmds
 sysintfcmds_pre = declare_dependency(
   include_directories: root_inc,
@@ -159,19 +156,17 @@
     ipmid_dep,
   ])
 
-sysintfcmds_lib = shared_module(
+sysintfcmds_lib = library(
   'sysintfcmds',
   'systemintfcmds.cpp',
   'host-interface.cpp',
   implicit_include_directories: false,
   dependencies: sysintfcmds_pre,
+  version: meson.project_version(),
+  override_options: ['b_lundef=false'],
   install: true,
   install_dir: get_option('libdir') / 'ipmid-providers')
 
-sysintfcmds_dep = declare_dependency(
-  link_with: sysintfcmds_lib,
-  dependencies: sysintfcmds_pre)
-
 # ipmid
 ipmid_pre = [
   sdbusplus_dep,
@@ -236,6 +231,7 @@
   include_directories: root_inc,
   install: true,
   install_dir: get_option('libdir') / 'ipmid-providers',
+  version: meson.project_version(),
   override_options: ['b_lundef=false'])
 
 libipmi20_dep = declare_dependency(
@@ -259,6 +255,16 @@
 # Dynamic Sensor Stack
 subdir('dbus-sdr')
 
+library(
+  'dynamiccmds',
+  dbus_sdr_src,
+  implicit_include_directories: false,
+  dependencies: dbus_sdr_pre,
+  version: meson.project_version(),
+  override_options: ['b_lundef=false'],
+  install: true,
+  install_dir: get_option('libdir') / 'ipmid-providers')
+
 if not get_option('tests').disabled()
   subdir('test')
 endif
diff --git a/user_channel/meson.build b/user_channel/meson.build
index b7d6a87..36ea83b 100644
--- a/user_channel/meson.build
+++ b/user_channel/meson.build
@@ -75,17 +75,14 @@
       channellayer_dep,
     ])
 
-  usercmds_lib = shared_library(
+  usercmds_lib = library(
     'usercmds',
     'usercommands.cpp',
     implicit_include_directories: false,
     dependencies: usercmds_pre,
     install: true,
     install_dir: get_option('libdir') / 'ipmid-providers',
+    version: meson.project_version(),
     override_options: ['b_lundef=false'])
 
-  usercmds_dep = declare_dependency(
-    link_with: usercmds_lib,
-    dependencies: usercmds_pre)
-
 endif