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