summaryrefslogtreecommitdiff
path: root/guile
diff options
context:
space:
mode:
authorDirk-Jan C. Binnema <djcb@djcbsoftware.nl>2022-06-02 19:17:37 +0300
committerDirk-Jan C. Binnema <djcb@djcbsoftware.nl>2022-06-02 21:04:30 +0300
commit2bb16ca7d129d89de22ce8658ff3a91dee77a454 (patch)
tree0261ebbe2ee4a42d322104599286b79a1f100caf /guile
parenta66360eda525830b42fb51b39c23f056f201a0d5 (diff)
guile: include pre-snarfed code
snarfing is tricky to get to work portably with c++ code. So, for now let's just include the pre-generated .x files and safe us a bit of time. They're not very prone to change anyway.
Diffstat (limited to 'guile')
-rw-r--r--guile/Makefile.am19
-rw-r--r--guile/meson.build57
-rw-r--r--guile/mu-guile-message.x6
-rw-r--r--guile/mu-guile.x4
4 files changed, 59 insertions, 27 deletions
diff --git a/guile/Makefile.am b/guile/Makefile.am
index 85b2262..b6387be 100644
--- a/guile/Makefile.am
+++ b/guile/Makefile.am
@@ -74,21 +74,22 @@ info_TEXINFOS= \
mu_guile_TEXINFOS= \
fdl.texi
-BUILT_SOURCES=$(XFILES)
-
-export CPP
-snarfcxxopts= $(DEFS) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
-SUFFIXES = .x .doc
-.cc.x:
- $(AM_V_GEN) $(GUILE_SNARF) -o $@ $< $(snarfcxxopts)
-
+# we include pre-snarfed files now; see meson.build for explanation
+#
+# BUILT_SOURCES=$(XFILES)
+# export CPP
+# snarfcxxopts= $(DEFS) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+# SUFFIXES = .x .doc
+# .cc.x:
+# $(AM_V_GEN) $(GUILE_SNARF) -o $@ $< $(snarfcxxopts)
+SNARF_DATA=$(XFILES)
# FIXME: GUILE_SITEDIR would be better, but that
# breaks 'make distcheck'
scmdir=${prefix}/share/guile/site/${GUILE_EFFECTIVE_VERSION}
scm_DATA=mu.scm
-EXTRA_DIST=$(scm_DATA)
+EXTRA_DIST=$(scm_DATA) $(SNARF_DATA)
## Add -MG to make the .x magic work with auto-dep code.
MKDEP = $(CC) -M -MG $(snarfcppopts)
diff --git a/guile/meson.build b/guile/meson.build
index 394ce15..08512a3 100644
--- a/guile/meson.build
+++ b/guile/meson.build
@@ -28,29 +28,50 @@ compile_scm=configure_file(
run_command('chmod', '+x', compile_scm, check: true)
scm_compiler=join_paths(meson.current_build_dir(), 'compile-scm')
-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)
+#
+# 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
-snarf_srcs=['mu-guile.cc', 'mu-guile-message.cc']
-snarf_x=snarf_gen.process(snarf_srcs)
+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',
- snarf_x ],
+ 'mu-guile-message.cc' ],
dependencies: [guile_dep, glib_dep, lib_mu_dep, config_h_dep, thread_dep ],
install: true)
diff --git a/guile/mu-guile-message.x b/guile/mu-guile-message.x
new file mode 100644
index 0000000..6127b39
--- /dev/null
+++ b/guile/mu-guile-message.x
@@ -0,0 +1,6 @@
+/* cpp arguments: mu-guile-message.cc -DHAVE_CONFIG_H -I. -I.. -I../lib -I/usr/local/include/guile/3.0 -pthread -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/sysprof-4 -I/usr/include/libmount -I/usr/include/blkid -pthread -fno-strict-aliasing -Wall -Wextra -Wundef -Wwrite-strings -Wpointer-arith -Wmissing-declarations -Wredundant-decls -Wno-unused-parameter -Wno-missing-field-initializers -Wformat=2 -Wcast-align -Wformat-nonliteral -Wformat-security -Wsign-compare -Wstrict-aliasing -Wshadow -Winline -Wpacked -Wmissing-format-attribute -Wmissing-noreturn -Winit-self -Wmissing-include-dirs -Wunused-but-set-variable -Warray-bounds -Wreturn-type -Wno-overloaded-virtual -Wswitch-enum -Wswitch-default -Wno-error=unused-parameter -Wno-error=missing-field-initializers -Wno-error=overloaded-virtual -Wno-redundant-decls -Wno-missing-declarations -Wno-suggest-attribute=noreturn -O2 -Wno-inline */
+scm_c_define_gsubr (s_get_field, 2, 0, 0, (scm_t_subr) get_field);;
+scm_c_define_gsubr (s_get_contacts, 2, 0, 0, (scm_t_subr) get_contacts);;
+scm_c_define_gsubr (s_get_parts, 1, 1, 0, (scm_t_subr) get_parts);;
+scm_c_define_gsubr (s_get_header, 2, 0, 0, (scm_t_subr) get_header);;
+scm_c_define_gsubr (s_for_each_message, 3, 0, 0, (scm_t_subr) for_each_message);;
diff --git a/guile/mu-guile.x b/guile/mu-guile.x
new file mode 100644
index 0000000..8aa8020
--- /dev/null
+++ b/guile/mu-guile.x
@@ -0,0 +1,4 @@
+/* cpp arguments: mu-guile.cc -DHAVE_CONFIG_H -I. -I.. -I../lib -I/usr/local/include/guile/3.0 -pthread -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/sysprof-4 -I/usr/include/libmount -I/usr/include/blkid -pthread -fno-strict-aliasing -Wall -Wextra -Wundef -Wwrite-strings -Wpointer-arith -Wmissing-declarations -Wredundant-decls -Wno-unused-parameter -Wno-missing-field-initializers -Wformat=2 -Wcast-align -Wformat-nonliteral -Wformat-security -Wsign-compare -Wstrict-aliasing -Wshadow -Winline -Wpacked -Wmissing-format-attribute -Wmissing-noreturn -Winit-self -Wmissing-include-dirs -Wunused-but-set-variable -Warray-bounds -Wreturn-type -Wno-overloaded-virtual -Wswitch-enum -Wswitch-default -Wno-error=unused-parameter -Wno-error=missing-field-initializers -Wno-error=overloaded-virtual -Wno-redundant-decls -Wno-missing-declarations -Wno-suggest-attribute=noreturn -O2 -Wno-inline */
+scm_c_define_gsubr (s_mu_initialize, 0, 1, 0, (scm_t_subr) mu_initialize); scm_c_export (s_mu_initialize, __null );;
+scm_c_define_gsubr (s_mu_initialized_p, 0, 0, 0, (scm_t_subr) mu_initialized_p); scm_c_export (s_mu_initialized_p, __null );;
+scm_c_define_gsubr (s_log_func, 1, 0, 1, (scm_t_subr) log_func);;