Skip to content

Commit 7a70942

Browse files
committed
build: experimental support for the meson build system
1 parent a3c6e74 commit 7a70942

File tree

11 files changed

+780
-0
lines changed

11 files changed

+780
-0
lines changed

NEWS.org

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@
3535
goal, is also faster (e.g. the threading seems to be roughly twice as
3636
fast)
3737

38+
- Experimental support for the Meson build system.
39+
3840
*** mu4e
3941

4042
- Include maildir-shortcuts in the main-view with overall/unread counts,

guile/compile-scm.in

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/bin/sh
2+
## Copyright (C) 2021 Dirk-Jan C. Binnema <[email protected]>
3+
##
4+
## This program is free software; you can redistribute it and/or modify
5+
## it under the terms of the GNU General Public License as published by
6+
## the Free Software Foundation; either version 3 of the License, or
7+
## (at your option) any later version.
8+
##
9+
## This program is distributed in the hope that it will be useful,
10+
## but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
## GNU General Public License for more details.
13+
##
14+
## You should have received a copy of the GNU General Public License
15+
## along with this program; if not, write to the Free Software Foundation,
16+
## Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17+
18+
@abs_builddir@/build-env @guild@ compile "$@"
19+
20+
# Local-Variables:
21+
# mode: sh
22+
# End:

guile/meson.build

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
## Copyright (C) 2021 Dirk-Jan C. Binnema <[email protected]>
2+
##
3+
## This program is free software; you can redistribute it and/or modify
4+
## it under the terms of the GNU General Public License as published by
5+
## the Free Software Foundation; either version 3 of the License, or
6+
## (at your option) any later version.
7+
##
8+
## This program is distributed in the hope that it will be useful,
9+
## but WITHOUT ANY WARRANTY; without even the implied warranty of
10+
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+
## GNU General Public License for more details.
12+
##
13+
## You should have received a copy of the GNU General Public License
14+
## along with this program; if not, write to the Free Software Foundation,
15+
## Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16+
17+
#
18+
# create a shell script for compiling from the source dirs
19+
compile_scm_conf = configuration_data()
20+
compile_scm_conf.set('abs_builddir', meson.current_build_dir())
21+
compile_scm_conf.set('guild', 'guild')
22+
compile_scm=configure_file(
23+
input: 'compile-scm.in',
24+
output: 'compile-scm',
25+
configuration: compile_scm_conf,
26+
install: false
27+
)
28+
run_command('chmod', '+x', compile_scm)
29+
scm_compiler=join_paths(meson.current_build_dir(), 'compile-scm')
30+
31+
snarf = find_program('guile-snarf')
32+
snarf_args=['-o', '@OUTPUT@', '@INPUT@', '-I' + meson.current_source_dir() + '/..',
33+
'-I' + meson.current_source_dir() + '/../lib']
34+
35+
pkg_config=find_program('pkg-config')
36+
snarf_args+=run_command(pkg_config, '--cflags', 'glib-2.0', 'guile-3.0').stdout().strip()
37+
message(snarf_args)
38+
snarf_gen=generator(snarf,
39+
output: '@[email protected]',
40+
arguments: snarf_args)
41+
42+
snarf_srcs=['mu-guile.cc', 'mu-guile-message.cc']
43+
snarf_x=snarf_gen.process(snarf_srcs)
44+
45+
lib_guile_mu = shared_module(
46+
'guile-mu',
47+
[ 'mu-guile.cc',
48+
'mu-guile.hh',
49+
'mu-guile-message.cc',
50+
'mu-guile-message.hh',
51+
snarf_x ],
52+
dependencies: [guile_dep, glib_dep, lib_mu_dep, config_h_dep, thread_dep ],
53+
install: true)
54+
55+
56+
if makeinfo.found()
57+
custom_target('mu_guile_info',
58+
input: 'mu-guile.texi',
59+
output: 'mu-guile.info',
60+
install: true,
61+
install_dir: infodir,
62+
command: [makeinfo,
63+
'-o', join_paths(meson.current_build_dir(), 'mu-guile.info'),
64+
join_paths(meson.current_source_dir(), 'mu-guile.texi')])
65+
endif
66+
67+
guile_scm_dir=join_paths(datadir, 'guile', 'site', '3.0', 'mu')
68+
install_data(['mu.scm','mu/script.scm', 'mu/message.scm', 'mu/stats.scm', 'mu/plot.scm'],
69+
install_dir: guile_scm_dir)

