summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2017-03-24 12:22:53 -0700
committerEric Anholt <eric@anholt.net>2017-03-31 13:26:20 -0700
commit2702f88a1399ca29dc69adc62c2b54f96ffd814e (patch)
tree5e66cdf2f23c4d0f36c9c9eb26d906be8e2bc716
parent032b080f899a2ddc65605fb73649709de9c7ace4 (diff)
Add a meson build system.
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@anholt.net> Reviewed-by: Daniel Stone <daniels@collabora.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
-rw-r--r--.gitignore1
-rw-r--r--main.c7
-rw-r--r--meson.build67
3 files changed, 75 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index 0c42807..009669f 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 0d3d146..86346f0 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 0000000..bb4171d
--- /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'),
+)