mirror of https://github.com/djcb/mu.git
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.
This commit is contained in:
parent
a66360eda5
commit
2bb16ca7d1
|
@ -74,21 +74,22 @@ info_TEXINFOS= \
|
||||||
mu_guile_TEXINFOS= \
|
mu_guile_TEXINFOS= \
|
||||||
fdl.texi
|
fdl.texi
|
||||||
|
|
||||||
BUILT_SOURCES=$(XFILES)
|
# we include pre-snarfed files now; see meson.build for explanation
|
||||||
|
#
|
||||||
export CPP
|
# BUILT_SOURCES=$(XFILES)
|
||||||
snarfcxxopts= $(DEFS) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
|
# export CPP
|
||||||
SUFFIXES = .x .doc
|
# snarfcxxopts= $(DEFS) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
|
||||||
.cc.x:
|
# SUFFIXES = .x .doc
|
||||||
$(AM_V_GEN) $(GUILE_SNARF) -o $@ $< $(snarfcxxopts)
|
# .cc.x:
|
||||||
|
# $(AM_V_GEN) $(GUILE_SNARF) -o $@ $< $(snarfcxxopts)
|
||||||
|
SNARF_DATA=$(XFILES)
|
||||||
|
|
||||||
# FIXME: GUILE_SITEDIR would be better, but that
|
# FIXME: GUILE_SITEDIR would be better, but that
|
||||||
# breaks 'make distcheck'
|
# breaks 'make distcheck'
|
||||||
scmdir=${prefix}/share/guile/site/${GUILE_EFFECTIVE_VERSION}
|
scmdir=${prefix}/share/guile/site/${GUILE_EFFECTIVE_VERSION}
|
||||||
scm_DATA=mu.scm
|
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.
|
## Add -MG to make the .x magic work with auto-dep code.
|
||||||
MKDEP = $(CC) -M -MG $(snarfcppopts)
|
MKDEP = $(CC) -M -MG $(snarfcppopts)
|
||||||
|
|
|
@ -28,29 +28,50 @@ compile_scm=configure_file(
|
||||||
run_command('chmod', '+x', compile_scm, check: true)
|
run_command('chmod', '+x', compile_scm, check: true)
|
||||||
scm_compiler=join_paths(meson.current_build_dir(), 'compile-scm')
|
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...
|
# NOTE: snarfing works but you get:
|
||||||
snarf_args=['-o', '@OUTPUT@', '@INPUT@', '-I' + meson.current_source_dir() + '/..',
|
# ,----
|
||||||
|
# | 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_source_dir() + '/../lib',
|
||||||
'-I' + meson.current_build_dir() + '/..']
|
'-I' + meson.current_build_dir() + '/..']
|
||||||
snarf_args += '-I' + join_paths(glib_dep.get_pkgconfig_variable('includedir'),
|
snarf_args += '-I' + join_paths(glib_dep.get_pkgconfig_variable('includedir'),
|
||||||
'glib-2.0')
|
'glib-2.0')
|
||||||
snarf_args += '-I' + join_paths(glib_dep.get_pkgconfig_variable('libdir'),
|
snarf_args += '-I' + join_paths(glib_dep.get_pkgconfig_variable('libdir'),
|
||||||
'glib-2.0', 'include')
|
'glib-2.0', 'include')
|
||||||
snarf_args += '-I' + join_paths(guile_dep.get_pkgconfig_variable('includedir'),
|
snarf_args += '-I' + join_paths(guile_dep.get_pkgconfig_variable('includedir'),
|
||||||
'guile', '3.0')
|
'guile', '3.0')
|
||||||
snarf_gen=generator(snarf,
|
snarf_gen=generator(snarf,
|
||||||
output: '@BASENAME@.x',
|
output: '@BASENAME@.x',
|
||||||
arguments: snarf_args)
|
arguments: snarf_args)
|
||||||
|
snarf_srcs=['mu-guile.cc', 'mu-guile-message.cc']
|
||||||
snarf_srcs=['mu-guile.cc', 'mu-guile-message.cc']
|
snarf_x=snarf_gen.process(snarf_srcs)
|
||||||
snarf_x=snarf_gen.process(snarf_srcs)
|
else
|
||||||
|
snarf_x = [ 'mu-guile-message.x', 'mu-guile.x' ]
|
||||||
|
endif
|
||||||
|
|
||||||
lib_guile_mu = shared_module(
|
lib_guile_mu = shared_module(
|
||||||
'guile-mu',
|
'guile-mu',
|
||||||
[ 'mu-guile.cc',
|
[ 'mu-guile.cc',
|
||||||
'mu-guile-message.cc',
|
'mu-guile-message.cc' ],
|
||||||
snarf_x ],
|
|
||||||
dependencies: [guile_dep, glib_dep, lib_mu_dep, config_h_dep, thread_dep ],
|
dependencies: [guile_dep, glib_dep, lib_mu_dep, config_h_dep, thread_dep ],
|
||||||
install: true)
|
install: true)
|
||||||
|
|
||||||
|
|
|
@ -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);;
|
|
@ -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);;
|
Loading…
Reference in New Issue