summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Thursfield <sam.thursfield@codethink.co.uk>2016-04-13 17:44:46 +0100
committerSam Thursfield <sam.thursfield@codethink.co.uk>2016-04-13 17:44:46 +0100
commitd93b835ac250ab10d683a67e2739b996c2ca82f7 (patch)
tree991125f084e3a3ecd1eef48d8554370fccf1b804
parent2fc7555e229cd5cdba95e58bc434de0fe37e6a3c (diff)
downloadgawk-baserock/sam/meson.tar.gz
WIP: Add Meson build rulesbaserock/sam/meson
Build fails due to lack of config.h, but it's a start.
-rw-r--r--bison-fix-messages.sh8
-rw-r--r--meson.build43
2 files changed, 51 insertions, 0 deletions
diff --git a/bison-fix-messages.sh b/bison-fix-messages.sh
new file mode 100644
index 00000000..3e8289f3
--- /dev/null
+++ b/bison-fix-messages.sh
@@ -0,0 +1,8 @@
+# Wrapper for a 'sed' command to change some strings in generated Yacc code.
+#
+# This script exists for the Meson build system because 'sed' will only output
+# to stdout; see <https://github.com/mesonbuild/meson/issues/512>.
+
+set -eu
+
+sed 's/parse error/syntax error/g' < $1 > $2
diff --git a/meson.build b/meson.build
new file mode 100644
index 00000000..3b41c304
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,43 @@
+# Meson build instructions for GAWK, the GNU implementation of the
+# AWK Programming Language.
+#
+# Distributed under the same license as GAWK.
+
+project('gawk', 'c',
+ version: '4.1.60')
+
+bison = find_program('bison')
+
+bison_generator = generator(bison,
+ output: ['@BASENAME@.tab.c', '@BASENAME@.tab.h'],
+ arguments: ['@INPUT@', '--defines=@OUTPUT1@', '--output=@OUTPUT0@', '@EXTRA_ARGS@'])
+
+# The Autotools build definitions run the output of Bison through bisonfix.awk,
+# which seems to just change the filename used in #line directives. We can
+# ignore that.
+
+awkgram = bison_generator.process('awkgram.y')
+command = bison_generator.process('command.y', extra_args: ['-p', 'zz'])
+
+awkgram_messages_fix = custom_target('awkgram.y messages fix',
+ input: 'awkgram.c',
+ output: 'awkgram.messages-fixed.c',
+ command: ['bison-fix-messages.sh', 'awkgram.c', 'awkgram.messages-fixed.c'])
+
+command_messages_fix = custom_target('command.y messages fix',
+ input: 'command.c',
+ output: 'command.messages-fixed.c',
+ command: ['bison-fix-messages.sh', 'command.c', 'command.messages-fixed.c'])
+
+# sources for both gawk and dgawk
+base_sources = [
+ 'array.c', 'awk.h', 'builtin.c', 'cint_array.c', 'cmd.h', 'custom.h',
+ 'debug.c', 'dfa.c', 'dfa.h', 'eval.c', 'ext.c',
+ 'field.c', 'floatcomp.c', 'floatmagic.h', 'gawkapi.c', 'gawkapi.h',
+ 'gawkmisc.c', 'getopt.c', 'getopt.h', 'getopt1.c', 'getopt_int.h',
+ 'gettext.h', 'int_array.c', 'interpret.h', 'io.c', 'mbsupport.h', 'main.c',
+ 'mpfr.c', 'msg.c', 'node.c', 'nonposix.h', 'profile.c', 'protos.h',
+ 'random.c', 'random.h', 're.c', 'regex.c', 'regex.h', 'replace.c',
+ 'str_array.c', 'symbol.c', 'version.c', 'xalloc.h', awkgram_messages_fix, command_messages_fix]
+
+gawk = executable('gawk', base_sources)