libpldmresponder: Move host specific code under build flag

Recently added patches have not added the libpldmresponder and host
bmc specific code under the libpldmresponder build flag.

Tested: Not tested yet, need help from IBM contributors to verify
the patch and update this section.

Signed-off-by: Tom Joseph <rushtotom@gmail.com>
Change-Id: I743ccae4d31af887c037a3bd38ec837b942f7efd
diff --git a/libpldmresponder/meson.build b/libpldmresponder/meson.build
index bb45c3b..7d4ae6e 100644
--- a/libpldmresponder/meson.build
+++ b/libpldmresponder/meson.build
@@ -24,6 +24,7 @@
   '../host-bmc/host_pdr_handler.cpp',
   '../host-bmc/dbus_to_event_handler.cpp',
   '../host-bmc/dbus_to_host_effecters.cpp',
+  '../host-bmc/host_condition.cpp',
   'event_parser.cpp'
 ]
 
diff --git a/meson.build b/meson.build
index e674da3..949d889 100644
--- a/meson.build
+++ b/meson.build
@@ -186,7 +186,6 @@
   'pldmd/dbus_impl_requester.cpp',
   'pldmd/instance_id.cpp',
   'pldmd/dbus_impl_pdr.cpp',
-  'host-bmc/host_condition.cpp',
   implicit_include_directories: false,
   dependencies: deps,
   install: true,
diff --git a/pldmd/pldmd.cpp b/pldmd/pldmd.cpp
index b1f1c95..cc7e87b 100644
--- a/pldmd/pldmd.cpp
+++ b/pldmd/pldmd.cpp
@@ -5,7 +5,6 @@
 
 #include "common/utils.hpp"
 #include "dbus_impl_requester.hpp"
-#include "host-bmc/host_condition.hpp"
 #include "invoker.hpp"
 #include "requester/handler.hpp"
 #include "requester/request.hpp"
@@ -39,6 +38,7 @@
 #include "dbus_impl_pdr.hpp"
 #include "host-bmc/dbus_to_event_handler.hpp"
 #include "host-bmc/dbus_to_host_effecters.hpp"
+#include "host-bmc/host_condition.hpp"
 #include "host-bmc/host_pdr_handler.hpp"
 #include "libpldmresponder/base.hpp"
 #include "libpldmresponder/bios.hpp"
@@ -169,14 +169,13 @@
     auto& bus = pldm::utils::DBusHandler::getBus();
     dbus_api::Requester dbusImplReq(bus, "/xyz/openbmc_project/pldm");
 
-    dbus_api::Host dbusImplHost(bus, "/xyz/openbmc_project/pldm");
-
     Invoker invoker{};
     requester::Handler<requester::Request> reqHandler(sockfd, event,
                                                       dbusImplReq);
 
 #ifdef LIBPLDMRESPONDER
     using namespace pldm::state_sensor;
+    dbus_api::Host dbusImplHost(bus, "/xyz/openbmc_project/pldm");
     std::unique_ptr<pldm_pdr, decltype(&pldm_pdr_destroy)> pdrRepo(
         pldm_pdr_init(), pldm_pdr_destroy);
     std::unique_ptr<pldm_entity_association_tree,
@@ -250,6 +249,19 @@
     dbus_api::Pdr dbusImplPdr(bus, "/xyz/openbmc_project/pldm", pdrRepo.get());
     sdbusplus::xyz::openbmc_project::PLDM::server::Event dbusImplEvent(
         bus, "/xyz/openbmc_project/pldm");
+
+    hostPDRHandler->setHostState();
+    if (hostPDRHandler->isHostUp())
+    {
+        hostPDRHandler->getHostPDR();
+    }
+    else
+    {
+        if (verbose)
+        {
+            std::cout << "Host is not running\n";
+        }
+    }
 #endif
 
     pldm::utils::CustomFD socketFd(sockfd);
@@ -372,18 +384,6 @@
     bus.attach_event(event.get(), SD_EVENT_PRIORITY_NORMAL);
     bus.request_name("xyz.openbmc_project.PLDM");
     IO io(event, socketFd(), EPOLLIN, std::move(callback));
-    hostPDRHandler->setHostState();
-    if (hostPDRHandler->isHostUp())
-    {
-        hostPDRHandler->getHostPDR();
-    }
-    else
-    {
-        if (verbose)
-        {
-            std::cout << "Host is not running\n";
-        }
-    }
 
     event.loop();