From 7a70942e6714d7f456d7fd73ed44f4429e77194f Mon Sep 17 00:00:00 2001 From: "Dirk-Jan C. Binnema" Date: Fri, 12 Feb 2021 00:49:35 +0200 Subject: [PATCH] build: experimental support for the meson build system --- NEWS.org | 2 + guile/compile-scm.in | 22 ++++++ guile/meson.build | 69 ++++++++++++++++ lib/index/meson.build | 36 +++++++++ lib/meson.build | 163 ++++++++++++++++++++++++++++++++++++++ lib/utils/meson.build | 92 ++++++++++++++++++++++ man/meson.build | 35 +++++++++ meson.build | 177 ++++++++++++++++++++++++++++++++++++++++++ meson_options.txt | 31 ++++++++ mu/meson.build | 74 ++++++++++++++++++ mu4e/meson.build | 79 +++++++++++++++++++ 11 files changed, 780 insertions(+) create mode 100644 guile/compile-scm.in create mode 100644 guile/meson.build create mode 100644 lib/index/meson.build create mode 100644 lib/meson.build create mode 100644 lib/utils/meson.build create mode 100644 man/meson.build create mode 100644 meson.build create mode 100644 meson_options.txt create mode 100644 mu/meson.build create mode 100644 mu4e/meson.build diff --git a/NEWS.org b/NEWS.org index ec6b7b23..d2771a15 100644 --- a/NEWS.org +++ b/NEWS.org @@ -35,6 +35,8 @@ goal, is also faster (e.g. the threading seems to be roughly twice as fast) + - Experimental support for the Meson build system. + *** mu4e - Include maildir-shortcuts in the main-view with overall/unread counts, diff --git a/guile/compile-scm.in b/guile/compile-scm.in new file mode 100644 index 00000000..04cc0f99 --- /dev/null +++ b/guile/compile-scm.in @@ -0,0 +1,22 @@ +#!/bin/sh +## Copyright (C) 2021 Dirk-Jan C. Binnema +## +## This program is free software; you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 3 of the License, or +## (at your option) any later version. +## +## This program is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with this program; if not, write to the Free Software Foundation, +## Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +@abs_builddir@/build-env @guild@ compile "$@" + +# Local-Variables: +# mode: sh +# End: diff --git a/guile/meson.build b/guile/meson.build new file mode 100644 index 00000000..f333d47c --- /dev/null +++ b/guile/meson.build @@ -0,0 +1,69 @@ +## Copyright (C) 2021 Dirk-Jan C. Binnema +## +## This program is free software; you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 3 of the License, or +## (at your option) any later version. +## +## This program is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with this program; if not, write to the Free Software Foundation, +## Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +# +# create a shell script for compiling from the source dirs +compile_scm_conf = configuration_data() +compile_scm_conf.set('abs_builddir', meson.current_build_dir()) +compile_scm_conf.set('guild', 'guild') +compile_scm=configure_file( + input: 'compile-scm.in', + output: 'compile-scm', + configuration: compile_scm_conf, + install: false +) +run_command('chmod', '+x', compile_scm) +scm_compiler=join_paths(meson.current_build_dir(), 'compile-scm') + +snarf = find_program('guile-snarf') +snarf_args=['-o', '@OUTPUT@', '@INPUT@', '-I' + meson.current_source_dir() + '/..', + '-I' + meson.current_source_dir() + '/../lib'] + +pkg_config=find_program('pkg-config') +snarf_args+=run_command(pkg_config, '--cflags', 'glib-2.0', 'guile-3.0').stdout().strip() +message(snarf_args) +snarf_gen=generator(snarf, + output: '@BASENAME@.x', + arguments: snarf_args) + +snarf_srcs=['mu-guile.cc', 'mu-guile-message.cc'] +snarf_x=snarf_gen.process(snarf_srcs) + +lib_guile_mu = shared_module( + 'guile-mu', + [ 'mu-guile.cc', + 'mu-guile.hh', + 'mu-guile-message.cc', + 'mu-guile-message.hh', + snarf_x ], + dependencies: [guile_dep, glib_dep, lib_mu_dep, config_h_dep, thread_dep ], + install: true) + + +if makeinfo.found() + custom_target('mu_guile_info', + input: 'mu-guile.texi', + output: 'mu-guile.info', + install: true, + install_dir: infodir, + command: [makeinfo, + '-o', join_paths(meson.current_build_dir(), 'mu-guile.info'), + join_paths(meson.current_source_dir(), 'mu-guile.texi')]) +endif + +guile_scm_dir=join_paths(datadir, 'guile', 'site', '3.0', 'mu') +install_data(['mu.scm','mu/script.scm', 'mu/message.scm', 'mu/stats.scm', 'mu/plot.scm'], + install_dir: guile_scm_dir) diff --git a/lib/index/meson.build b/lib/index/meson.build new file mode 100644 index 00000000..01c90b13 --- /dev/null +++ b/lib/index/meson.build @@ -0,0 +1,36 @@ +## Copyright (C) 2021 Dirk-Jan C. Binnema +## +## This program is free software; you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 3 of the License, or +## (at your option) any later version. +## +## This program is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with this program; if not, write to the Free Software Foundation, +## Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +index_srcs=[ + 'mu-indexer.hh', + 'mu-indexer.cc', + 'mu-scanner.hh', + 'mu-scanner.cc' +] + +lib_mu_index_inc_dep = declare_dependency( + include_directories: include_directories(['.', '..'])) +lib_mu_index=static_library('mu-index', [index_srcs], + dependencies: [ + config_h_dep, + glib_dep, + lib_mu_index_inc_dep + ], + install: false) + +lib_mu_index_dep = declare_dependency( + link_with: lib_mu_index +) diff --git a/lib/meson.build b/lib/meson.build new file mode 100644 index 00000000..dfb0eead --- /dev/null +++ b/lib/meson.build @@ -0,0 +1,163 @@ +## Copyright (C) 2021 Dirk-Jan C. Binnema +## +## This program is free software; you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 3 of the License, or +## (at your option) any later version. +## +## This program is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with this program; if not, write to the Free Software Foundation, +## Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + +subdir('utils') +subdir('index') + +lib_mu=static_library( + 'mu', + [ + 'mu-bookmarks.cc', + 'mu-bookmarks.hh', + 'mu-contacts.cc', + 'mu-contacts.hh', + 'mu-data.hh', + 'mu-parser.cc', + 'mu-parser.hh', + 'mu-query.cc', + 'mu-query.hh', + 'mu-query-results.hh', + 'mu-query-match-deciders.cc', + 'mu-query-match-deciders.hh', + 'mu-query-threads.cc', + 'mu-query-threads.hh', + 'mu-runtime.cc', + 'mu-runtime.hh', + 'mu-script.cc', + 'mu-script.hh', + 'mu-server.cc', + 'mu-server.hh', + 'mu-store.cc', + 'mu-store.hh', + 'mu-tokenizer.cc', + 'mu-tokenizer.hh', + 'mu-tree.hh', + 'mu-xapian.cc', + 'mu-xapian.hh', + 'mu-maildir.cc', + 'mu-maildir.hh', + 'mu-flags.cc', + 'mu-flags.hh', + 'mu-msg-crypto.cc', + 'mu-msg-doc.cc', + 'mu-msg-doc.hh', + 'mu-msg-fields.c', + 'mu-msg-fields.h', + 'mu-msg-file.cc', + 'mu-msg-file.hh', + 'mu-msg-part.cc', + 'mu-msg-part.hh', + 'mu-msg-prio.c', + 'mu-msg-prio.h', + 'mu-msg-priv.hh', + 'mu-msg-sexp.cc', + 'mu-msg.cc', + 'mu-msg.hh' + ], + dependencies: [ + glib_dep, + gio_dep, + gmime_dep, + xapian_dep, + config_h_dep, + lib_mu_utils_dep, + lib_mu_index_dep + ], + install: false) + +lib_mu_dep = declare_dependency( + link_with: lib_mu, + include_directories: include_directories(['.', '..']) +) + + +# +# tests +# +lib_test_mu_common_inc_dep = declare_dependency( + include_directories: include_directories(['.', '..'])) +lib_test_mu_common=static_library('mu-test-common', [ + 'test-mu-common.cc', + 'test-mu-common.hh'], + dependencies: [ glib_dep, thread_dep, + lib_test_mu_common_inc_dep]) +lib_test_mu_common_dep=declare_dependency( + link_with: lib_test_mu_common, + include_directories: include_directories(['.'])) + + +testmaildir=join_paths(meson.current_source_dir(),'.') + +test('test_maildir', + executable('test-maildir', + 'test-mu-maildir.cc', + install: false, + dependencies: [glib_dep, lib_mu_dep, lib_test_mu_common_dep])) +test('test_msg_fields', + executable('test-msg-fields', + 'test-mu-msg-fields.cc', + install: false, + dependencies: [glib_dep, lib_mu_dep, lib_test_mu_common_dep])) +test('test_msg', + executable('test-msg', + 'test-mu-msg.cc', + install: false, + dependencies: [glib_dep, lib_mu_dep, lib_test_mu_common_dep], + cpp_args:['-DMU_TESTMAILDIR2="'+ join_paths(testmaildir, 'testdir2') + '"', + '-DMU_TESTMAILDIR4="'+ join_paths(testmaildir, 'testdir4') + '"' ])) +test('test_store', + executable('test-store', + 'test-mu-store.cc', + install: false, + dependencies: [glib_dep, lib_mu_dep, lib_test_mu_common_dep], + cpp_args:['-DMU_TESTMAILDIR="'+ join_paths(testmaildir, 'testdir') + '"', + '-DMU_TESTMAILDIR2="'+ join_paths(testmaildir, 'testdir2') + '"', + '-DMU_TESTMAILDIR4="'+ join_paths(testmaildir, 'testdir4') + '"'])) +test('test_query', + executable('test-query', + 'test-query.cc', + install: false, + dependencies: [glib_dep, lib_mu_dep, lib_test_mu_common_dep], + cpp_args:['-DMU_TESTMAILDIR="'+ join_paths(testmaildir, 'testdir') + '"'])) +test('test_flags', + executable('test-flags', + 'test-mu-flags.cc', + install: false, + dependencies: [glib_dep, lib_mu_dep, lib_test_mu_common_dep])) + +test('test_tokenizer', + executable('test-tokenizer', + 'test-tokenizer.cc', + install: false, + dependencies: [glib_dep, lib_mu_dep, lib_test_mu_common_dep])) +test('test_threads', + executable('test-threads', + 'mu-query-threads.cc', + install: false, + cpp_args: ['-DBUILD_TESTS'], + dependencies: [glib_dep, lib_mu_dep, lib_test_mu_common_dep])) +test('test_contacts', + executable('test-contacts', + 'mu-contacts.cc', + install: false, + cpp_args: ['-DBUILD_TESTS'], + dependencies: [glib_dep, lib_mu_dep, lib_test_mu_common_dep])) +test('test_parser', + executable('test-parser', + 'test-parser.cc', + install: false, + dependencies: [glib_dep, lib_mu_dep, lib_test_mu_common_dep])) diff --git a/lib/utils/meson.build b/lib/utils/meson.build new file mode 100644 index 00000000..eb40ff39 --- /dev/null +++ b/lib/utils/meson.build @@ -0,0 +1,92 @@ +## Copyright (C) 2021 Dirk-Jan C. Binnema +## +## This program is free software; you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 3 of the License, or +## (at your option) any later version. +## +## This program is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with this program; if not, write to the Free Software Foundation, +## Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + +lib_mu_utils=static_library('mu-utils', [ + 'mu-async-queue.hh', + 'mu-command-parser.cc', + 'mu-command-parser.hh', + 'mu-date.c', + 'mu-date.h', + 'mu-error.hh', + 'mu-logger.cc', + 'mu-logger.hh', + 'mu-option.hh', + 'mu-readline.cc', + 'mu-readline.hh', + 'mu-result.hh', + 'mu-sexp.cc', + 'mu-sexp.hh', + 'mu-str.c', + 'mu-str.h', + 'mu-util.c', + 'mu-util.h', + 'mu-utils.cc', + 'mu-utils.hh', + # third party + 'optional.hpp', + 'expected.hpp'], + dependencies: [ + glib_dep, + config_h_dep, + readline_dep + ], + include_directories: include_directories(['.','..']), + install: false) + +lib_mu_utils_dep = declare_dependency( + link_with: lib_mu_utils, + include_directories: include_directories(['.', '..']) +) + + +################################################################################ +# tests +# +testmaildir=join_paths(meson.current_source_dir(),'..') + +test('test_command_parser', + executable('test-command-parser', + 'test-command-parser.cc', + install: false, + dependencies: [glib_dep, lib_mu_utils_dep])) +test('test_mu_str', + executable('test-mu-str', + 'test-mu-str.c', + install: false, + dependencies: [glib_dep, config_h_dep,lib_mu_utils_dep])) +test('test_mu_util', + executable('test-mu-util', + 'test-mu-util.c', + install: false, + dependencies: [glib_dep,config_h_dep, lib_mu_utils_dep], + c_args: ['-DMU_TESTMAILDIR="' + join_paths(testmaildir, 'testdir') + '"', + '-DMU_TESTMAILDIR2="' + join_paths(testmaildir, 'testdir2') + '"'])) +test('test_option', + executable('test-option', + 'test-option.cc', + install: false, + dependencies: [glib_dep, lib_mu_utils_dep])) +test('test_mu_utils', + executable('test-mu-utils', + 'test-utils.cc', + install: false, + dependencies: [glib_dep, lib_mu_utils_dep])) +test('test_sexp', + executable('test-sexp', + 'test-sexp.cc', + install: false, + dependencies: [glib_dep, lib_mu_utils_dep] )) diff --git a/man/meson.build b/man/meson.build new file mode 100644 index 00000000..4d7075e8 --- /dev/null +++ b/man/meson.build @@ -0,0 +1,35 @@ +## Copyright (C) 2021 Dirk-Jan C. Binnema +## +## This program is free software; you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 3 of the License, or +## (at your option) any later version. +## +## This program is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with this program; if not, write to the Free Software Foundation, +## Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +install_man( + ['mu.1', + 'mu-add.1', + 'mu-bookmarks.5', + 'mu-cfind.1', + 'mu-easy.1', + 'mu-extract.1', + 'mu-find.1', + 'mu-help.1', + 'mu-index.1', + 'mu-info.1', + 'mu-init.1', + 'mu-mkdir.1', + 'mu-query.7', + 'mu-remove.1', + 'mu-script.1', + 'mu-server.1', + 'mu-verify.1', + 'mu-view.1']) diff --git a/meson.build b/meson.build new file mode 100644 index 00000000..d9801024 --- /dev/null +++ b/meson.build @@ -0,0 +1,177 @@ +## Copyright (C) 2021 Dirk-Jan C. Binnema +## +## This program is free software; you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 3 of the License, or +## (at your option) any later version. +## +## This program is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with this program; if not, write to the Free Software Foundation, +## Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +################################################################################ +# project setup +# +project('mu', ['c', 'cpp'], + version: '1.5.8', + meson_version: '>= 0.52.0', # debian 10 + license: 'GPL-3.0-or-later', + default_options : [ + 'buildtype=debugoptimized', + 'warning_level=1', + 'c_std=c11', + 'cpp_std=c++14' + ] + ) + +# installation paths +prefixdir = get_option('prefix') +bindir = join_paths(prefixdir, get_option('bindir')) +datadir = join_paths(prefixdir, get_option('datadir')) +mandir = join_paths(prefixdir, get_option('mandir')) +infodir = join_paths(prefixdir, get_option('infodir')) + +################################################################################ + + +################################################################################ +# compilers / flags +# +extra_flags = [ + '-Wundef', + '-Wwrite-strings', + '-Wformat', + '-Wformat-nonliteral', + '-Wformat-security', + '-Winit-self', + '-Wmissing-include-dirs', + '-Wpointer-arith', + #'-Wswitch-enum', + '-Wswitch-default', +] + +# compilers +cc = meson.get_compiler('c') +cxx= meson.get_compiler('cpp') + +# extra arguments, if available +foreach extra_arg : extra_flags + if cc.has_argument (extra_arg) + add_project_arguments([extra_arg], language: 'c') + endif + if cxx.has_argument (extra_arg) + add_project_arguments([extra_arg], language: 'cpp') + endif + +endforeach +################################################################################ + + + +################################################################################ +# config.h setup +# +config_h_data=configuration_data() +config_h_data.set_quoted('MU_STORE_SCHEMA_VERSION', '451') +config_h_data.set_quoted('PACKAGE_VERSION', meson.project_version()) +config_h_data.set_quoted('PACKAGE_STRING', meson.project_name() + ' ' + meson.project_version()) +config_h_data.set_quoted('VERSION', meson.project_version()) +config_h_data.set_quoted('PACKAGE_NAME', meson.project_name()) + +functions=[ + 'setsid' +] +foreach f : functions + if cc.has_function(f) + define = 'HAVE_' + f.underscorify().to_upper() + config_h_data.set(define, 1) + endif +endforeach +################################################################################ + + + +################################################################################ +# hard dependencies +# +glib_dep = dependency('glib-2.0', version: '>= 2.50') +gobject_dep = dependency('gobject-2.0', version: '>= 2.50') +gio_dep = dependency('gio-2.0', version: '>= 2.50') +gmime_dep = dependency('gmime-3.0', version: '>= 3.2') +xapian_dep = dependency('xapian-core', version:'>= 1.4') +thread_dep = dependency('threads') + +awk=find_program(['gawk', 'awk']) + +# soft dependencies + +# emacs -- needed for mu4e compilation +emacs=find_program(['emacs'], version: '>=25.3', required:false) +if not emacs.found() + message('emacs not found; not pre-compiling mu4e sources') +endif + +makeinfo=find_program(['makeinfo'], required:false) +if not makeinfo.found() + message('makeinfo (texinfo) not found; not building info documentation') +endif + +# readline. annoyingly, macos has incompatible libedit claiming to be readline. +# this only a dev/debug convenience for the mu4e repl. +readline_dep=[] +if get_option('readline').enabled() + readline_dep = dependency('readline', version:'>= 8.0') + config_h_data.set('HAVE_LIBREADLINE', 1) + config_h_data.set('HAVE_READLINE_READLINE_H', 1) + config_h_data.set('HAVE_READLINE_HISTORY', 1) + config_h_data.set('HAVE_READLINE_HISTORY_H', 1) +endif + +# guile +guile_deps=[] +if get_option('guile').enabled() + guile_dep = dependency('guile-3.0') +endif + +# toys. +gtk_dep=[] +webkit_dep=[] +if get_option('toys').enabled() + gtk_dep = dependency('gtk+-3.0') + webkit_dep = dependency('webkit2gtk-4.0') +endif +################################################################################ + + +################################################################################ +# write-out config. h. +configure_file(output : 'config.h', configuration : config_h_data) +add_project_arguments(['-DHAVE_CONFIG_H'], language: 'c') +add_project_arguments(['-DHAVE_CONFIG_H'], language: 'cpp') +config_h_dep=declare_dependency( + include_directories: include_directories(['.'])) +################################################################################ + +################################################################################ +# subdirs +subdir('lib') +subdir('mu') +subdir('man') + +if emacs.found() + subdir('mu4e') +endif + +if get_option('guile').enabled() + subdir('guile') +endif + +if get_option('toys').enabled() + subdir('toys/mug') +endif +################################################################################ diff --git a/meson_options.txt b/meson_options.txt new file mode 100644 index 00000000..0c70826e --- /dev/null +++ b/meson_options.txt @@ -0,0 +1,31 @@ +## Copyright (C) 2021 Dirk-Jan C. Binnema +## +## This program is free software; you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 3 of the License, or +## (at your option) any later version. +## +## This program is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with this program; if not, write to the Free Software Foundation, +## Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + +option('guile', + type : 'feature', + value: 'auto', + description: 'build the guile scripting support (requires guile-3.x)') + +option('toys', + type : 'feature', + value: 'auto', + description: 'build various toy programs (requires gtk3/gtk-webkit)') + +option('readline', + type: 'feature', + value: 'auto', + description: 'enable readline support for the mu4e repl') diff --git a/mu/meson.build b/mu/meson.build new file mode 100644 index 00000000..352536a1 --- /dev/null +++ b/mu/meson.build @@ -0,0 +1,74 @@ +## Copyright (C) 2021 Dirk-Jan C. Binnema +## +## This program is free software; you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 3 of the License, or +## (at your option) any later version. +## +## This program is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with this program; if not, write to the Free Software Foundation, +## Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + +awk_script=join_paths(meson.current_source_dir(), 'mu-help-strings.awk') +mu_help_strings_h=custom_target('mu_help', + input: 'mu-help-strings.txt', + output: 'mu-help-strings.h', + command: [awk, '-f', awk_script, '@INPUT@'], + capture: true) +mu = executable( + 'mu', [ + 'mu.cc', + 'mu-cmd-cfind.cc', + 'mu-cmd-extract.cc', + 'mu-cmd-find.cc', + 'mu-cmd-index.cc', + 'mu-cmd-script.cc', + 'mu-cmd-server.cc', + 'mu-cmd.cc', + 'mu-cmd.hh', + 'mu-config.cc', + 'mu-config.hh', + mu_help_strings_h +], + dependencies: [ glib_dep, lib_mu_dep, thread_dep, config_h_dep ], + cpp_args: ['-DMU_SCRIPTS_DIR="'+ join_paths(datadir, 'mu', 'scripts') + '"'], + install: true) + +# +# tests +# + +mu_binary = mu.full_path() +testmaildir=join_paths(meson.current_source_dir(),'../lib') + +test('test_cmd', + executable('test-cmd', + 'test-mu-cmd.cc', + install: false, + cpp_args: ['-DMU_PROGRAM="' + mu_binary + '"', + '-DMU_TESTMAILDIR2="'+ join_paths(testmaildir, 'testdir2') + '"', + '-DMU_TESTMAILDIR4="'+ join_paths(testmaildir, 'testdir4') + '"'], + dependencies: [glib_dep, lib_test_mu_common_dep, config_h_dep, lib_mu_dep])) +test('test_cmd_cfind', + executable('test-cmd-cfind', + 'test-mu-cmd-cfind.cc', + install: false, + cpp_args: ['-DMU_PROGRAM="' + mu_binary + '"', + '-DMU_TESTMAILDIR="'+ join_paths(testmaildir, 'testdir') + '"', + ], + dependencies: [glib_dep, lib_test_mu_common_dep, config_h_dep])) +test('test_cmd_query', + executable('test-cmd-query', + 'test-mu-query.cc', + install: false, + cpp_args: ['-DMU_PROGRAM="' + mu_binary + '"', + '-DMU_TESTMAILDIR="'+ join_paths(testmaildir, 'testdir') + '"', + '-DMU_TESTMAILDIR2="'+ join_paths(testmaildir, 'testdir2') + '"' + ], + dependencies: [glib_dep, lib_test_mu_common_dep, config_h_dep, lib_mu_dep])) diff --git a/mu4e/meson.build b/mu4e/meson.build new file mode 100644 index 00000000..600fc5bc --- /dev/null +++ b/mu4e/meson.build @@ -0,0 +1,79 @@ +## Copyright (C) 2021 Dirk-Jan C. Binnema +## +## This program is free software; you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 3 of the License, or +## (at your option) any later version. +## +## This program is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with this program; if not, write to the Free Software Foundation, +## Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + +mu4e_meta = configure_file( + input: 'mu4e-meta.el.in', + output: 'mu4e-meta.el', + configuration: + { + 'VERSION' : meson.project_version(), + # project_build_root() with meson >= 0.56 + 'abs_top_builddir': join_paths(meson.build_root()), + 'MU_DOC_DIR' : join_paths(datadir, 'doc', 'mu') + }) + + +mu4e_srcs=[ + 'mu4e-actions.el', + 'mu4e-compose.el', + 'mu4e-context.el', + 'mu4e-contrib.el', + 'mu4e-draft.el', + 'mu4e.el', + 'mu4e-headers.el', + 'mu4e-icalendar.el', + 'mu4e-lists.el', + 'mu4e-main.el', + 'mu4e-mark.el', + 'mu4e-message.el', + join_paths(meson.current_build_dir(), 'mu4e-meta.el'), + 'mu4e-org.el', + 'mu4e-proc.el', + 'mu4e-speedbar.el', + 'mu4e-utils.el', + 'mu4e-vars.el', + 'mu4e-view.el', + 'org-mu4e.el', +] + +foreach src : mu4e_srcs + target_name= '@BASENAME@.elc' + target_path = join_paths(meson.current_build_dir(), target_name) + target_func = '(setq byte-compile-dest-file-function(lambda(_) "' + target_path + '"))' + custom_target(src.underscorify() + '_el', + build_by_default: true, + input: src, + output: target_name, + command: [emacs, + '--no-init-file', + '--batch', + '--eval', target_func, + '--directory', meson.current_source_dir(), + '--funcall', 'batch-byte-compile', '@INPUT@']) +endforeach + + +if makeinfo.found() + custom_target('mu4e_info', + input: 'mu4e.texi', + output: 'mu4e.info', + install_dir: infodir, + install: true, + command: [makeinfo, + '-o', join_paths(meson.current_build_dir(), 'mu4e.info'), + join_paths(meson.current_source_dir(), 'mu4e.texi')]) +endif