build: Refactor to separate out library

This makes it more clear what code is intended for use by the
phosphor-logging shared library. This is especially nice since it
isolates the `phosphor_logging_dep` to only provide the exported headers
instead of everything in the project.

Additionally, this adds an option to build only the library components
of the project when the services aren't needed.

Change-Id: Ied0858fc70e8054df4c056d91f35a6f0b3acfcb1
Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/config/config.h.meson b/config/config.h.meson
new file mode 100644
index 0000000..cd91f80
--- /dev/null
+++ b/config/config.h.meson
@@ -0,0 +1,41 @@
+#pragma once
+#include <cstddef>
+
+#define PROCESS_META 1
+
+// @TODO(stwcx): These values are currently configured in autoconf but never
+//               modified by anyone, nor could I see why they ever would be.
+//               Once autoconf is removed, they should be switched over to
+//               a constant in a header file.
+
+#define BMC_VERSION_FILE "/etc/os-release"
+#define BUSNAME_LOGGING "xyz.openbmc_project.Logging"
+#define BUSNAME_SYSLOG_CONFIG "xyz.openbmc_project.Syslog.Config"
+#define BUSPATH_REMOTE_LOGGING_CONFIG                                          \
+    "/xyz/openbmc_project/logging/config/remote"
+#define CALLOUT_FWD_ASSOCIATION "callout"
+#define CALLOUT_REV_ASSOCIATION "fault"
+#define INVENTORY_ROOT "/xyz/openbmc_project/inventory"
+#define OBJ_ENTRY "/xyz/openbmc_project/logging/entry"
+#define OBJ_INTERNAL "/xyz/openbmc_project/logging/internal/manager"
+#define OBJ_LOGGING "/xyz/openbmc_project/logging"
+#define SYSTEMD_BUSNAME "org.freedesktop.systemd1"
+#define SYSTEMD_INTERFACE "org.freedesktop.systemd1.Manager"
+#define SYSTEMD_PATH "/org/freedesktop/systemd1"
+
+#define RSYSLOG_SERVER_CONFIG_FILE "@rsyslog_server_conf@"
+
+extern const char *ERRLOG_PERSIST_PATH;
+extern const char *EXTENSION_PERSIST_DIR;
+extern const bool IS_UNIT_TEST;
+
+static constexpr size_t ERROR_CAP = @error_cap@;
+static constexpr size_t ERROR_INFO_CAP = @error_info_cap@;
+
+static constexpr auto FIRST_CEREAL_CLASS_VERSION_WITH_FWLEVEL = "2";
+static constexpr auto FIRST_CEREAL_CLASS_VERSION_WITH_UPDATE_TS = "3";
+static constexpr auto FIRST_CEREAL_CLASS_VERSION_WITH_EVENTID = "4";
+static constexpr auto FIRST_CEREAL_CLASS_VERSION_WITH_RESOLUTION = "5";
+static constexpr size_t CLASS_VERSION = 5;
+
+// vim: ft=cpp
diff --git a/config/meson.build b/config/meson.build
new file mode 100644
index 0000000..ff8f946
--- /dev/null
+++ b/config/meson.build
@@ -0,0 +1,13 @@
+# Create config.h with constants that use to come from autoconf.
+conf_data = configuration_data()
+conf_data.set('error_cap', get_option('error_cap'))
+conf_data.set('error_info_cap', get_option('error_info_cap'))
+conf_data.set('rsyslog_server_conf', get_option('rsyslog_server_conf'))
+conf_h_dep = declare_dependency(
+    include_directories: include_directories('.'),
+    sources: configure_file(
+        input: 'config.h.meson',
+        output: 'config.h',
+        configuration: conf_data,
+    )
+)