lib/index/meson.build

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
## Copyright (C) 2021 Dirk-Jan C. Binnema <[email protected]>
2+
##
3+
## This program is free software; you can redistribute it and/or modify
4+
## it under the terms of the GNU General Public License as published by
5+
## the Free Software Foundation; either version 3 of the License, or
6+
## (at your option) any later version.
7+
##
8+
## This program is distributed in the hope that it will be useful,
9+
## but WITHOUT ANY WARRANTY; without even the implied warranty of
10+
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+
## GNU General Public License for more details.
12+
##
13+
## You should have received a copy of the GNU General Public License
14+
## along with this program; if not, write to the Free Software Foundation,
15+
## Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16+
17+
index_srcs=[
18+
'mu-indexer.hh',
19+
'mu-indexer.cc',
20+
'mu-scanner.hh',
21+
'mu-scanner.cc'
22+
]
23+
24+
lib_mu_index_inc_dep = declare_dependency(
25+
include_directories: include_directories(['.', '..']))
26+
lib_mu_index=static_library('mu-index', [index_srcs],
27+
dependencies: [
28+
config_h_dep,
29+
glib_dep,
30+
lib_mu_index_inc_dep
31+
],
32+
install: false)
33+
34+
lib_mu_index_dep = declare_dependency(
35+
link_with: lib_mu_index
36+
)

lib/meson.build

