8dca8a
From 378d4707c26acf05e551219d8b09ddf440bdba2a Mon Sep 17 00:00:00 2001
8dca8a
From: Rosen Penev <rosenp@gmail.com>
8dca8a
Date: Fri, 10 Jun 2022 23:14:27 -0700
8dca8a
Subject: [PATCH 03/14] add meson
8dca8a
8dca8a
Simpler build system. Placing in contrib for now.
8dca8a
8dca8a
Signed-off-by: Rosen Penev <rosenp@gmail.com>
8dca8a
---
8dca8a
 contrib/README            |  2 ++
8dca8a
 contrib/meson.build       | 45 +++++++++++++++++++++++++++++++++++++++
8dca8a
 contrib/meson_options.txt | 11 ++++++++++
8dca8a
 3 files changed, 58 insertions(+)
8dca8a
 create mode 100644 contrib/README
8dca8a
 create mode 100644 contrib/meson.build
8dca8a
 create mode 100644 contrib/meson_options.txt
8dca8a
8dca8a
diff --git a/contrib/README b/contrib/README
8dca8a
new file mode 100644
8dca8a
index 0000000..2158dac
8dca8a
--- /dev/null
8dca8a
+++ b/contrib/README
8dca8a
@@ -0,0 +1,2 @@
8dca8a
+This directory contains meson build instructions for irqbalance. This is here to see if there is any interest from
8dca8a
+the general community.
8dca8a
diff --git a/contrib/meson.build b/contrib/meson.build
8dca8a
new file mode 100644
8dca8a
index 0000000..d813233
8dca8a
--- /dev/null
8dca8a
+++ b/contrib/meson.build
8dca8a
@@ -0,0 +1,45 @@
8dca8a
+project('irqbalance', 'c', version: '1.9.0', default_options: ['warning_level=1'])
8dca8a
+cc = meson.get_compiler('c')
8dca8a
+
8dca8a
+glib_dep = dependency('glib-2.0')
8dca8a
+m_dep = cc.find_library('m', required: false)
8dca8a
+capng_dep = dependency('libcap-ng', required: get_option('capng'))
8dca8a
+ncurses_dep = dependency('curses', required: get_option('ui'))
8dca8a
+systemd_dep = dependency('libsystemd', required: get_option('systemd'))
8dca8a
+
8dca8a
+cdata = configuration_data()
8dca8a
+cdata.set('HAVE_GETOPT_LONG', cc.has_function('getopt_long'))
8dca8a
+cdata.set('HAVE_IRQBALANCEUI', ncurses_dep.found())
8dca8a
+cdata.set('HAVE_NUMA_H', cc.has_header('numa.h'))
8dca8a
+cdata.set('HAVE_LIBCAP_NG', capng_dep.found())
8dca8a
+cdata.set('HAVE_LIBSYSTEMD', systemd_dep.found())
8dca8a
+cdata.set_quoted('VERSION', meson.project_version())
8dca8a
+cfile = configure_file(output: 'config.h', configuration: cdata)
8dca8a
+
8dca8a
+if cdata.get('HAVE_IRQBALANCEUI')
8dca8a
+  add_project_arguments('-D_GNU_SOURCE', language: 'c')
8dca8a
+
8dca8a
+  executable(
8dca8a
+    'irqbalance-ui',
8dca8a
+    '../ui/helpers.c',
8dca8a
+    '../ui/irqbalance-ui.c',
8dca8a
+    '../ui/ui.c',
8dca8a
+    dependencies: [glib_dep, ncurses_dep],
8dca8a
+    install: true,
8dca8a
+  )
8dca8a
+endif
8dca8a
+
8dca8a
+executable(
8dca8a
+  'irqbalance',
8dca8a
+  '../activate.c',
8dca8a
+  '../bitmap.c',
8dca8a
+  '../classify.c',
8dca8a
+  '../cputree.c',
8dca8a
+  '../irqbalance.c',
8dca8a
+  '../irqlist.c',
8dca8a
+  '../numa.c',
8dca8a
+  '../placement.c',
8dca8a
+  '../procinterrupts.c',
8dca8a
+  dependencies: [glib_dep, m_dep, capng_dep, systemd_dep],
8dca8a
+  install: true,
8dca8a
+)
8dca8a
diff --git a/contrib/meson_options.txt b/contrib/meson_options.txt
8dca8a
new file mode 100644
8dca8a
index 0000000..3515dc3
8dca8a
--- /dev/null
8dca8a
+++ b/contrib/meson_options.txt
8dca8a
@@ -0,0 +1,11 @@
8dca8a
+option('capng', type : 'feature',
8dca8a
+  description : 'Build with libcap-ng support',
8dca8a
+)
8dca8a
+
8dca8a
+option('systemd', type : 'feature',
8dca8a
+  description : 'Build with systemd support',
8dca8a
+)
8dca8a
+
8dca8a
+option('ui', type : 'feature',
8dca8a
+  description : 'Build the UI component',
8dca8a
+)
8dca8a
-- 
8dca8a
2.33.1
8dca8a