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