Lines changed: 163 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,163 @@
1+
## Copyright (C) 2021 Dirk-Jan C. Binnema <[email protected]>
2+
##
3+
## This program is free software; you can redistribute it and/or modify
4+
## it under the terms of the GNU General Public License as published by
5+
## the Free Software Foundation; either version 3 of the License, or
6+
## (at your option) any later version.
7+
##
8+
## This program is distributed in the hope that it will be useful,
9+
## but WITHOUT ANY WARRANTY; without even the implied warranty of
10+
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+
## GNU General Public License for more details.
12+
##
13+
## You should have received a copy of the GNU General Public License
14+
## along with this program; if not, write to the Free Software Foundation,
15+
## Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16+
17+
18+
subdir('utils')
19+
subdir('index')
20+
21+
lib_mu=static_library(
22+
'mu',
23+
[
24+
'mu-bookmarks.cc',
25+
'mu-bookmarks.hh',
26+
'mu-contacts.cc',
27+
'mu-contacts.hh',
28+
'mu-data.hh',
29+
'mu-parser.cc',
30+
'mu-parser.hh',
31+
'mu-query.cc',
32+
'mu-query.hh',
33+
'mu-query-results.hh',
34+
'mu-query-match-deciders.cc',
35+
'mu-query-match-deciders.hh',
36+
'mu-query-threads.cc',
37+
'mu-query-threads.hh',
38+
'mu-runtime.cc',
39+
'mu-runtime.hh',
40+
'mu-script.cc',
41+
'mu-script.hh',
42+
'mu-server.cc',
43+
'mu-server.hh',
44+
'mu-store.cc',
45+
'mu-store.hh',
46+
'mu-tokenizer.cc',
47+
'mu-tokenizer.hh',
48+
'mu-tree.hh',
49+
'mu-xapian.cc',
50+
'mu-xapian.hh',
51+
'mu-maildir.cc',
52+
'mu-maildir.hh',
53+
'mu-flags.cc',
54+
'mu-flags.hh',
55+
'mu-msg-crypto.cc',
56+
'mu-msg-doc.cc',
57+
'mu-msg-doc.hh',
58+
'mu-msg-fields.c',
59+
'mu-msg-fields.h',
60+
'mu-msg-file.cc',
61+
'mu-msg-file.hh',
62+
'mu-msg-part.cc',
63+
'mu-msg-part.hh',
64+
'mu-msg-prio.c',
65+
'mu-msg-prio.h',
66+
'mu-msg-priv.hh',
67+
'mu-msg-sexp.cc',
68+
'mu-msg.cc',
69+
'mu-msg.hh'
70+
],
71+
dependencies: [
72+
glib_dep,
73+
gio_dep,
74+
gmime_dep,
75+
xapian_dep,
76+
config_h_dep,
77+
lib_mu_utils_dep,
78+
lib_mu_index_dep
79+
],
80+
install: false)
81+
82+
lib_mu_dep = declare_dependency(
83+
link_with: lib_mu,
84+
include_directories: include_directories(['.', '..'])
85+
)
86+
87+
88+
#
89+
# tests
90+
#
91+
lib_test_mu_common_inc_dep = declare_dependency(
92+
include_directories: include_directories(['.', '..']))
93+
lib_test_mu_common=static_library('mu-test-common', [
94+
'test-mu-common.cc',
95+
'test-mu-common.hh'],
96+
dependencies: [ glib_dep, thread_dep,
97+
lib_test_mu_common_inc_dep])
98+
lib_test_mu_common_dep=declare_dependency(
99+
link_with: lib_test_mu_common,
100+
include_directories: include_directories(['.']))
101+
102+
103+
testmaildir=join_paths(meson.current_source_dir(),'.')
104+
105+
test('test_maildir',
106+
executable('test-maildir',
107+
'test-mu-maildir.cc',
108+
install: false,
109+
dependencies: [glib_dep, lib_mu_dep, lib_test_mu_common_dep]))
110+
test('test_msg_fields',
111+
executable('test-msg-fields',
112+
'test-mu-msg-fields.cc',
113+
install: false,
114+
dependencies: [glib_dep, lib_mu_dep, lib_test_mu_common_dep]))
115+
test('test_msg',
116+
executable('test-msg',
117+
'test-mu-msg.cc',
118+
install: false,
119+
dependencies: [glib_dep, lib_mu_dep, lib_test_mu_common_dep],
120+
cpp_args:['-DMU_TESTMAILDIR2="'+ join_paths(testmaildir, 'testdir2') + '"',
121+
'-DMU_TESTMAILDIR4="'+ join_paths(testmaildir, 'testdir4') + '"' ]))
122+
test('test_store',
123+
executable('test-store',
124+
'test-mu-store.cc',
125+
install: false,
126+
dependencies: [glib_dep, lib_mu_dep, lib_test_mu_common_dep],
127+
cpp_args:['-DMU_TESTMAILDIR="'+ join_paths(testmaildir, 'testdir') + '"',
128+
'-DMU_TESTMAILDIR2="'+ join_paths(testmaildir, 'testdir2') + '"',
129+
'-DMU_TESTMAILDIR4="'+ join_paths(testmaildir, 'testdir4') + '"']))
130+
test('test_query',
131+
executable('test-query',
132+
'test-query.cc',
133+
install: false,
134+
dependencies: [glib_dep, lib_mu_dep, lib_test_mu_common_dep],
135+
cpp_args:['-DMU_TESTMAILDIR="'+ join_paths(testmaildir, 'testdir') + '"']))
136+
test('test_flags',
137+
executable('test-flags',
138+
'test-mu-flags.cc',
139+
install: false,
140+
dependencies: [glib_dep, lib_mu_dep, lib_test_mu_common_dep]))
141+
142+
test('test_tokenizer',
143+
executable('test-tokenizer',
144+
'test-tokenizer.cc',
145+
install: false,
146+
dependencies: [glib_dep, lib_mu_dep, lib_test_mu_common_dep]))
147+
test('test_threads',
148+
executable('test-threads',
149+
'mu-query-threads.cc',
150+
install: false,
151+
cpp_args: ['-DBUILD_TESTS'],
152+
dependencies: [glib_dep, lib_mu_dep, lib_test_mu_common_dep]))
153+
test('test_contacts',
154+
executable('test-contacts',
155+
'mu-contacts.cc',
156+
install: false,
157+
cpp_args: ['-DBUILD_TESTS'],
158+
dependencies: [glib_dep, lib_mu_dep, lib_test_mu_common_dep]))
159+
test('test_parser',
160+
executable('test-parser',
161+
'test-parser.cc',
162+
install: false,
163+
dependencies: [glib_dep, lib_mu_dep, lib_test_mu_common_dep]))

