meson: add basic meson

Since we don't have a CI for standard Make repositories anymore,
this repository has no CI.  Begin a simple meson conversion to
enable some CI for the bare minimum aspects of the repository still
being used in openbmc/openbmc.

    - libopenbmc_intf
    - op-pwrctl
    - pgood_wait
    - op-hostctl

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I598e91c08b5ad607b68c18bfa9a870603df19397
diff --git a/.gitignore b/.gitignore
index a76f2a3..54f1cfb 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,7 @@
+/build*/
+/subprojects/*
+!/subprojects/*.wrap
+
 *.exe
 *.o
 *.so
diff --git a/libopenbmc_intf/meson.build b/libopenbmc_intf/meson.build
new file mode 100644
index 0000000..8ca726f
--- /dev/null
+++ b/libopenbmc_intf/meson.build
@@ -0,0 +1,31 @@
+gnome = import('gnome')
+
+openbmc_intf_src = gnome.gdbus_codegen(
+    'openbmc_intf',
+    sources: 'openbmc_intf.xml',
+    interface_prefix: 'org.openbmc',
+    object_manager: true,
+)
+
+libopenbmc_intf = library(
+    'libopenbmc_intf',
+    'gpio.c',
+    'gpio_configs.c',
+    'gpio_json.c',
+    openbmc_intf_src,
+    # The gdbus generated code cannot be compiled with -Wpedantic.
+    c_args : '-Wno-pedantic',
+    dependencies: [cjson_dep, gio_unix_dep, glib_dep],
+    version: meson.project_version(),
+    install: true,
+)
+
+libopenbmc_intf_includes = include_directories('.')
+
+import('pkgconfig').generate(
+    libopenbmc_intf,
+    name: 'libopenbmc_intf',
+    version: meson.project_version(),
+    requires: [gio_unix_dep, glib_dep],
+    description: '[deprecated] OpenBMC interface library from skeleton',
+)
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..e5814ff
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,20 @@
+project(
+    'skeleton',
+    'c',
+    version: '1.0',
+    default_options: [
+        'buildtype=debugoptimized',
+        'warning_level=2',
+        'werror=true',
+    ],
+)
+
+cjson_dep = dependency('libcjson', fallback: 'cjson')
+gio_unix_dep = dependency('gio-unix-2.0')
+glib_dep = dependency('glib-2.0')
+libsystemd_dep = dependency('libsystemd')
+
+subdir('libopenbmc_intf')
+
+subdir('op-pwrctl')
+subdir('op-hostctl')
diff --git a/op-hostctl/meson.build b/op-hostctl/meson.build
new file mode 100644
index 0000000..de6577e
--- /dev/null
+++ b/op-hostctl/meson.build
@@ -0,0 +1,8 @@
+executable(
+    'control_host.exe',
+    'control_host_obj.c',
+    include_directories: libopenbmc_intf_includes,
+    link_with: libopenbmc_intf,
+    dependencies: [gio_unix_dep, glib_dep],
+    install: true,
+)
diff --git a/op-pwrctl/meson.build b/op-pwrctl/meson.build
new file mode 100644
index 0000000..2e52bc0
--- /dev/null
+++ b/op-pwrctl/meson.build
@@ -0,0 +1,10 @@
+executable(
+    'power_control.exe',
+    'power_control_obj.c',
+    include_directories: libopenbmc_intf_includes,
+    link_with: libopenbmc_intf,
+    dependencies: [gio_unix_dep, glib_dep],
+    install: true,
+)
+
+subdir('pgood_wait')
diff --git a/op-pwrctl/pgood_wait/meson.build b/op-pwrctl/pgood_wait/meson.build
new file mode 100644
index 0000000..d59253d
--- /dev/null
+++ b/op-pwrctl/pgood_wait/meson.build
@@ -0,0 +1,6 @@
+executable(
+    'pgood_wait',
+    'pgood_wait.c',
+    dependencies: [libsystemd_dep],
+    install: true,
+)
diff --git a/subprojects/cjson.wrap b/subprojects/cjson.wrap
new file mode 100644
index 0000000..a2c6201
--- /dev/null
+++ b/subprojects/cjson.wrap
@@ -0,0 +1,14 @@
+[wrap-file]
+directory = cJSON-1.7.18
+source_url = https://github.com/DaveGamble/cJSON/archive/refs/tags/v1.7.18.tar.gz
+source_filename = v1.7.18.tar.gz
+source_hash = 3aa806844a03442c00769b83e99970be70fbef03735ff898f4811dd03b9f5ee5
+patch_filename = cjson_1.7.18-1_patch.zip
+patch_url = https://wrapdb.mesonbuild.com/v2/cjson_1.7.18-1/get_patch
+patch_hash = a1068a4cc0b49f8bcbb6a841e7105f15a9a80a05449b842407561cf9f21e5101
+source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/cjson_1.7.18-1/v1.7.18.tar.gz
+wrapdb_version = 1.7.18-1
+
+[provide]
+libcjson = libcjson_dep
+libcjson_utils = libcjson_utils_dep