summaryrefslogtreecommitdiff
path: root/guile/meson.build
blob: 1da0d38f3214d077329d4328128e675ca1e43113 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
## Copyright (C) 2022 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
##
## 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, check: true)
scm_compiler=join_paths(meson.current_build_dir(), 'compile-scm')

#
# NOTE: snarfing works but you get:
# ,----
# | cc1plus: warning: command-line option ‘-std=gnu11’ is valid for C/ObjC
# | but not for C++
# `----
# this is because the snarf-script hardcodes the '-std=gnu11' but we're
# building for c++; even worse, e.g. on some MacOS, the warning is a
# hard error.
#
# We can override flag through a env variable CPP; but then we _also_ need to
# override the compiler, so e.g. CPP="g++ -std=c++17'; but it's a bit
# hairy/ugly/fragile to derive the raw compiler name in meson; also the
# generator expression doesn't take an 'env:' parameter, so we'd need
# to rewrite using custom_target...
#
# for now, we avoid all that by simply including the generated files.
do_snarf=false

if do_snarf
  snarf = find_program('guile-snarf3.0','guile-snarf')
  # there must be a better way of feeding the include paths to snarf...
  snarf_args=['-o', '@OUTPUT@', '@INPUT@', '-I' + meson.current_source_dir() + '/..',
	      '-I' + meson.current_source_dir() + '/../lib',
	      '-I' + meson.current_build_dir() + '/..']
  snarf_args += '-I' + join_paths(glib_dep.get_pkgconfig_variable('includedir'),
                                  'glib-2.0')
  snarf_args += '-I' + join_paths(glib_dep.get_pkgconfig_variable('libdir'),
                                  'glib-2.0', 'include')
  snarf_args += '-I' + join_paths(guile_dep.get_pkgconfig_variable('includedir'),
                                  'guile', '3.0')
  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)
else
  snarf_x = [ 'mu-guile-message.x', 'mu-guile.x' ]
endif

lib_guile_mu = shared_module(
  'guile-mu',
  [ 'mu-guile.cc',
    'mu-guile-message.cc' ],
  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'),
			  '-I', join_paths(meson.current_build_dir(), '..')])

  if install_info.found()
    meson.add_install_script(install_info_script, 'share/info', 'mu-guile.info')
  endif

  
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)

guile_builddir=meson.current_build_dir()

subdir('tests')