[PATCH rendercheck v3 1/4] Add a meson build system.

Eric Anholt eric at anholt.net
Wed Mar 29 20:19:32 UTC 2017


Meson allows the configure step to be run faster (.3 seconds compared to
autogen.sh's 3.9 seconds on my system) and a full rebuild (touch
rendercheck.h; make) to run faster (.05s instead of .07s).

Rendercheck is pretty much the best case scenario for autotools, with
limited configure-time autodetection, non-recursive make, and no
libtool, so it seems like an interesting test-case to start with for
meson conversion.

v2: Add missing check for err.h
v3: Add a linebreak after printing the version (by Peter),
    fix manpage variable substitution (anholt).

Signed-off-by: Eric Anholt <eric at anholt.net>
---
 .gitignore  |  1 +
 main.c      |  7 +++++++
 meson.build | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 75 insertions(+)
 create mode 100644 meson.build

diff --git a/.gitignore b/.gitignore
index 0c428075e54f..009669fbff0e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -77,3 +77,4 @@ core
 # For example, !report.pc overrides *.pc. See 'man gitignore'
 # 
 rendercheck
+version.h
diff --git a/main.c b/main.c
index 0d3d14637aaa..86346f031707 100644
--- a/main.c
+++ b/main.c
@@ -26,6 +26,9 @@
 #include <string.h>
 #include <strings.h>
 #include <getopt.h>
+#ifdef HAVE_VERSION_H
+#include "version.h"
+#endif
 
 bool is_verbose = false, minimalrendering = false;
 int enabled_tests = ~0;		/* Enable all tests by default */
@@ -289,7 +292,11 @@ int main(int argc, char **argv)
 	/* Print the version string.  Bail out if --version was requested and
 	 * continue otherwise.
 	 */
+#ifdef HAVE_VERSION_H
+	printf("rendercheck %s\n", VERSION);
+#else
 	puts(PACKAGE_STRING);
+#endif
 	if (print_version)
 		return 0;
 
diff --git a/meson.build b/meson.build
new file mode 100644
index 000000000000..bb4171d598c0
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,67 @@
+project('rendercheck', 'c')
+project_version = '1.5'
+cc = meson.get_compiler('c')
+
+if cc.has_header('err.h')
+    add_project_arguments('-DHAVE_ERR_H', language: 'c')
+endif
+
+add_project_arguments('-D_GNU_SOURCE', language: 'c')
+add_project_arguments('-DHAVE_VERSION_H', language: 'c')
+
+srcs = [
+    'main.c',
+    'ops.c',
+    'tests.c',
+    't_blend.c',
+    't_bug7366.c',
+    't_composite.c',
+    't_dstcoords.c',
+    't_fill.c',
+    't_gradient.c',
+    't_gtk_argb_xbgr.c',
+    't_libreoffice_xrgb.c',
+    't_repeat.c',
+    't_shmblend.c',
+    't_srccoords.c',
+    't_tsrccoords.c',
+    't_tsrccoords2.c',
+    't_triangles.c',
+]
+
+version_config = configuration_data()
+version_config.set_quoted('VERSION', project_version)
+
+configure_file(
+    output: 'version.h',
+    configuration: version_config,
+)
+
+executable(
+    'rendercheck',
+    srcs,
+    dependencies: [
+        dependency('xrender'),
+        dependency('xext'),
+        dependency('x11'),
+        dependency('xproto', version: '>= 7.0.17'),
+    ],
+    install: true,
+)
+
+man_xorgversion = '"rendercheck @0@" "X Version 11"'.format(project_version)
+
+custom_target(
+    'manpage',
+    input: 'man/rendercheck.man',
+    output: 'rendercheck.1',
+    command: [
+        'sed',
+        '-e',
+	's/__xorgversion__/@0@/'.format(man_xorgversion),
+	'@INPUT@'
+    ],
+    capture: true,
+    install: true,
+    install_dir: join_paths(get_option('mandir'), 'man1'),
+)
-- 
2.11.0



More information about the xorg-devel mailing list