[RFC PATCH] build: Add meson.build for Ruby bindings

Thomas Schneider qsx at chaotikum.eu
Mon Feb 17 03:10:19 PST 2020


It seems to work so far and doesn’t depend on Ruby’s MakeMakefile, as
the current Makefile does.  However, there is currently no way to
configure a certain Ruby version to build against (the first one that
works is used).

Given that the Ruby bindings themselves are a bit unmaintained, it might
make sense to rewrite them altogether in Ruby using ffi[0].

[0]: https://github.com/ffi/ffi

---
 bindings/ruby/meson.build | 21 +++++++++++++++++++++
 meson.build               |  8 ++++++++
 2 files changed, 29 insertions(+)
 create mode 100644 bindings/ruby/meson.build

diff --git a/bindings/ruby/meson.build b/bindings/ruby/meson.build
new file mode 100644
index 00000000..1b482107
--- /dev/null
+++ b/bindings/ruby/meson.build
@@ -0,0 +1,21 @@
+libnotmuch_ruby_srcs = [
+  'database.c',
+  'directory.c',
+  'filenames.c',
+  'init.c',
+  'message.c',
+  'messages.c',
+  'query.c',
+  'status.c',
+  'tags.c',
+  'thread.c',
+  'threads.c',
+]
+
+lib_notmuch_ruby = library('notmuch', libnotmuch_ruby_srcs,
+			   include_directories: [inc_compat,
+						 inc_lib],
+			   link_with: [lib_notmuch],
+			   dependencies: [dep_ruby],
+			   install: true,
+			   install_dir: dep_ruby.get_pkgconfig_variable('vendorarchdir'))
diff --git a/meson.build b/meson.build
index 6a924a68..0cf3dd68 100644
--- a/meson.build
+++ b/meson.build
@@ -11,6 +11,13 @@ dep_talloc = dependency('talloc')
 dep_valgrind = dependency('valgrind', required: false)
 dep_bash_completion = dependency('bash-completion', version: '>=1.90',
 				 required: false)
+ruby_versions = ['2.7', '2.6', '2.5']
+foreach v : ruby_versions
+  dep_ruby = dependency('ruby- at 0@'.format(v))
+  if dep_ruby.found()
+    break
+  endif
+endforeach
 cmd_python = find_program('python3', 'python', 'python2')
 cmd_doxygen = find_program('doxygen', required: false)
 cmd_ruby = find_program('ruby', required: false)
@@ -29,6 +36,7 @@ subdir('compat')
 subdir('parse-time-string')
 subdir('util')
 subdir('lib')
+subdir('bindings/ruby')
 subdir('test')
 
 notmuch_client_srcs = [
-- 
2.25.0



More information about the notmuch mailing list