build: Add meson build for phosphor-host-ipmi
Create meson and meson_options for the existing features.
Removed sample.h/cpp since that is not used at all.
Tested:
Ipmi command works fine the cleanup.
```
$ systemctl status phosphor-ipmi-host
● phosphor-ipmi-host.service - Phosphor Inband IPMI
Loaded: loaded (/lib/systemd/system/phosphor-ipmi-host.service; enabled; vendor preset: enabled)
Active: active (running) since Thu 1970-01-08 21:20:56 UTC; 21s ago
Main PID: 24987 (ipmid)
CGroup: /system.slice/phosphor-ipmi-host.service
└─24987 /tmp/ipmid
Jan 08 21:20:56 $HOST ipmid[24987]: Registering OEM:[0X002B79], Cmd:[0X30] for Ethstats Commands
Jan 08 21:20:56 $HOST ipmid[24987]: Registering OEM:[0X00C2CF], Cmd:[0X30] for Ethstats Commands
Jan 08 21:20:56 $HOST ipmid[24987]: Registering OEM:[0X002B79], Cmd:[0X32] for Sys Commands
Jan 08 21:20:56 $HOST ipmid[24987]: Registering OEM:[0X002B79], Cmd:[0X02] for I2C
Jan 08 21:20:56 $HOST ipmid[24987]: Registering OEM:[0X00C2CF], Cmd:[0X02] for I2C
Jan 08 21:20:56 $HOST ipmid[24987]: I2C_WHITELIST_CHECK is disabled, do not populate whitelist
Jan 08 21:20:56 $HOST ipmid[24987]: Registering OEM:[0X00C2CF], Cmd:[0X04] for Manual Zone Control
Jan 08 21:20:56 $HOST systemd[1]: Started Phosphor Inband IPMI.
Jan 08 21:20:56 $HOST ipmid[24987]: Loading whitelist filter
Jan 08 21:20:56 $HOST ipmid[24987]: Set restrictedMode = true
(reverse-i-search)`ipmi': systemctl status phosphor-^Cmi-host
$ ipmitool mc info
Device ID : 32
Device Revision : 1
Firmware Revision : 0.00
IPMI Version : 2.0
Manufacturer ID : 7244
Manufacturer Name : Quanta Computer Inc.
Product ID : 14426 (0x385a)
Product Name : Unknown (0x385A)
Device Available : yes
Provides Device SDRs : yes
Additional Device Support :
Sensor Device
SEL Device
FRU Inventory Device
Chassis Device
Aux Firmware Rev Info :
0x00
0x00
0x00
0x00
```
Change-Id: Ibaea9eea802b063a0207320654cbb817fde30c2a
Signed-off-by: Willy Tu <wltu@google.com>
diff --git a/.gitignore b/.gitignore
index bc496d1..9a5b17a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,80 +1,3 @@
-# Template from:
-# https://github.com/github/gitignore/blob/master/Autotools.gitignore
-
-# http://www.gnu.org/software/automake
-
-Makefile.in
-/ar-lib
-/mdate-sh
-/py-compile
-/test-driver
-/ylwrap
-
-# http://www.gnu.org/software/autoconf
-
-/autom4te.cache
-/autoscan.log
-/autoscan-*.log
-/aclocal.m4
-/compile
-/config.guess
-/config.h.in
-/config.sub
-/configure
-/configure.scan
-/depcomp
-/install-sh
-/missing
-/stamp-h1
-
-# https://www.gnu.org/software/libtool/
-
-/ltmain.sh
-
-# http://www.gnu.org/software/texinfo
-
-/texinfo.tex
-
-# Repo Specific Items
-*.a
-*.o
-*.lo
-*.la
-*.so*
-*.pc
-/aminclude_static.am
-/config.h
-/config.h.in~
-/config.log
-/config.status
-Makefile
-.deps
-.dirstamp
-.libs/
-/libtool
-/*-libtool
-/ipmid
-.project
-/softoff/phosphor-softpoweroff
-/softoff/xyz/
-/fru-read-gen.cpp
-/ipmiwhitelist.cpp
-/sensor-gen.cpp
-/inventory-sensor-gen.cpp
-/fru-read-gen.cpp
-/channel-gen.cpp
-/entity-gen.cpp
-
-# test related
-/test/*.log
-/test/*.trs
-/test-suite.log
-*-1.0-coverage*
-*.gcda
-*.gcno
-softoff/test
-test/*_unittest
-
# ignore vim swap files
.*.sw*
# failures from patch
@@ -83,4 +6,7 @@
# backup files from some editors
*~
.cscope/
-build/
+
+# Meson
+/build*/
+/subprojects/*/
diff --git a/Makefile.am b/Makefile.am
deleted file mode 100644
index 49547e1..0000000
--- a/Makefile.am
+++ /dev/null
@@ -1,205 +0,0 @@
-AM_DEFAULT_SOURCE_EXT = .cpp
-
-AM_CPPFLAGS = -I$(abs_srcdir) -I$(abs_srcdir)/include
-export AM_CPPFLAGS
-
-if AUTOCONF_CODE_COVERAGE_2019_01_06
-include $(top_srcdir)/aminclude_static.am
-clean-local: code-coverage-clean
-distclean-local: code-coverage-dist-clean
-else
-@CODE_COVERAGE_RULES@
-endif
-
-providersdir = ${libdir}/ipmid-providers
-providers_LTLIBRARIES =
-
-if FEATURE_IPMI_WHITELIST
-IPMI_WHITELIST_SOURCE = ipmiwhitelist.cpp
-else
-IPMI_WHITELIST_SOURCE =
-endif
-
-bin_PROGRAMS = \
- ipmid
-
-ipmid_SOURCES = \
- ipmid-new.cpp \
- settings.cpp \
- host-cmd-manager.cpp
-
-libipmi20_BUILT_LIST = \
- sensor-gen.cpp \
- inventory-sensor-gen.cpp \
- fru-read-gen.cpp
-
-BUILT_SOURCES = \
- $(IPMI_WHITELIST_SOURCE) \
- $(libipmi20_BUILT_LIST)
-
-CLEANFILES = $(BUILT_SOURCES)
-
-COMMON_CXX = \
- -flto \
- -Wno-psabi \
- $(SYSTEMD_CFLAGS) \
- $(libmapper_CFLAGS) \
- $(SDBUSPLUS_CFLAGS) \
- $(PHOSPHOR_LOGGING_CFLAGS) \
- $(PHOSPHOR_DBUS_INTERFACES_CFLAGS) \
- -DBOOST_ERROR_CODE_HEADER_ONLY \
- -DBOOST_SYSTEM_NO_DEPRECATED \
- -DBOOST_COROUTINES_NO_DEPRECATION_WARNING \
- -DBOOST_ASIO_DISABLE_THREADS \
- -DBOOST_ALL_NO_LIB
-
-ipmid_CXXFLAGS = $(COMMON_CXX)
-ipmid_LDADD = \
- libipmid/libipmid.la \
- user_channel/libchannellayer.la \
- libipmid-host/libipmid-host.la
-ipmid_LDFLAGS = \
- $(SYSTEMD_LIBS) \
- $(libmapper_LIBS) \
- $(LIBADD_DLOPEN) \
- $(PHOSPHOR_LOGGING_LIBS) \
- $(PHOSPHOR_DBUS_INTERFACES_LIBS) \
- $(CRYPTO_LIBS) \
- -lboost_coroutine \
- -lstdc++fs \
- -export-dynamic
-
-# TODO: Rather than use -export-dynamic, we should use -export-symbol to have a
-# selective list of symbols.
-
-ipmiwhitelist.cpp: ${srcdir}/generate_whitelist.sh $(WHITELIST_CONF)
- $(SHELL) $^ > $@
-
-sensor-gen.cpp: scripts/writesensor.mako.cpp scripts/sensor_gen.py @SENSOR_YAML_GEN@
- $(AM_V_GEN)@SENSORGEN@ -o $(top_builddir) generate-cpp
-
-inventory-sensor-gen.cpp: scripts/inventorysensor.mako.cpp scripts/inventory-sensor.py @INVSENSOR_YAML_GEN@
- $(AM_V_GEN)@INVSENSORGEN@ -o $(top_builddir) generate-cpp
-
-fru-read-gen.cpp: scripts/readfru.mako.cpp scripts/fru_gen.py @FRU_YAML_GEN@
- $(AM_V_GEN)@FRUGEN@ -o $(top_builddir) generate-cpp
-
-providers_LTLIBRARIES += libipmi20.la
-if FEATURE_TRANSPORT_OEM
-libipmi20_la_TRANSPORTOEM = transporthandler_oem.cpp
-else
-libipmi20_la_TRANSPORTOEM =
-endif
-
-libipmi20_la_SOURCES = \
- app/channel.cpp \
- app/watchdog.cpp \
- app/watchdog_service.cpp \
- apphandler.cpp \
- sys_info_param.cpp \
- sensorhandler.cpp \
- entity_map_json.cpp \
- storagehandler.cpp \
- chassishandler.cpp \
- dcmihandler.cpp \
- ipmisensor.cpp \
- storageaddsel.cpp \
- transporthandler.cpp \
- globalhandler.cpp \
- groupext.cpp \
- selutility.cpp \
- ipmi_fru_info_area.cpp \
- read_fru_data.cpp \
- sensordatahandler.cpp \
- user_channel/channelcommands.cpp \
- $(libipmi20_la_TRANSPORTOEM) \
- $(libipmi20_BUILT_LIST)
-
-check_PROGRAMS =
-XFAIL_TESTS =
-
-TESTS = $(check_PROGRAMS)
-
-libipmi20_la_LIBADD = \
- libipmid/libipmid.la \
- user_channel/libchannellayer.la
-libipmi20_la_LDFLAGS = \
- $(SYSTEMD_LIBS) \
- $(libmapper_LIBS) \
- $(PHOSPHOR_LOGGING_LIBS) \
- $(PHOSPHOR_DBUS_INTERFACES_LIBS) \
- -lstdc++fs \
- -lboost_coroutine \
- -version-info 0:0:0 -shared
-libipmi20_la_CXXFLAGS = $(COMMON_CXX)
-
-if FEATURE_LIBUSERLAYER
-providers_LTLIBRARIES += libusercmds.la
-libusercmds_la_LIBADD = \
- libipmid/libipmid.la \
- user_channel/libuserlayer.la \
- user_channel/libchannellayer.la
-libusercmds_la_SOURCES = \
- user_channel/usercommands.cpp
-libusercmds_la_LDFLAGS = \
- $(PHOSPHOR_LOGGING_LIBS) \
- $(libmapper_LIBS) \
- -version-info 0:0:0 -shared
-libusercmds_la_CXXFLAGS = $(COMMON_CXX)
-endif
-
-providers_LTLIBRARIES += libsysintfcmds.la
-libsysintfcmds_la_LIBADD = \
- libipmid/libipmid.la \
- libipmid-host/libipmid-host.la
-libsysintfcmds_la_SOURCES = \
- systemintfcmds.cpp \
- host-interface.cpp
-libsysintfcmds_la_LDFLAGS = \
- $(SYSTEMD_LIBS) \
- $(libmapper_LIBS) \
- $(PHOSPHOR_DBUS_INTERFACES_LIBS) \
- $(PHOSPHOR_LOGGING_LIBS) \
- $(SDBUSPLUS_LIBS) \
- -version-info 0:0:0 -shared
-libsysintfcmds_la_CXXFLAGS = $(COMMON_CXX)
-
-if FEATURE_DYNAMIC_SENSORS
-providers_LTLIBRARIES += libdynamiccmds.la
-libdynamiccmds_la_LIBADD = \
- libipmid/libipmid.la
-libdynamiccmds_la_LIBADD += libipmi20.la
-libdynamiccmds_la_SOURCES = \
- dbus-sdr/sensorcommands.cpp \
- dbus-sdr/storagecommands.cpp \
- dbus-sdr/sdrutils.cpp \
- dbus-sdr/sensorutils.cpp
-libdynamiccmds_la_LDFLAGS = \
- $(PHOSPHOR_LOGGING_LIBS) \
- $(libmapper_LIBS) \
- -version-info 0:0:0 -shared
-libdynamiccmds_la_CXXFLAGS = $(COMMON_CXX)
-endif
-
-if FEATURE_IPMI_WHITELIST
-libwhitelistdir = ${libdir}/ipmid-providers
-libwhitelist_LTLIBRARIES = libwhitelist.la
-libwhitelist_la_SOURCES = \
- whitelist-filter.cpp
-libwhitelist_la_LDFLAGS = \
- $(SYSTEMD_LIBS) \
- $(libmapper_LIBS) \
- $(PHOSPHOR_LOGGING_LIBS) \
- $(PHOSPHOR_DBUS_INTERFACES_LIBS) \
- -version-info 0:0:0 -shared
-libwhitelist_la_CXXFLAGS = $(COMMON_CXX)
-nodist_libwhitelist_la_SOURCES = ipmiwhitelist.cpp
-endif
-
-nobase_include_HEADERS = \
- user_channel/channel_layer.hpp \
- user_channel/user_layer.hpp \
- user_channel/cipher_mgmt.hpp
-
-# Forcing the build of self and then subdir
-SUBDIRS = include libipmid libipmid-host user_channel . test softoff
diff --git a/app/meson.build b/app/meson.build
new file mode 100644
index 0000000..5e89b27
--- /dev/null
+++ b/app/meson.build
@@ -0,0 +1,15 @@
+app_inc = include_directories('.')
+
+app_pre = declare_dependency(include_directories: [root_inc, app_inc])
+
+app_lib = static_library(
+ 'app',
+ 'channel.cpp',
+ 'watchdog.cpp',
+ 'watchdog_service.cpp',
+ implicit_include_directories: false,
+ dependencies: app_pre)
+
+app_dep = declare_dependency(
+ link_with: app_lib,
+ dependencies: app_pre)
diff --git a/bootstrap.sh b/bootstrap.sh
deleted file mode 100755
index 9fdf674..0000000
--- a/bootstrap.sh
+++ /dev/null
@@ -1,19 +0,0 @@
-#!/bin/sh
-
-AUTOCONF_FILES="Makefile.in aclocal.m4 ar-lib autom4te.cache compile \
- config.guess config.h.in config.sub configure depcomp install-sh \
- ltmain.sh missing *libtool test-driver"
-
-case $1 in
- clean)
- test -f Makefile && make maintainer-clean
- for file in ${AUTOCONF_FILES}; do
- find . -name "$file" -print0 | xargs -0 -r rm -rf
- done
- exit 0
- ;;
-esac
-
-autoreconf -i
-# shellcheck disable=SC2016
-echo 'Run "./configure ${CONFIGURE_FLAGS} && make"'
diff --git a/configure.ac b/configure.ac
deleted file mode 100644
index f7f69a0..0000000
--- a/configure.ac
+++ /dev/null
@@ -1,353 +0,0 @@
-# Initialization
-AC_PREREQ([2.69])
-AC_INIT([phosphor-host-ipmid], [1.0], [https://github.com/openbmc/phosphor-host-ipmid/issues])
-AC_CONFIG_HEADERS([config.h])
-AM_INIT_AUTOMAKE([subdir-objects -Wall -Wno-portability -Werror foreign dist-xz])
-AM_SILENT_RULES([yes])
-AC_LANG([C++])
-
-# Make sure the default CFLAGS of `-O2 -g` don't override CODE_COVERAGE_CFLAGS
-# It is important that this comes before AC_PROG_C{C,XX}, as we are attempting
-# to stop them from populating default CFLAGS and CXXFLAGS.
-AS_IF([test "x$enable_code_coverage" != "xno"], [
- AS_IF([test "x${CXXFLAGS+set}" != "xset"], [
- AC_SUBST(CXXFLAGS, [""])
- ])
- AS_IF([test "x${CFLAGS+set}" != "xset"], [
- AC_SUBST(CFLAGS, [""])
- ])
-])
-
-# Checks for programs.
-AC_PROG_CXX
-AC_PROG_CC
-AM_PROG_AR
-AC_PROG_INSTALL
-AC_PROG_MAKE_SET
-
-# Add an option to enable/disable safe mode in boot flags
-AC_ARG_ENABLE([boot-flag-safe-mode-support],
- AS_HELP_STRING([--disable-boot-flag-safe-mode-support], [Disable safe mode option in boot flags. [default=enable]])
-)
-AS_IF([test "x$enable_boot_flag_safe_mode_support" != "xno"],
- AC_MSG_NOTICE([Enabling safe mode option in boot flags])
- [cpp_flags="$cpp_flags -DENABLE_BOOT_FLAG_SAFE_MODE_SUPPORT"]
- AC_SUBST([CPPFLAGS], [$cpp_flags]),
- AC_MSG_WARN([Disabling safe mode option in boot flags])
-)
-
-# Add an option to enable/disable i2c master write read command white list checking
-AC_ARG_ENABLE([i2c-whitelist-check],
- AS_HELP_STRING([--disable-i2c-whitelist-check], [Disable I2C master write read command white list check. [default=enable]])
-)
-AS_IF([test "x$enable_i2c_whitelist_check" != "xno"],
- AC_MSG_NOTICE([Enabling I2C master write read command white list check])
- [cpp_flags="$cpp_flags -DENABLE_I2C_WHITELIST_CHECK"]
- AC_SUBST([CPPFLAGS], [$cpp_flags]),
- AC_MSG_WARN([Disabling I2C master write read command white list check])
-)
-
-# softoff dir specific ones
-AC_ARG_ENABLE([softoff],
- AS_HELP_STRING([--enable-softoff], [Builds soft power off])
-)
-AS_IF([test "x$enable_softoff" != "xno"],
- [AC_PROG_MKDIR_P]
- [AC_CHECK_PROG([DIRNAME], dirname, dirname)]
-)
-
-# Make sure the pkgconfigdata is configured for automake
-PKG_INSTALLDIR
-
-# Checks for libraries.
-AC_CHECK_LIB([pam], [pam_start], [], [AC_MSG_ERROR([libpam not found])])
-AC_CHECK_LIB([mapper], [mapper_get_service], ,[AC_MSG_ERROR([Could not find libmapper...openbmc/phosphor-objmgr package required])])
-PKG_CHECK_MODULES([SYSTEMD], [libsystemd >= 221], [], [AC_MSG_ERROR(["systemd required and not found"])])
-PKG_CHECK_MODULES([CRYPTO], [libcrypto >= 1.0.2g], ,[AC_MSG_ERROR([can't find openssl libcrypto])])
-PKG_CHECK_MODULES([PHOSPHOR_LOGGING], [phosphor-logging])
-PKG_CHECK_MODULES([PHOSPHOR_DBUS_INTERFACES], [phosphor-dbus-interfaces])
-PKG_CHECK_MODULES([SDBUSPLUS], [sdbusplus])
-AC_CHECK_HEADER(nlohmann/json.hpp, [], [AC_MSG_ERROR([Could not find nlohmann/json.hpp])])
-
-AS_IF([test "x$enable_softoff" != "xno"], [
- PKG_CHECK_MODULES([SDEVENTPLUS], [sdeventplus])
-
- # Check for sdbus++ tool
- AC_PATH_PROG([SDBUSPLUSPLUS], [sdbus++])
- AS_IF([test "x$SDBUSPLUSPLUS" == "x"],
- AC_MSG_ERROR([Cannot find sdbus++]))
-])
-
-# Checks for typedefs, structures, and compiler characteristics.
-AX_CXX_COMPILE_STDCXX([20], [noext], [mandatory])
-AX_APPEND_COMPILE_FLAGS([-Wall -Werror], [CFLAGS])
-AX_APPEND_COMPILE_FLAGS([-Wall -Werror], [CXXFLAGS])
-
-# Checks for library functions.
-LT_INIT([dlopen disable-static shared])
-LT_LIB_DLLOAD
-
-# Check/set gtest specific functions.
-PKG_CHECK_MODULES([GTEST], [gtest], [], [AC_MSG_NOTICE([gtest not found, tests will not build])])
-PKG_CHECK_MODULES([GTEST_MAIN], [gtest_main], [], [AC_MSG_NOTICE([gtest_main not found, tests will not build])])
-
-AC_ARG_ENABLE([oe-sdk],
- AS_HELP_STRING([--enable-oe-sdk], [Link testcases absolutely against OE SDK so they can be ran within it.])
-)
-AC_ARG_VAR(OECORE_TARGET_SYSROOT,
- [Path to the OE SDK SYSROOT])
-AS_IF([test "x$enable_oe_sdk" == "xyes"],
- AS_IF([test "x$OECORE_TARGET_SYSROOT" == "x"],
- AC_MSG_ERROR([OECORE_TARGET_SYSROOT must be set with --enable-oe-sdk])
- )
- AC_MSG_NOTICE([Enabling OE-SDK at $OECORE_TARGET_SYSROOT])
- [
- testcase_flags="-Wl,-rpath,\${OECORE_TARGET_SYSROOT}/lib"
- testcase_flags="${testcase_flags} -Wl,-rpath,\${OECORE_TARGET_SYSROOT}/usr/lib"
- testcase_flags="${testcase_flags} -Wl,-dynamic-linker,`find \${OECORE_TARGET_SYSROOT}/lib/ld-*.so | sort -r -n | head -n1`"
- ]
- AC_SUBST([OESDK_TESTCASE_FLAGS], [$testcase_flags])
-)
-
-# Add code coverage tool
-AX_CODE_COVERAGE
-AS_IF([test "x$CODE_COVERAGE_ENABLED" = "xyes"], [
- AX_APPEND_COMPILE_FLAGS([-DHAVE_GCOV], [CODE_COVERAGE_CPPFLAGS])
-])
-m4_ifdef([_AX_CODE_COVERAGE_RULES],
- [AM_CONDITIONAL(AUTOCONF_CODE_COVERAGE_2019_01_06, [true])],
- [AM_CONDITIONAL(AUTOCONF_CODE_COVERAGE_2019_01_06, [false])])
-AX_ADD_AM_MACRO_STATIC([])
-
-
-AC_ARG_VAR(WHITELIST_CONF, [Paths to IPMI whitelisted commands conf files. (default = ${srcdir}/host-ipmid-whitelist.conf)])
-if test -z "$WHITELIST_CONF"; then
- WHITELIST_CONF=${srcdir}/host-ipmid-whitelist.conf
-fi
-
-AS_IF([test "x$SENSOR_YAML_GEN" == "x"], [SENSOR_YAML_GEN="$srcdir/scripts/sensor-example.yaml"])
-SENSORGEN="$PYTHON ${srcdir}/scripts/sensor_gen.py -i $SENSOR_YAML_GEN"
-AC_SUBST(SENSOR_YAML_GEN)
-AC_SUBST(SENSORGEN)
-
-AS_IF([test "x$INVSENSOR_YAML_GEN" == "x"], [INVSENSOR_YAML_GEN="$srcdir/scripts/inventory-sensor-example.yaml"])
-INVSENSORGEN="$PYTHON ${srcdir}/scripts/inventory-sensor.py -i $INVSENSOR_YAML_GEN"
-AC_SUBST(INVSENSOR_YAML_GEN)
-AC_SUBST(INVSENSORGEN)
-
-AS_IF([test "x$FRU_YAML_GEN" == "x"], [FRU_YAML_GEN="$srcdir/scripts/fru-read-example.yaml"])
-FRUGEN="$PYTHON $srcdir/scripts/fru_gen.py -i $FRU_YAML_GEN"
-AC_SUBST(FRU_YAML_GEN)
-AC_SUBST(FRUGEN)
-
-AS_IF([test "x$ENTITY_YAML_GEN" == "x"], [ENTITY_YAML_GEN="$srcdir/scripts/entity-example.yaml"])
-ENTITYGEN="$PYTHON $srcdir/scripts/entity_gen.py -i $ENTITY_YAML_GEN"
-AC_SUBST(ENTITY_YAML_GEN)
-AC_SUBST(ENTITYGEN)
-
-AC_DEFINE(CALLOUT_FWD_ASSOCIATION, "callout", [The name of the callout's forward association.])
-AC_DEFINE(BOARD_SENSOR, "/xyz/openbmc_project/inventory/system/chassis/motherboard", [The inventory path to the motherboard fault sensor.])
-AC_DEFINE(SYSTEM_SENSOR, "/xyz/openbmc_project/inventory/system", [The inventory path to the system event sensor.])
-
-# Soft Power off related.
-AS_IF([test "x$enable_softoff" != "xno"],
- # Dbus service name
- [AC_ARG_VAR(SOFTOFF_BUSNAME, [The Dbus busname to own])]
- AS_IF([test "x$SOFTOFF_BUSNAME" == "x"],
- [SOFTOFF_BUSNAME="xyz.openbmc_project.Ipmi.Internal.SoftPowerOff"])
- [AC_DEFINE_UNQUOTED([SOFTOFF_BUSNAME], ["$SOFTOFF_BUSNAME"], [The Dbus busname to own])]
-
- # Service dbus root
- [AC_ARG_VAR(SOFTOFF_OBJPATH, [The SoftPowerOff Dbus root])]
- AS_IF([test "x$SOFTOFF_OBJPATH" == "x"],
- [SOFTOFF_OBJPATH="/xyz/openbmc_project/ipmi/internal/soft_power_off"])
- [AC_DEFINE_UNQUOTED([SOFTOFF_OBJPATH], ["$SOFTOFF_OBJPATH"], [The SoftPowerOff Dbus root])]
-
- # Timeouts in SECONDS for SoftPowerOff protocol
- [AC_ARG_VAR(IPMI_SMS_ATN_ACK_TIMEOUT_SECS, \
- [Initial timeout for host to ack and query SMS_ATN from BMC])]
- [AC_DEFINE_UNQUOTED([IPMI_SMS_ATN_ACK_TIMEOUT_SECS], [3], \
- [Timeout for host to ack and query SMS_ATN from BMC])]
-
- [AC_ARG_VAR(IPMI_HOST_SHUTDOWN_COMPLETE_TIMEOUT_SECS, [Wait time for host to shutdown])]
- [AC_DEFINE_UNQUOTED([IPMI_HOST_SHUTDOWN_COMPLETE_TIMEOUT_SECS], [45*60], [Wait time for host to shutdown])]
-
- # Indicates an in-band power off or reboot request from the host
- # This file is used to ensure the soft off service does not run for host
- # initiated shutdown or reboot requests
- [AC_ARG_VAR(HOST_INBAND_REQUEST_DIR, [Directory used to indicate the host has initiated a shutdown or reboot])]
- AS_IF([test "x$HOST_INBAND_REQUEST_DIR" == "x"],
- [HOST_INBAND_REQUEST_DIR="/run/openbmc/"])
- [AC_DEFINE_UNQUOTED([HOST_INBAND_REQUEST_DIR], ["$HOST_INBAND_REQUEST_DIR"], [Directory to store host initiated shutdown file])]
-
- [AC_ARG_VAR(HOST_INBAND_REQUEST_FILE, [File which indicates the host has initiated a shutdown or reboot])]
- AS_IF([test "x$HOST_INBAND_REQUEST_FILE" == "x"],
- [HOST_INBAND_REQUEST_FILE="host@%u-request"])
- [AC_DEFINE_UNQUOTED([HOST_INBAND_REQUEST_FILE], ["$HOST_INBAND_REQUEST_FILE"], [File to create if host has initiated shutdown or reboot])]
-)
-
-# Control Host Interfaces
-# Dbus service name
-AC_ARG_VAR(CONTROL_HOST_BUSNAME, [The Control Host Dbus busname to own])
-AS_IF([test "x$CONTROL_HOST_BUSNAME" == "x"],
- [CONTROL_HOST_BUSNAME="xyz.openbmc_project.Control.Host"])
-AC_DEFINE_UNQUOTED([CONTROL_HOST_BUSNAME], ["$CONTROL_HOST_BUSNAME"], [The Control Host Dbus busname to own])
-
-# Host object name in the D-Bus
-AC_ARG_VAR(HOST_NAME, [The Host name in the object path])
-AS_IF([test "x$HOST_NAME" == "x"],
- [HOST_NAME="host"])
-AC_DEFINE_UNQUOTED([HOST_NAME], ["$HOST_NAME"], [The Host name in the object path])
-
-# Service dbus object manager
-AC_ARG_VAR(CONTROL_HOST_OBJ_MGR, [The Control Host D-Bus Object Manager])
-AS_IF([test "x$CONTROL_HOST_OBJ_MGR" == "x"],
- [CONTROL_HOST_OBJ_MGR="/xyz/openbmc_project/control"])
-AC_DEFINE_UNQUOTED([CONTROL_HOST_OBJ_MGR], ["$CONTROL_HOST_OBJ_MGR"], [The Control Host D-Bus Object Manager])
-
-# Power reading sensor configuration file
-AC_ARG_VAR(POWER_READING_SENSOR, [Power reading sensor configuration file])
-AS_IF([test "x$POWER_READING_SENSOR" == "x"],[POWER_READING_SENSOR="/usr/share/ipmi-providers/power_reading.json"])
-AC_DEFINE_UNQUOTED([POWER_READING_SENSOR], ["$POWER_READING_SENSOR"], [Power reading sensor configuration file])
-
-AC_ARG_VAR(HOST_IPMI_LIB_PATH, [The file path to search for libraries.])
-AS_IF([test "x$HOST_IPMI_LIB_PATH" == "x"], [HOST_IPMI_LIB_PATH="/usr/lib/ipmid-providers/"])
-AC_DEFINE_UNQUOTED([HOST_IPMI_LIB_PATH], ["$HOST_IPMI_LIB_PATH"], [The file path to search for libraries.])
-
-# When a sensor read fails, hwmon will update the OperationalState interface's Functional property.
-# This will mark the sensor as not functional and we will skip reading from that sensor.
-AC_ARG_ENABLE([update-functional-on-fail],
- AS_HELP_STRING(
- [--enable-update-functional-on-fail],
- [Check functional property to skip reading from faulty sensors.]
- )
-)
-
-AC_ARG_VAR(UPDATE_FUNCTIONAL_ON_FAIL, [Check functional property to skip reading from faulty sensors.])
-AS_IF(
- [test "x$enable_update_functional_on_fail" == "xyes"],
- [UPDATE_FUNCTIONAL_ON_FAIL="yes"]
- AC_DEFINE_UNQUOTED(
- [UPDATE_FUNCTIONAL_ON_FAIL],
- ["$UPDATE_FUNCTIONAL_ON_FAIL"],
- [Check functional property to skip reading from faulty sensors.]
- )
-)
-
-# When disable-libuserlayer flag is set, libuserlayer won't be included in the build.
-AC_ARG_ENABLE([libuserlayer],
- AS_HELP_STRING([--disable-libuserlayer], [Set a flag to exclude libuserlayer])
-)
-AM_CONDITIONAL(FEATURE_LIBUSERLAYER, [test "x$enable_libuserlayer" != "xno"])
-
-# When enable-transport-oem flag is set, the transporthandler_oem.cpp contents
-# are compiled and added to the project. The transporthandler_oem.cpp file is
-# copied from your own customization layer in the
-# phosphor-ipmi-host_%.bbappend file. It is not necessary to create this file
-# unless OEM Parameter extensions are required.
-AC_ARG_ENABLE([transport_oem],
- [ --enable-transport-oem Enable/disable OEM Parameter extensions],
- [case "${enableval}" in
- yes) transport_oem=true ;;
- no) transport_oem=false ;;
- *) AC_MSG_ERROR([bad value ${enableval} for --enable-transport_oem]) ;;
- esac],[transport_oem=false]
- )
-AM_CONDITIONAL([FEATURE_TRANSPORT_OEM], [test x$transport_oem = xtrue])
-
-# IPMI whitelist mechanism is not needed by everyone; offer a way to disable it
-AC_ARG_ENABLE([ipmi-whitelist],
- [ --enable-ipmi-whitelist Enable/disable IPMI whitelist filtering],
- [case "${enableval}" in
- yes) ipmi_whitelist=true ;;
- no) ipmi_whitelist=false ;;
- *) AC_MSG_ERROR([bad value ${enableval} for --enable-ipmi-whitelist]) ;;
- esac],[ipmi_whitelist=true]
- )
-AM_CONDITIONAL([FEATURE_IPMI_WHITELIST], [test x$ipmi_whitelist = xtrue])
-
-# Dynamic sensors stack is enabled by default; offer a way to disable it
-AC_ARG_ENABLE([dynamic_sensors],
- [ --enable-dynamic_sensors Enable/disable Dynamic Sensors stack],
- [case "${enableval}" in
- yes) dynamic_sensors=true ;;
- no) dynamic_sensors=false ;;
- *) AC_MSG_ERROR([bad value ${enableval} for --enable-dynamic_sensors]) ;;
- esac],[dynamic_sensors=true]
- )
-AM_CONDITIONAL([FEATURE_DYNAMIC_SENSORS], [test x$dynamic_sensors = xtrue])
-
-AS_IF([test x$dynamic_sensors = xtrue],
- AC_MSG_NOTICE([Enabling dynamic sensors feature])
- [cpp_flags="$cpp_flags -DFEATURE_DYNAMIC_SENSORS"]
- AC_SUBST([CPPFLAGS], [$cpp_flags]),
- AC_MSG_WARN([Disabling dynamic sensors feature])
-)
-
-# hybrid sensors stack is disabled by default; offer a way to enable it
-AC_ARG_ENABLE([hybrid-sensors],
- [ --enable-hybrid-sensors Enable/disable Hybrid Sensors stack],
- [case "${enableval}" in
- yes) hybrid_sensors=true ;;
- no) hybrid_sensors=false ;;
- *) AC_MSG_ERROR([bad value ${enableval} for --enable-hybrid-sensors]) ;;
- esac],[hybrid-sensors=false]
- )
-AM_CONDITIONAL([FEATURE_HYBRID_SENSORS], [test x$hybrid_sensors = xtrue])
-
-AS_IF([test x$hybrid_sensors = xtrue],
- AC_MSG_NOTICE([Enabling hybrid sensors stack])
- [cpp_flags="$cpp_flags -DFEATURE_HYBRID_SENSORS"]
- AC_SUBST([CPPFLAGS], [$cpp_flags]),
- AC_MSG_WARN([Disabling hybrid sensors feature])
-)
-
-# Sensor cache stack is disabled by default; offer a way to enable it
-AC_ARG_ENABLE([sensors-cache],
- [ --enable-sensors-cache Enable/disable sensors cache stack],
- [case "${enableval}" in
- yes) sensors_cache=true ;;
- no) sensors_cache=false ;;
- *) AC_MSG_ERROR([bad value ${enableval} for --enable-sensors-cache]) ;;
- esac],[sensors_cache=false]
- )
-AM_CONDITIONAL([FEATURE_SENSORS_CACHE], [test x$sensors_cache= xtrue])
-
-AS_IF([test x$sensors_cache = xtrue],
- AC_MSG_NOTICE([Enabling sensors cache stack])
- [cpp_flags="$cpp_flags -DFEATURE_SENSORS_CACHE"]
- AC_SUBST([CPPFLAGS], [$cpp_flags]),
- AC_MSG_WARN([Disabling sensors cache feature])
-)
-
-# Clearing SEL through sel-logger is disabled by default; offer a way to enable it
-AC_ARG_ENABLE([sel_logger_clears_sel],
- [ --enable-sel_logger_clears_sel Enable/disable sel-logger to Clear SEL],
- [case "${enableval}" in
- yes) sel_logger_clears_sel=true ;;
- no) sel_logger_clears_sel=false ;;
- *) AC_MSG_ERROR([bad value ${enableval} for --enable-sel_logger_clears_sel]) ;;
- esac],[sel_logger_clears_sel=false]
- )
-AM_CONDITIONAL([FEATURE_SEL_LOGGER_CLEARS_SEL], [test x$sel_logger_clears_sel = xtrue])
-
-AS_IF([test x$sel_logger_clears_sel = xtrue],
- AC_MSG_NOTICE([Enabling sel-logger to Clear SEL])
- [cpp_flags="$cpp_flags -DFEATURE_SEL_LOGGER_CLEARS_SEL"]
- AC_SUBST([CPPFLAGS], [$cpp_flags]),
- AC_MSG_WARN([Disabling sel-logger to Clear SEL])
-)
-
-# Create configured output
-AC_CONFIG_FILES([
- Makefile
- include/Makefile
- libipmid/Makefile
- libipmid/libipmid.pc
- libipmid-host/Makefile
- libipmid-host/libipmid-host.pc
- softoff/Makefile
- test/Makefile
- user_channel/Makefile
-])
-AC_OUTPUT
diff --git a/dbus-sdr/meson.build b/dbus-sdr/meson.build
new file mode 100644
index 0000000..cbed418
--- /dev/null
+++ b/dbus-sdr/meson.build
@@ -0,0 +1,32 @@
+sensorutils_lib = static_library(
+ 'sensorutils',
+ 'sensorutils.cpp',
+ include_directories: root_inc,
+ implicit_include_directories: false)
+
+sensorutils_dep = declare_dependency(link_with: sensorutils_lib)
+
+dbus_sdr_pre = declare_dependency(
+ include_directories: root_inc,
+ dependencies: [
+ crypto,
+ phosphor_logging_dep,
+ ipmid_dep,
+ libipmi20_dep,
+ sensorutils_dep,
+ ])
+
+dbus_sdr_src = [
+ 'sdrutils.cpp',
+ 'sensorcommands.cpp',
+ '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/generate_whitelist_create.sh b/generate_whitelist_create.sh
new file mode 100755
index 0000000..5fdd7ce
--- /dev/null
+++ b/generate_whitelist_create.sh
@@ -0,0 +1,4 @@
+#/bin/sh
+
+# Ensure some files have been passed.
+./generate_whitelist.sh $* > ipmiwhitelist.cpp
diff --git a/include/Makefile.am b/include/Makefile.am
deleted file mode 100644
index 7c90f70..0000000
--- a/include/Makefile.am
+++ /dev/null
@@ -1,36 +0,0 @@
-nobase_include_HEADERS = \
- ipmid/api.hpp \
- ipmid/api-types.hpp \
- ipmid/sessiondef.hpp \
- ipmid/sessionhelper.hpp \
- ipmid/filter.hpp \
- ipmid/handler.hpp \
- ipmid/message.hpp \
- ipmid/message/pack.hpp \
- ipmid/message/types.hpp \
- ipmid/message/unpack.hpp \
- ipmid/api.h \
- ipmid/iana.hpp \
- ipmid/oemopenbmc.hpp \
- ipmid/oemrouter.hpp \
- ipmid/types.hpp \
- ipmid/utility.hpp \
- ipmid/utils.hpp \
- ipmid-host/cmd.hpp \
- ipmid-host/cmd-utils.hpp \
- dbus-sdr/sdrutils.hpp \
- dbus-sdr/sensorcommands.hpp \
- dbus-sdr/sensorutils.hpp \
- dbus-sdr/storagecommands.hpp
-
-# Eventually we will split <ipmid/*> and <host-ipmid/*> headers
-# For now they will be the same during migration
-install-data-local:
- $(MKDIR_P) $(DESTDIR)$(includedir)/host-ipmid
- $(LN_S) -f ../ipmid/iana.hpp $(DESTDIR)$(includedir)/host-ipmid/iana.hpp
- $(LN_S) -f ../ipmid/api.h $(DESTDIR)$(includedir)/host-ipmid/ipmid-api.h
- $(LN_S) -f ../ipmid/oemopenbmc.hpp $(DESTDIR)$(includedir)/host-ipmid/oemopenbmc.hpp
- $(LN_S) -f ../ipmid/oemrouter.hpp $(DESTDIR)$(includedir)/host-ipmid/oemrouter.hpp
- $(LN_S) -f ../ipmid-host/cmd.hpp $(DESTDIR)$(includedir)/host-ipmid/ipmid-host-cmd.hpp
- $(LN_S) -f ../ipmid-host/cmd-utils.hpp $(DESTDIR)$(includedir)/host-ipmid/ipmid-host-cmd-utils.hpp
-
diff --git a/include/meson.build b/include/meson.build
new file mode 100644
index 0000000..151493b
--- /dev/null
+++ b/include/meson.build
@@ -0,0 +1,36 @@
+install_subdir(
+ 'dbus-sdr',
+ install_dir: get_option('includedir'),
+ strip_directory: false,
+ exclude_files: '*.cpp')
+
+install_subdir(
+ 'ipmid',
+ install_dir: get_option('includedir'),
+ strip_directory: false,
+ exclude_files: '*.cpp')
+
+install_subdir(
+ 'ipmid-host',
+ install_dir: get_option('includedir'),
+ strip_directory: false,
+ exclude_files: '*.cpp')
+
+# Eventually we will split <ipmid/*> and <host-ipmid/*> headers
+# For now they will be the same during migration
+install_data(
+ 'ipmid/iana.hpp',
+ 'ipmid/api.h',
+ 'ipmid/oemopenbmc.hpp',
+ 'ipmid/oemrouter.hpp',
+ 'ipmid-host/cmd.hpp',
+ 'ipmid-host/cmd-utils.hpp',
+ install_dir: get_option('includedir') / 'host-ipmid',
+ rename: [
+ 'iana.hpp',
+ 'ipmid-api.h',
+ 'oemopenbmc.hpp',
+ 'oemrouter.hpp',
+ 'ipmid-host-cmd.hpp',
+ 'ipmid-host-cmd-utils.hpp',
+ ])
diff --git a/libipmid-host/Makefile.am b/libipmid-host/Makefile.am
deleted file mode 100644
index 7b8b003..0000000
--- a/libipmid-host/Makefile.am
+++ /dev/null
@@ -1,8 +0,0 @@
-pkgconfig_DATA = libipmid-host.pc
-lib_LTLIBRARIES = libipmid-host.la
-libipmid_host_la_SOURCES =
-libipmid_host_la_LDFLAGS = \
- $(SDBUSPLUS_LIBS) \
- -version-info 0:0:0 -shared
-libipmid_host_la_CXXFLAGS = \
- $(SDBUSPLUS_CFLAGS)
diff --git a/libipmid-host/libipmid-host.pc.in b/libipmid-host/libipmid-host.pc.in
deleted file mode 100644
index ba842ac..0000000
--- a/libipmid-host/libipmid-host.pc.in
+++ /dev/null
@@ -1,10 +0,0 @@
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-libdir=@libdir@
-includedir=@includedir@
-
-Name: libipmid-host
-Description: IPMI Host Daemon Library
-Version: @VERSION@
-Cflags: -I${includedir}
-Libs: -L${libdir} -lipmid-host
diff --git a/libipmid-host/meson.build b/libipmid-host/meson.build
new file mode 100644
index 0000000..b3a310a
--- /dev/null
+++ b/libipmid-host/meson.build
@@ -0,0 +1,16 @@
+ipmid_pre = [
+ sdbusplus_dep,
+]
+
+libipmid_host = 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/libipmid/Makefile.am b/libipmid/Makefile.am
deleted file mode 100644
index 189693f..0000000
--- a/libipmid/Makefile.am
+++ /dev/null
@@ -1,23 +0,0 @@
-COMMON_CXX = \
- -flto \
- -Wno-psabi \
- $(SYSTEMD_CFLAGS) \
- $(SDBUSPLUS_CFLAGS) \
- -DBOOST_ERROR_CODE_HEADER_ONLY \
- -DBOOST_SYSTEM_NO_DEPRECATED \
- -DBOOST_COROUTINES_NO_DEPRECATION_WARNING \
- -DBOOST_ASIO_DISABLE_THREADS \
- -DBOOST_ALL_NO_LIB
-
-pkgconfig_DATA = libipmid.pc
-lib_LTLIBRARIES = libipmid.la
-libipmid_la_SOURCES = \
- sdbus-asio.cpp \
- signals.cpp \
- systemintf-sdbus.cpp \
- utils.cpp
-libipmid_la_LDFLAGS = \
- $(SYSTEMD_LIBS) \
- -version-info 0:0:0 -shared
-libipmid_la_CXXFLAGS = \
- $(COMMON_CXX)
diff --git a/libipmid/libipmid.pc.in b/libipmid/libipmid.pc.in
deleted file mode 100644
index 9366846..0000000
--- a/libipmid/libipmid.pc.in
+++ /dev/null
@@ -1,10 +0,0 @@
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-libdir=@libdir@
-includedir=@includedir@
-
-Name: libipmid
-Description: IPMI Daemon Library
-Version: @VERSION@
-Cflags: -I${includedir}
-Libs: -L${libdir} -lipmid
diff --git a/libipmid/meson.build b/libipmid/meson.build
new file mode 100644
index 0000000..d0ae316
--- /dev/null
+++ b/libipmid/meson.build
@@ -0,0 +1,30 @@
+ipmid_pre = [
+ boost_coroutine,
+ phosphor_dbus_interfaces_dep,
+ sdbusplus_dep,
+ systemd,
+]
+
+libipmid = library(
+ 'ipmid',
+ 'sdbus-asio.cpp',
+ 'signals.cpp',
+ 'systemintf-sdbus.cpp',
+ 'utils.cpp',
+ dependencies: ipmid_pre,
+ version: meson.project_version(),
+ include_directories: root_inc,
+ install: true,
+ install_dir: get_option('libdir'),
+ override_options: ['b_lundef=false'])
+
+ipmid_dep = declare_dependency(
+ dependencies: ipmid_pre,
+ include_directories: root_inc,
+ link_with: libipmid)
+
+import('pkgconfig').generate(
+ libipmid,
+ name: 'libipmid',
+ version: meson.project_version(),
+ description: 'ipmid')
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..d933e36
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,270 @@
+project(
+ 'phosphor-host-ipimd',
+ 'cpp',
+ version: '0.1',
+ meson_version: '>=0.57.0',
+ default_options: [
+ 'werror=true',
+ 'warning_level=3',
+ 'cpp_std=c++20',
+ ])
+
+# Setting up config data
+conf_data = configuration_data()
+
+# The name of the callout's forward association
+conf_data.set_quoted('CALLOUT_FWD_ASSOCIATION', 'callout')
+conf_data.set_quoted('BOARD_SENSOR', get_option('board-sensor'))
+conf_data.set_quoted('SYSTEM_SENSOR', get_option('system-sensor'))
+
+# Soft Power off related.
+if not get_option('softoff').disabled()
+ conf_data.set_quoted('SOFTOFF_BUSNAME', get_option('softoff-busname'))
+ conf_data.set_quoted('SOFTOFF_OBJPATH', get_option('softoff-objpath'))
+ conf_data.set('IPMI_SMS_ATN_ACK_TIMEOUT_SECS', get_option('ipmi-sms-atn-ack-timeout-secs'))
+ conf_data.set('IPMI_HOST_SHUTDOWN_COMPLETE_TIMEOUT_SECS', get_option('ipmi-host-shutdown-complete-timeout-secs'))
+ conf_data.set_quoted('HOST_INBAND_REQUEST_DIR', get_option('host-inband-request-dir'))
+ conf_data.set_quoted('HOST_INBAND_REQUEST_FILE', get_option('host-inband-request-file'))
+endif
+
+conf_data.set_quoted('CONTROL_HOST_BUSNAME', get_option('control-host-busname'))
+conf_data.set_quoted('CONTROL_HOST_OBJ_MGR', get_option('control-host-obj-mgr'))
+conf_data.set_quoted('HOST_NAME', get_option('host-name'))
+conf_data.set_quoted('POWER_READING_SENSOR', get_option('power-reading-sensor'))
+conf_data.set_quoted('HOST_IPMI_LIB_PATH', get_option('host-ipmi-lib-path'))
+
+conf_h = configure_file(
+ output: 'config.h',
+ configuration: conf_data)
+
+root = meson.current_source_dir()
+root_inc = include_directories('.', 'include')
+
+# Project Arguments
+cpp = meson.get_compiler('cpp')
+add_project_arguments(
+ cpp.get_supported_arguments([
+ '-DBOOST_ERROR_CODE_HEADER_ONLY',
+ '-DBOOST_SYSTEM_NO_DEPRECATED',
+ '-DBOOST_COROUTINES_NO_DEPRECATION_WARNING',
+ '-DBOOST_ASIO_DISABLE_THREADS',
+ '-DBOOST_ALL_NO_LIB',
+ ]),
+ language : 'cpp')
+
+feature_map = {
+ 'boot-flag-safe-mode-support': '-DENABLE_BOOT_FLAG_SAFE_MODE_SUPPORT',
+ 'i2c-whitelist-check' : '-DENABLE_I2C_WHITELIST_CHECK',
+ 'update-functional-on-fail' : '-DUPDATE_FUNCTIONAL_ON_FAIL',
+ 'dynamic-sensors' : '-DFEATURE_DYNAMIC_SENSORS',
+ 'dynamic-sensors-write' : '-DFEATURE_DYNAMIC_SENSORS_WRITE',
+ 'hybrid-sensors' : '-DFEATURE_HYBRID_SENSORS',
+ 'sensors-cache' : '-DFEATURE_SENSORS_CACHE',
+ 'sel-logger-clears-sel' : '-DFEATURE_SEL_LOGGER_CLEARS_SEL',
+}
+
+foreach option_key, option_value : feature_map
+ if(get_option(option_key).enabled())
+ summary(option_key,option_value, section : 'Enabled Features')
+ add_project_arguments(option_value,language:'cpp')
+ endif
+endforeach
+
+add_project_arguments(
+ cpp.get_supported_arguments([
+ '-flto',
+ '-Wno-psabi',
+ '-Wno-missing-field-initializers',
+ '-Wno-pedantic',
+ '-Wno-non-virtual-dtor'
+ ]),
+ language: 'cpp')
+
+# Dependencies
+phosphor_logging_dep = dependency('phosphor-logging')
+phosphor_dbus_interfaces_dep = dependency('phosphor-dbus-interfaces')
+sdeventplus_dep = dependency('sdeventplus')
+systemd = dependency('systemd')
+crypto = dependency('libcrypto', version : '>=1.0.2g')
+pam = cpp.find_library('pam', required: true)
+mapper = cpp.find_library('mapper', required: true)
+boost_coroutine = cpp.find_library('boost_coroutine', required: true)
+std_cpp_fs = cpp.find_library('stdc++fs', required: true)
+
+sdbusplus_dep = dependency('sdbusplus', required : false, include_type: 'system')
+if not sdbusplus_dep.found()
+ sdbusplus_proj = subproject('sdbusplus', required: true)
+ sdbusplus_dep = sdbusplus_proj.get_variable('sdbusplus_dep')
+ sdbusplus_dep = sdbusplus_dep.as_system('system')
+endif
+
+# Subfolders
+subdir('libipmid')
+subdir('libipmid-host')
+subdir('include')
+subdir('user_channel')
+subdir('scripts')
+
+if not get_option('softoff').disabled()
+ subdir('xyz/openbmc_project/Ipmi/Internal/SoftPowerOff')
+ subdir('softoff')
+endif
+
+# whitelist
+if not get_option('ipmi-whitelist').disabled()
+ generate_whitelist_script = files('generate_whitelist_create.sh')
+
+ whitelist_conf = get_option('whitelist-conf')
+ ipmiwhitelist = run_command( \
+ 'bash', \
+ generate_whitelist_script, \
+ whitelist_conf)
+
+ whitelist_pre = declare_dependency(
+ include_directories: root_inc,
+ dependencies: [
+ channellayer_dep,
+ crypto,
+ ipmid_dep,
+ phosphor_dbus_interfaces_dep,
+ phosphor_logging_dep,
+ sdbusplus_dep,
+ ],
+ )
+
+ whitelist_lib = shared_module(
+ 'whitelist',
+ 'whitelist-filter.cpp',
+ 'ipmiwhitelist.cpp',
+ implicit_include_directories: false,
+ dependencies: whitelist_pre,
+ 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,
+ dependencies: [
+ channellayer_dep,
+ crypto,
+ mapper,
+ phosphor_dbus_interfaces_dep,
+ phosphor_logging_dep,
+ sdbusplus_dep,
+ ipmid_dep,
+ ])
+
+sysintfcmds_lib = shared_module(
+ 'sysintfcmds',
+ 'systemintfcmds.cpp',
+ 'host-interface.cpp',
+ implicit_include_directories: false,
+ dependencies: sysintfcmds_pre,
+ 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,
+ phosphor_logging_dep,
+ phosphor_dbus_interfaces_dep,
+ boost_coroutine,
+ crypto,
+ ipmid_dep,
+ channellayer_dep,
+ mapper,
+ std_cpp_fs
+]
+
+generated_src = [
+ meson.project_build_root() + '/sensor-gen.cpp',
+ meson.project_build_root() + '/inventory-sensor-gen.cpp',
+ meson.project_build_root() + '/fru-read-gen.cpp',
+]
+
+transportoem_src = []
+if not get_option('transport-oem').disabled()
+ transportoem_src = ['transporthandler_oem.cpp']
+endif
+
+entity_map_json_lib = static_library(
+ 'entity_map_json',
+ 'entity_map_json.cpp',
+ include_directories: root_inc,
+ dependencies: [ipmid_dep],
+ implicit_include_directories: false)
+
+entity_map_json_dep = declare_dependency(link_with: entity_map_json_lib)
+
+libipmi20_src = [
+ 'app/channel.cpp',
+ 'app/watchdog.cpp',
+ 'app/watchdog_service.cpp',
+ 'apphandler.cpp',
+ 'sys_info_param.cpp',
+ 'sensorhandler.cpp',
+ 'storagehandler.cpp',
+ 'chassishandler.cpp',
+ 'dcmihandler.cpp',
+ 'ipmisensor.cpp',
+ 'storageaddsel.cpp',
+ 'transporthandler.cpp',
+ 'globalhandler.cpp',
+ 'groupext.cpp',
+ 'selutility.cpp',
+ 'ipmi_fru_info_area.cpp',
+ 'read_fru_data.cpp',
+ 'sensordatahandler.cpp',
+ generated_src,
+ transportoem_src,
+ conf_h,
+]
+
+ipmi20_lib = library(
+ 'ipmi20',
+ libipmi20_src,
+ dependencies: [ipmid_pre, entity_map_json_dep],
+ include_directories: root_inc,
+ install: true,
+ install_dir: get_option('libdir') / 'ipmid-providers',
+ override_options: ['b_lundef=false'])
+
+libipmi20_dep = declare_dependency(
+ dependencies: ipmid_pre,
+ include_directories: root_inc,
+ link_with: ipmi20_lib)
+
+# ipmid binary
+executable(
+ 'ipmid',
+ 'ipmid-new.cpp',
+ 'host-cmd-manager.cpp',
+ 'settings.cpp',
+ implicit_include_directories: false,
+ dependencies: [libipmi20_dep],
+ include_directories: root_inc,
+ export_dynamic: true,
+ install: true,
+ install_dir: get_option('bindir'))
+
+# Dynamic Sensor Stack
+subdir('dbus-sdr')
+
+if not get_option('tests').disabled()
+ subdir('test')
+endif
+
+install_subdir(
+ 'user_channel',
+ install_dir: get_option('includedir'),
+ strip_directory: false,
+ exclude_files: '*.cpp')
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 0000000..af121c6
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1,66 @@
+
+option('tests', type: 'feature', description: 'Build tests')
+option('boot-flag-safe-mode-support', type: 'feature', description: 'Add option to enable/disable safe mode in boot flags')
+option('i2c-whitelist-check', type: 'feature', description: 'Add option to enable/disable i2c master write read command white list checking')
+
+# SoftPowerOff
+option('softoff', type: 'feature', description: 'Builds soft power off')
+option('softoff-busname', type: 'string', value: 'xyz.openbmc_project.Ipmi.Internal.SoftPowerOff', description: 'The Dbus busname to own for SoftPowerOff')
+option('softoff-objpath', type: 'string', value: '/xyz/openbmc_project/ipmi/internal/soft_power_off', description: 'The SoftPowerOff Dbus root')
+option('ipmi-sms-atn-ack-timeout-secs', type: 'integer', value: 3, description: 'Timeout for host to ack and query SMS_ATN from BMC')
+option('ipmi-host-shutdown-complete-timeout-secs', type: 'integer', value: 2700, description: 'Wait time for host to shutdown')
+# Indicates an in-band power off or reboot request from the host
+# This file is used to ensure the soft off service does not run for host
+# initiated shutdown or reboot requests
+option('host-inband-request-dir', type: 'string', value: '/run/openbmc/', description: 'Directory to store host initiated shutdown file')
+option('host-inband-request-file', type: 'string', value: 'host@%u-request', description: 'File to create if host has initiated shutdown or reboot')
+
+
+# Config Variables
+option('board-sensor', type: 'string', value: '/xyz/openbmc_project/inventory/system/chassis/motherboard', description: 'The inventory path to the motherboard fault sensor')
+option('system-sensor', type: 'string', value: '/xyz/openbmc_project/inventory/system', description: 'The inventory path to the system event sensor')
+
+# Control Host Interfaces
+option('control-host-busname', type: 'string', value: 'xyz.openbmc_project.Control.Host', description: 'The Control Host Dbus busname to own')
+option('control-host-obj-mgr', type: 'string', value: '/xyz/openbmc_project/control', description: 'The Control Host D-Bus Object Manager')
+option('host-name', type: 'string', value: 'host', description: 'The Control Host D-Bus Object Manager')
+
+# Power reading sensor configuration file
+option('power-reading-sensor', type: 'string', value: '/usr/share/ipmi-providers/power_reading.json', description: 'Power reading sensor configuration file')
+option('host-ipmi-lib-path', type: 'string', value: '/usr/lib/ipmid-providers/', description: 'The file path to search for libraries')
+
+# When a sensor read fails, hwmon will update the OperationalState interface's Functional property.
+# This will mark the sensor as not functional and we will skip reading from that sensor.
+option('update-functional-on-fail', type: 'feature', value: 'disabled', description: 'Check functional property to skip reading from faulty sensors')
+
+# Features
+
+# When libuserlayer is disabled, libuserlayer won't be included in the build.
+option('libuserlayer', type: 'feature', description: 'Option to exclue exclude libuserlayer')
+
+# When transport-oem is enabled, the transporthandler_oem.cpp contents
+# are compiled and added to the project. The transporthandler_oem.cpp file is
+# copied from your own customization layer in the
+# phosphor-ipmi-host_%.bbappend file. It is not necessary to create this file
+# unless OEM Parameter extensions are required.
+option('transport-oem', type: 'feature', value: 'disabled', description: 'Enable transporthandler_oem contents')
+
+# IPMI whitelist mechanism is not needed by everyone; offer a way to disable it
+option('ipmi-whitelist', type: 'feature', description: 'Enable/disable IPMI whitelist filtering')
+option('whitelist-conf', type: 'string', value: 'host-ipmid-whitelist.conf', description: 'Paths to IPMI whitelisted commands conf files')
+
+# Dynamic Sensor Stack
+option('dynamic-sensors', type: 'feature', value: 'disabled', description: 'Dynamic sensors stack is enabled by default; offer a way to disable it')
+option('dynamic-sensors-write', type: 'feature', value: 'disabled', description: 'Dynamic sensors stack is enabled by default; offer a way to disable it')
+option('hybrid-sensors', type: 'feature', value: 'disabled', description: 'Hybrid sensors stack is disabled by default; offer a way to enable it')
+
+# Sensor Cache
+option('sensors-cache', type: 'feature', value: 'disabled', description: 'Sensor cache stack is disabled by default; offer a way to enable it')
+
+# SEL Logger
+option('sel-logger-clears-sel', type: 'feature', value: 'disabled', description: 'Clearing SEL through sel-logger is disabled by default; offer a way to enable it')
+
+# Generate configuration from Yaml
+option('sensor-yaml-gen', type: 'string', value: 'sensor-example.yaml')
+option('invsensor-yaml-gen', type: 'string', value: 'inventory-sensor-example.yaml')
+option('fru-yaml-gen', type: 'string', value: 'fru-read-example.yaml')
diff --git a/sample.cpp b/sample.cpp
deleted file mode 100644
index 72a120a..0000000
--- a/sample.cpp
+++ /dev/null
@@ -1,11 +0,0 @@
-#include <sample.h>
-
-int Factorial(int n)
-{
- int result = 1;
- for (int i = 1; i <= n; i++)
- {
- result *= i;
- }
- return result;
-}
diff --git a/sample.h b/sample.h
deleted file mode 100644
index 6ff3cf9..0000000
--- a/sample.h
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef GTEST_SAMPLE
-#define GTEST_SAMPLE
-
-int Factorial(int n);
-
-#endif
diff --git a/scripts/meson.build b/scripts/meson.build
new file mode 100644
index 0000000..3740227
--- /dev/null
+++ b/scripts/meson.build
@@ -0,0 +1,35 @@
+# Generate Configuration Files from Yaml
+python_exe = find_program('python3', 'python')
+
+sensor_yaml_script = files('sensor_gen.py')
+sensor_yaml_gen = run_command( \
+ python_exe, \
+ sensor_yaml_script, \
+ '-i', get_option('sensor-yaml-gen'), \
+ '-o', meson.project_build_root(), \
+ 'generate-cpp')
+if sensor_yaml_gen.returncode() != 0
+ error(sensor_yaml_gen.stderr())
+endif
+
+invsensor_yaml_script = files('inventory-sensor.py')
+invsensor_yaml_gen = run_command( \
+ python_exe, \
+ invsensor_yaml_script, \
+ '-i', get_option('invsensor-yaml-gen'), \
+ '-o', meson.project_build_root(), \
+ 'generate-cpp')
+if invsensor_yaml_gen.returncode() != 0
+ error(invsensor_yaml_gen.stderr())
+endif
+
+fru_yaml_script = files('fru_gen.py')
+fru_yaml_gen = run_command( \
+ python_exe, \
+ fru_yaml_script, \
+ '-i', get_option('fru-yaml-gen'), \
+ '-o', meson.project_build_root(), \
+ 'generate-cpp')
+if fru_yaml_gen.returncode() != 0
+ error(fru_yaml_gen.stderr())
+endif
diff --git a/softoff/Makefile.am b/softoff/Makefile.am
deleted file mode 100644
index ec938a3..0000000
--- a/softoff/Makefile.am
+++ /dev/null
@@ -1,49 +0,0 @@
-AM_DEFAULT_SOURCE_EXT = .cpp
-bin_PROGRAMS = phosphor-softpoweroff
-
-# Using ../ instead of $(top_srcdir) due to automake bug in version 1.15.
-# https://debbugs.gnu.org/cgi/bugreport.cgi?bug=13928
-phosphor_softpoweroff_SOURCES = \
- softoff.cpp \
- mainapp.cpp \
- xyz/openbmc_project/Ipmi/Internal/SoftPowerOff/server.cpp \
- ../libipmid/utils.cpp
-
-BUILT_SOURCES = \
- xyz/openbmc_project/Ipmi/Internal/SoftPowerOff/server.cpp \
- xyz/openbmc_project/Ipmi/Internal/SoftPowerOff/server.hpp
-
-nodist_include_HEADERS = xyz/openbmc_project/Ipmi/Internal/SoftPowerOff/server.hpp
-CLEANFILES = \
- xyz/openbmc_project/Ipmi/Internal/SoftPowerOff/server.cpp \
- xyz/openbmc_project/Ipmi/Internal/SoftPowerOff/server.hpp
-
-phosphor_softpoweroff_LDFLAGS = \
- $(SYSTEMD_LIBS) \
- $(SDBUSPLUS_LIBS) \
- $(SDEVENTPLUS_LIBS) \
- $(PHOSPHOR_LOGGING_LIBS) \
- -lboost_coroutine \
- $(PHOSPHOR_DBUS_INTERFACES_LIBS)
-phosphor_softpoweroff_CXXFLAGS = \
- -flto \
- -Wno-psabi \
- -DBOOST_ERROR_CODE_HEADER_ONLY \
- -DBOOST_SYSTEM_NO_DEPRECATED \
- -DBOOST_COROUTINES_NO_DEPRECATION_WARNING \
- -DBOOST_ASIO_DISABLE_THREADS \
- -DBOOST_ALL_NO_LIB
- $(SYSTEMD_CFLAGS) \
- $(SDBUSPLUS_CFLAGS) \
- $(SDEVENTPLUS_CFLAGS) \
- $(PHOSPHOR_LOGGING_CFLAGS) \
- $(PHOSPHOR_DBUS_INTERFACES_CFLAGS)
-
-xyz/openbmc_project/Ipmi/Internal/SoftPowerOff/server.cpp: ${top_srcdir}/xyz/openbmc_project/Ipmi/Internal/SoftPowerOff.interface.yaml
- @mkdir -p `dirname $@`
- $(SDBUSPLUSPLUS) -r $(top_srcdir) interface server-cpp xyz.openbmc_project.Ipmi.Internal.SoftPowerOff > $@
-
-xyz/openbmc_project/Ipmi/Internal/SoftPowerOff/server.hpp: ${top_srcdir}/xyz/openbmc_project/Ipmi/Internal/SoftPowerOff.interface.yaml
- @mkdir -p `dirname $@`
- $(SDBUSPLUSPLUS) -r $(top_srcdir) interface server-header xyz.openbmc_project.Ipmi.Internal.SoftPowerOff > $@
-
diff --git a/softoff/meson.build b/softoff/meson.build
new file mode 100644
index 0000000..f34ad98
--- /dev/null
+++ b/softoff/meson.build
@@ -0,0 +1,31 @@
+softpower_pre = [
+ ipmid_dep,
+ phosphor_logging_dep,
+ phosphor_dbus_interfaces_dep,
+ sdeventplus_dep,
+ sdbusplus_dep,
+ systemd,
+ softoff_dbus,
+ boost_coroutine
+]
+
+softpower_lib = static_library(
+ 'softpower_lib',
+ 'softoff.cpp',
+ conf_h,
+ dependencies: softpower_pre,
+ include_directories: root_inc)
+
+softpower_dep = declare_dependency(
+ dependencies: softpower_pre,
+ include_directories: root_inc,
+ link_with: softpower_lib)
+
+executable(
+ 'phosphor-softpoweroff',
+ 'mainapp.cpp',
+ implicit_include_directories: false,
+ dependencies: softpower_dep,
+ include_directories: root_inc,
+ install: true,
+ install_dir: get_option('bindir'))
diff --git a/subprojects/nlohmann_json.wrap b/subprojects/nlohmann_json.wrap
new file mode 100644
index 0000000..0ba9c03
--- /dev/null
+++ b/subprojects/nlohmann_json.wrap
@@ -0,0 +1,3 @@
+[wrap-git]
+url = https://github.com/nlohmann/json
+revision = HEAD
diff --git a/subprojects/phosphor-dbus-interfaces.wrap b/subprojects/phosphor-dbus-interfaces.wrap
new file mode 100644
index 0000000..0bf731e
--- /dev/null
+++ b/subprojects/phosphor-dbus-interfaces.wrap
@@ -0,0 +1,7 @@
+
+[wrap-git]
+url = https://github.com/openbmc/phosphor-dbus-interfaces.git
+revision = HEAD
+
+[provide]
+phosphor-dbus-interfaces = phosphor_dbus_interfaces_dep
diff --git a/subprojects/phosphor-logging.wrap b/subprojects/phosphor-logging.wrap
new file mode 100644
index 0000000..6876a6e
--- /dev/null
+++ b/subprojects/phosphor-logging.wrap
@@ -0,0 +1,6 @@
+[wrap-git]
+url = https://github.com/openbmc/phosphor-logging
+revision = HEAD
+
+[provide]
+phosphor-logging = phosphor_logging_dep
diff --git a/subprojects/sdbusplus.wrap b/subprojects/sdbusplus.wrap
new file mode 100644
index 0000000..42cfcee
--- /dev/null
+++ b/subprojects/sdbusplus.wrap
@@ -0,0 +1,6 @@
+[wrap-git]
+url = https://github.com/openbmc/sdbusplus
+revision = HEAD
+
+[provide]
+sdbusplus = sdbusplus_dep
diff --git a/subprojects/sdeventplus.wrap b/subprojects/sdeventplus.wrap
new file mode 100644
index 0000000..a506404
--- /dev/null
+++ b/subprojects/sdeventplus.wrap
@@ -0,0 +1,6 @@
+[wrap-git]
+url = https://github.com/openbmc/sdeventplus
+revision = HEAD
+
+[provide]
+sdeventplus = sdeventplus_dep
diff --git a/test/Makefile.am b/test/Makefile.am
deleted file mode 100644
index 89f4fc6..0000000
--- a/test/Makefile.am
+++ /dev/null
@@ -1,112 +0,0 @@
-COMMON_CXX = \
- -flto \
- -Wno-psabi \
- $(SDBUSPLUS_CFLAGS) \
- $(SYSTEMD_CFLAGS) \
- $(libmapper_CFLAGS) \
- $(SDBUSPLUS_CFLAGS) \
- $(PHOSPHOR_LOGGING_CFLAGS) \
- $(PHOSPHOR_DBUS_INTERFACES_CFLAGS) \
- -DBOOST_ERROR_CODE_HEADER_ONLY \
- -DBOOST_SYSTEM_NO_DEPRECATED \
- -DBOOST_COROUTINES_NO_DEPRECATION_WARNING \
- -DBOOST_ASIO_DISABLE_THREADS \
- -DBOOST_ALL_NO_LIB
-
-AM_CPPFLAGS = \
- -I$(top_srcdir) \
- -I$(top_srcdir)/include \
- $(CODE_COVERAGE_CPPFLAGS) \
- $(GTEST_CFLAGS)
-AM_CFLAGS = $(CODE_COVERAGE_CFLAGS)
-AM_CXXFLAGS = $(GTEST_MAIN_CFLAGS) $(GTEST_CFLAGS)
-AM_LDFLAGS = $(GTEST_MAIN_LIBS) $(OESDK_TESTCASE_FLAGS)
-
-# Run all 'check' test programs
-check_PROGRAMS =
-TESTS = $(check_PROGRAMS)
-
-entitymap_json_unittest_SOURCES = entitymap_json_unittest.cpp
-entitymap_json_unittest_LDADD = $(top_builddir)/entity_map_json.o -lgmock
-
-check_PROGRAMS += entitymap_json_unittest
-
-# Build/add sample_unittest to test suite
-sample_unittest_CPPFLAGS = -Igtest $(GTEST_CPPFLAGS) $(AM_CPPFLAGS)
-sample_unittest_CXXFLAGS = $(PTHREAD_CFLAGS) $(CODE_COVERAGE_CXXFLAGS) \
- $(CODE_COVERAGE_CFLAGS)
-sample_unittest_LDFLAGS = -lgtest_main -lgtest -pthread $(OESDK_TESTCASE_FLAGS) \
- $(CODE_COVERAGE_LDFLAGS)
-sample_unittest_SOURCES = %reldir%/sample_unittest.cpp
-sample_unittest_LDADD = $(top_builddir)/sample.o
-check_PROGRAMS += %reldir%/sample_unittest
-
-# Build/add oemrouter_unittest to test suite
-# Issue #3325
-#check_PROGRAMS += oemrouter_unittest
-#oemrouter_unittest_SOURCES = oemrouter_unittest.cpp
-#oemrouter_unittest_LDADD = $(top_builddir)/oemrouter.o
-
-# Build/add message packing/unpacking unit tests
-message_unittest_CPPFLAGS = \
- -Igtest \
- $(GTEST_CPPFLAGS) \
- $(AM_CPPFLAGS)
-message_unittest_CXXFLAGS = \
- $(COMMON_CXX) \
- $(PTHREAD_CFLAGS) \
- $(PHOSPHOR_LOGGING_CFLAGS) \
- $(CODE_COVERAGE_CXXFLAGS) \
- $(CODE_COVERAGE_CFLAGS)
-message_unittest_LDFLAGS = \
- -lgtest_main \
- -lgtest \
- -lsdbusplus \
- -lsystemd \
- -pthread \
- $(CRYPTO_LIBS) \
- $(PHOSPHOR_LOGGING_LIBS) \
- $(OESDK_TESTCASE_FLAGS) \
- $(CODE_COVERAGE_LDFLAGS)
-message_unittest_SOURCES = \
- %reldir%/message/payload.cpp \
- %reldir%/message/unpack.cpp \
- %reldir%/message/pack.cpp
-check_PROGRAMS += %reldir%/message_unittest
-
-# Build/add closesession_unittest to test suite
-session_unittest_CPPFLAGS = \
- -Igtest \
- $(GTEST_CPPFLAGS) \
- $(AM_CPPFLAGS)
-session_unittest_CXXFLAGS = \
- $(PTHREAD_CFLAGS) \
- $(CODE_COVERAGE_CXXFLAGS) \
- $(CODE_COVERAGE_CFLAGS)
-session_unittest_LDFLAGS = \
- -lgtest_main \
- -lgtest \
- -pthread \
- $(OESDK_TESTCASE_FLAGS) \
- $(CODE_COVERAGE_LDFLAGS)
-session_unittest_SOURCES = %reldir%/session/closesession_unittest.cpp
-check_PROGRAMS += %reldir%/session_unittest
-
-# Build/add sensorcommands_unittest to test suite
-sensorcommands_unittest_CPPFLAGS = \
- -Igtest \
- $(GTEST_CPPFLAGS) \
- $(AM_CPPFLAGS)
-sensorcommands_unittest_CXXFLAGS = \
- $(PTHREAD_CFLAGS) \
- $(CODE_COVERAGE_CXXFLAGS) \
- $(CODE_COVERAGE_CFLAGS)
-sensorcommands_unittest_LDFLAGS = \
- -lgtest_main \
- -lgtest \
- -pthread \
- $(OESDK_TESTCASE_FLAGS) \
- $(CODE_COVERAGE_LDFLAGS)
-sensorcommands_unittest_SOURCES = %reldir%/dbus-sdr/sensorcommands_unittest.cpp
-sensorcommands_unittest_LDADD = $(top_builddir)/dbus-sdr/sensorutils.o
-check_PROGRAMS += %reldir%/sensorcommands_unittest
diff --git a/test/meson.build b/test/meson.build
new file mode 100644
index 0000000..3306a91
--- /dev/null
+++ b/test/meson.build
@@ -0,0 +1,78 @@
+gtest = dependency('gtest', main: true, disabler: true, required: false)
+gmock = dependency('gmock', disabler: true, required: false)
+if not gtest.found() or not gmock.found()
+ gtest_opts = import('cmake').subproject_options()
+ gtest_opts.add_cmake_defines({'CMAKE_CXX_FLAGS': '-Wno-pedantic'})
+ gtest_proj = import('cmake').subproject(
+ 'googletest',
+ options: gtest_opts,
+ required: false)
+ if gtest_proj.found()
+ gtest = declare_dependency(
+ dependencies: [
+ dependency('threads'),
+ gtest_proj.dependency('gtest'),
+ gtest_proj.dependency('gtest_main'),
+ ])
+ gmock = gtest_proj.dependency('gmock')
+ else
+ assert(not get_option('tests').enabled(), 'Googletest is required')
+ endif
+endif
+
+test('entitymap_json',
+ executable(
+ 'entitymap_json',
+ 'entitymap_json_unittest.cpp',
+ include_directories: root_inc,
+ build_by_default: false,
+ implicit_include_directories: false,
+ dependencies: [entity_map_json_dep, gtest, gmock]
+ ))
+
+# Build/add oemrouter_unittest to test suite
+# Issue #3325
+# test('oemrouter',
+# executable(
+# 'oemrouter',
+# 'oemrouter_unittest.cpp',
+# include_directories: root_inc,
+# build_by_default: false,
+# implicit_include_directories: false,
+# dependencies: [gtest, gmock]
+# ))
+
+# Build/add message packing/unpacking unit tests
+test('message',
+ executable(
+ 'message',
+ 'message/pack.cpp',
+ 'message/payload.cpp',
+ 'message/unpack.cpp',
+ include_directories: root_inc,
+ build_by_default: false,
+ implicit_include_directories: false,
+ dependencies: [phosphor_logging_dep, crypto, systemd, sdbusplus_dep, gtest, gmock]
+ ))
+
+# Build/add closesession_unittest to test suite
+test('session/closesession',
+ executable(
+ 'session_closesession',
+ 'session/closesession_unittest.cpp',
+ include_directories: root_inc,
+ build_by_default: false,
+ implicit_include_directories: false,
+ dependencies: [gtest, gmock]
+ ))
+
+# Build/add sensorcommands_unittest to test suite
+test('dbus-sdr/sensorcommands',
+ executable(
+ 'dbus-sdr_sensorcommands',
+ 'dbus-sdr/sensorcommands_unittest.cpp',
+ include_directories: root_inc,
+ build_by_default: false,
+ implicit_include_directories: false,
+ dependencies: [sensorutils_dep, gtest, gmock]
+ ))
diff --git a/test/sample_unittest.cpp b/test/sample_unittest.cpp
deleted file mode 100644
index e574173..0000000
--- a/test/sample_unittest.cpp
+++ /dev/null
@@ -1,8 +0,0 @@
-#include "sample.h"
-
-#include <gtest/gtest.h>
-
-TEST(FactorialTest, Zero)
-{
- EXPECT_EQ(1, Factorial(0));
-}
diff --git a/user_channel/Makefile.am b/user_channel/Makefile.am
deleted file mode 100644
index bcd8573..0000000
--- a/user_channel/Makefile.am
+++ /dev/null
@@ -1,53 +0,0 @@
-COMMON_CXX = \
- -flto \
- -Wno-psabi \
- $(SYSTEMD_CFLAGS) \
- $(libmapper_CFLAGS) \
- $(SDBUSPLUS_CFLAGS) \
- $(PHOSPHOR_LOGGING_CFLAGS) \
- $(PHOSPHOR_DBUS_INTERFACES_CFLAGS) \
- -DBOOST_ERROR_CODE_HEADER_ONLY \
- -DBOOST_SYSTEM_NO_DEPRECATED \
- -DBOOST_COROUTINES_NO_DEPRECATION_WARNING \
- -DBOOST_ASIO_DISABLE_THREADS \
- -DBOOST_ALL_NO_LIB
-
-
-lib_LTLIBRARIES =
-
-if FEATURE_LIBUSERLAYER
-
-lib_LTLIBRARIES += libuserlayer.la
-libuserlayer_la_SOURCES = \
- user_layer.cpp \
- user_mgmt.cpp \
- passwd_mgr.cpp
-libuserlayer_la_LDFLAGS = \
- $(SYSTEMD_LIBS) \
- $(libmapper_LIBS) \
- $(PHOSPHOR_LOGGING_LIBS) \
- $(PHOSPHOR_DBUS_INTERFACES_LIBS) \
- -lstdc++fs \
- $(CRYPTO_LIBS) \
- -lpam_misc \
- -version-info 0:0:0 -shared
-libuserlayer_la_CXXFLAGS = \
- -I$(top_srcdir) \
- $(COMMON_CXX)
-endif
-
-lib_LTLIBRARIES += libchannellayer.la
-libchannellayer_la_SOURCES = \
- channel_mgmt.cpp \
- channel_layer.cpp \
- cipher_mgmt.cpp
-libchannellayer_la_LDFLAGS = \
- $(SYSTEMD_LIBS) \
- $(libmapper_LIBS) \
- $(PHOSPHOR_LOGGING_LIBS) \
- $(PHOSPHOR_DBUS_INTERFACES_LIBS) \
- -lstdc++fs \
- -version-info 0:0:0 -shared
-libchannellayer_la_CXXFLAGS = \
- -I$(top_srcdir) \
- $(COMMON_CXX)
diff --git a/user_channel/meson.build b/user_channel/meson.build
new file mode 100644
index 0000000..b7d6a87
--- /dev/null
+++ b/user_channel/meson.build
@@ -0,0 +1,91 @@
+user_channel_inc = include_directories('.')
+
+channellayer_pre = declare_dependency(
+ include_directories: [root_inc, user_channel_inc],
+ dependencies: [
+ crypto,
+ ipmid_dep,
+ phosphor_dbus_interfaces_dep,
+ phosphor_logging_dep,
+ std_cpp_fs,
+ systemd,
+ ])
+
+channellayer_src = [
+ 'channel_layer.cpp',
+ 'channel_mgmt.cpp',
+ 'cipher_mgmt.cpp',
+]
+
+channellayer_lib = library(
+ 'channellayer',
+ channellayer_src,
+ implicit_include_directories: false,
+ dependencies: channellayer_pre,
+ version: meson.project_version(),
+ install: true,
+ install_dir: get_option('libdir'),
+ override_options: ['b_lundef=false'])
+
+channellayer_dep = declare_dependency(
+ link_with: channellayer_lib,
+ dependencies: channellayer_pre)
+
+if not get_option('libuserlayer').disabled()
+ userlayer_pre = declare_dependency(
+ include_directories: [root_inc, user_channel_inc],
+ dependencies: [
+ channellayer_dep,
+ crypto,
+ ipmid_dep,
+ phosphor_dbus_interfaces_dep,
+ phosphor_logging_dep,
+ pam,
+ std_cpp_fs,
+ systemd,
+ ])
+
+ userlayer_src = [
+ 'user_layer.cpp',
+ 'user_mgmt.cpp',
+ 'passwd_mgr.cpp',
+ ]
+
+ userlayer_lib = library(
+ 'userlayer',
+ userlayer_src,
+ implicit_include_directories: false,
+ dependencies: userlayer_pre,
+ version: meson.project_version(),
+ install: true,
+ install_dir: get_option('libdir'),
+ override_options: ['b_lundef=false'])
+
+ userlayer_dep = declare_dependency(
+ link_with: userlayer_lib,
+ dependencies: userlayer_pre)
+
+ usercmds_pre = declare_dependency(
+ include_directories: [root_inc, user_channel_inc],
+ dependencies: [
+ mapper,
+ phosphor_logging_dep,
+ ipmid_dep,
+ userlayer_dep,
+ channellayer_dep,
+ ])
+
+ usercmds_lib = shared_library(
+ 'usercmds',
+ 'usercommands.cpp',
+ implicit_include_directories: false,
+ dependencies: usercmds_pre,
+ install: true,
+ install_dir: get_option('libdir') / 'ipmid-providers',
+ override_options: ['b_lundef=false'])
+
+ usercmds_dep = declare_dependency(
+ link_with: usercmds_lib,
+ dependencies: usercmds_pre)
+
+endif
diff --git a/xyz/openbmc_project/Ipmi/Internal/SoftPowerOff/meson.build b/xyz/openbmc_project/Ipmi/Internal/SoftPowerOff/meson.build
new file mode 100644
index 0000000..2302ad4
--- /dev/null
+++ b/xyz/openbmc_project/Ipmi/Internal/SoftPowerOff/meson.build
@@ -0,0 +1,57 @@
+sdbuspp_prog = find_program('sdbus++')
+
+domain = 'xyz.openbmc_project.Ipmi.Internal.SoftPowerOff'
+if_yaml_file = files('../SoftPowerOff.interface.yaml')
+
+if_cpp = custom_target(
+ 'server.cpp',
+ output: 'server.cpp',
+ input: if_yaml_file,
+ capture: true,
+ command: [sdbuspp_prog, '-r', root, 'interface', 'server-cpp', domain])
+
+if_hpp = custom_target(
+ 'server.hpp',
+ output: 'server.hpp',
+ input: if_yaml_file,
+ capture: true,
+ command: [sdbuspp_prog, '-r', root, 'interface', 'server-header', domain],
+ install: true,
+ install_dir: get_option('includedir') / 'xyz/openbmc_project/Ipmi/Internal/SoftPowerOff')
+
+softoff_dbus_deps = [
+ dependency('phosphor-dbus-interfaces'),
+ dependency('sdbusplus'),
+]
+
+softoff_dbus_lib = library(
+ 'softoff-dbus',
+ [
+ if_cpp,
+ if_hpp,
+ ],
+ implicit_include_directories: false,
+ include_directories: root_inc,
+ version: meson.project_version(),
+ dependencies: softoff_dbus_deps,
+ override_options: ['b_lundef=false'],
+ install: true)
+
+softoff_dbus = declare_dependency(
+ dependencies: softoff_dbus_deps,
+ sources: [if_hpp],
+ link_with: softoff_dbus_lib)
+
+softoff_dbus_reqs = []
+foreach dep : softoff_dbus_deps
+ if dep.type_name() == 'pkgconfig'
+ softoff_dbus_reqs += dep
+ endif
+endforeach
+
+import('pkgconfig').generate(
+ name: 'softoff-dbus',
+ description: 'SoftPowerOff DBus Bindings',
+ version: meson.project_version(),
+ libraries: softoff_dbus,
+ requires: softoff_dbus_reqs)