lib/utils/meson.build

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
## Copyright (C) 2021 Dirk-Jan C. Binnema <[email protected]>
2+
##
3+
## This program is free software; you can redistribute it and/or modify
4+
## it under the terms of the GNU General Public License as published by
5+
## the Free Software Foundation; either version 3 of the License, or
6+
## (at your option) any later version.
7+
##
8+
## This program is distributed in the hope that it will be useful,
9+
## but WITHOUT ANY WARRANTY; without even the implied warranty of
10+
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+
## GNU General Public License for more details.
12+
##
13+
## You should have received a copy of the GNU General Public License
14+
## along with this program; if not, write to the Free Software Foundation,
15+
## Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16+
17+
18+
lib_mu_utils=static_library('mu-utils', [
19+
'mu-async-queue.hh',
20+
'mu-command-parser.cc',
21+
'mu-command-parser.hh',
22+
'mu-date.c',
23+
'mu-date.h',
24+
'mu-error.hh',
25+
'mu-logger.cc',
26+
'mu-logger.hh',
27+
'mu-option.hh',
28+
'mu-readline.cc',
29+
'mu-readline.hh',
30+
'mu-result.hh',
31+
'mu-sexp.cc',
32+
'mu-sexp.hh',
33+
'mu-str.c',
34+
'mu-str.h',
35+
'mu-util.c',
36+
'mu-util.h',
37+
'mu-utils.cc',
38+
'mu-utils.hh',
39+
# third party
40+
'optional.hpp',
41+
'expected.hpp'],
42+
dependencies: [
43+
glib_dep,
44+
config_h_dep,
45+
readline_dep
46+
],
47+
include_directories: include_directories(['.','..']),
48+
install: false)
49+
50+
lib_mu_utils_dep = declare_dependency(
51+
link_with: lib_mu_utils,
52+
include_directories: include_directories(['.', '..'])
53+
)
54+
55+
56+
################################################################################
57+
# tests
58+
#
59+
testmaildir=join_paths(meson.current_source_dir(),'..')
60+
61+
test('test_command_parser',
62+
executable('test-command-parser',
63+
'test-command-parser.cc',
64+
install: false,
65+
dependencies: [glib_dep, lib_mu_utils_dep]))
66+
test('test_mu_str',
67+
executable('test-mu-str',
68+
'test-mu-str.c',
69+
install: false,
70+
dependencies: [glib_dep, config_h_dep,lib_mu_utils_dep]))
71+
test('test_mu_util',
72+
executable('test-mu-util',
73+
'test-mu-util.c',
74+
install: false,
75+
dependencies: [glib_dep,config_h_dep, lib_mu_utils_dep],
76+
c_args: ['-DMU_TESTMAILDIR="' + join_paths(testmaildir, 'testdir') + '"',
77+
'-DMU_TESTMAILDIR2="' + join_paths(testmaildir, 'testdir2') + '"']))
78+
test('test_option',
79+
executable('test-option',
80+
'test-option.cc',
81+
install: false,
82+
dependencies: [glib_dep, lib_mu_utils_dep]))
83+
test('test_mu_utils',
84+
executable('test-mu-utils',
85+
'test-utils.cc',
86+
install: false,
87+
dependencies: [glib_dep, lib_mu_utils_dep]))
88+
test('test_sexp',
89+
executable('test-sexp',
90+
'test-sexp.cc',
91+
install: false,
92+
dependencies: [glib_dep, lib_mu_utils_dep] ))

0 commit comments

Comments
 (0)