[dia: 1/105] #19: Initial attempt at a meson.build.



commit 62ee2ad49d7bf93c8ba260bba441b6dad1145a62
Author: Eduard Nicodei <eddnicodei gmail com>
Date:   Sun Dec 16 00:59:45 2018 +0000

    #19: Initial attempt at a meson.build.
    
      - Add a helper script to append git sha to version.

 meson-helpers/get-git-sha.sh | 12 ++++++++++++
 meson.build                  | 43 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 55 insertions(+)
---
diff --git a/meson-helpers/get-git-sha.sh b/meson-helpers/get-git-sha.sh
new file mode 100755
index 00000000..02c24fc3
--- /dev/null
+++ b/meson-helpers/get-git-sha.sh
@@ -0,0 +1,12 @@
+#!/usr/bin/env sh
+
+# If git is installed and we are in a .git folder, print the current SHA.
+# Otherwise, print nothing.
+
+#TODO 1: check that this runs in a non-git folder
+#TODO 2: check that this runs on a machine without git installed
+
+# Need to ensure nothing is output.
+cd $MESON_SOURCE_ROOT 2>&1 > /dev/null
+command -v git > /dev/null && git rev-parse --short=10 HEAD 2>/dev/null || echo ""
+
diff --git a/meson.build b/meson.build
new file mode 100644
index 00000000..edc314b2
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,43 @@
+project('dia',
+        ['c', 'cpp'],
+        version : '0.97.3+git' +
+            run_command(find_program('meson-helpers/get-git-sha.sh')).stdout().strip(),
+        meson_version : '>= 0.45',
+        default_options : []
+)
+
+# TODO
+#AC_PROG_INSTALL
+#AC_PROG_LN_S
+#AC_PROG_MAKE_SET
+#AC_ISC_POSIX
+cc = meson.get_compiler('c')
+
+#AC_HEADER_STDC
+#TODO: do w eneed to check for this?
+#AC_CHECK_HEADERS(stddef.h fcntl.h unistd.h utime.h)
+check_headers = ['stddef.h', 'fcntl.h', 'unistd.h', 'utime.h']
+
+foreach h : check_headers
+    #TODO: documentation we should use dependency instead of has_header.
+    assert(cc.has_header(h), h + ' required')
+endforeach
+
+#TODO: do we need to check for this?
+#AC_C_CONST
+#AC_CHECK_FUNCS(select strcspn strdup strtol)
+check_funcs = ['select', 'strcspn', 'strdup', 'strtol']
+foreach f : check_funcs
+    assert(cc.has_function(f), f + ' is required')
+endforeach
+
+# Specify a header configuration file
+conf = configuration_data()
+
+prefix = get_option('prefix')
+conf.set_quoted('VERSION', meson.project_version())
+
+configure_file(output : 'config.h',
+               configuration : conf)
+
+


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]