[PATCH libinput] meson: define the various files litest needs to copy rules/hwdb in place

Peter Hutterer peter.hutterer at who-t.net
Thu May 18 00:53:37 UTC 2017


This was motivated by the need to run the test runner from any directory, so
we need absolute paths to the files we copy.

Unfortunately, we can't get the absolute path from the object returned by
configure_file() and we can't feed that directly into join_paths() either.
So let' make it at least easier to handle: create a configure_file for all the
files we need (so they all end up in builddir/) and simply hardcode the name
for join_paths. Define the lot in config.h, no need to pass compiler flags
around.

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 meson.build | 33 ++++++++++++++++++++-------------
 1 file changed, 20 insertions(+), 13 deletions(-)

diff --git a/meson.build b/meson.build
index e1ea40cb..1c2ee54a 100644
--- a/meson.build
+++ b/meson.build
@@ -87,8 +87,6 @@ executable('libinput-model-quirks',
 	   install_dir : udev_dir)
 
 model_quirks = files('udev/90-libinput-model-quirks.hwdb')
-install_data(model_quirks,
-	     install_dir : udev_hwdb_dir)
 
 parse_hwdb_py = find_program('udev/parse_hwdb.py')
 test('parse-hwdb',
@@ -107,6 +105,11 @@ configure_file(input : 'udev/90-libinput-model-quirks.rules.in',
 	       install : true,
 	       install_dir : udev_rules_dir,
 	       configuration : udev_rules_config)
+configure_file(input : model_quirks,
+	       output : '90-libinput-model-quirks.hwdb',
+	       install : true,
+	       install_dir : udev_hwdb_dir,
+	       configuration : udev_rules_config)
 
 litest_udev_rules_config = configuration_data()
 litest_udev_rules_config.set('UDEV_TEST_PATH', meson.build_root() + '/')
@@ -490,20 +493,24 @@ if get_option('enable-tests')
 		dep_dl,
 		dep_lm
 	]
-	def_quirks_rules_file = '-DLIBINPUT_MODEL_QUIRKS_UDEV_RULES_FILE="@0@"'.format(litest_model_quirks_file)
-	def_quirks_hwdb_file = '-DLIBINPUT_MODEL_QUIRKS_UDEV_HWDB_FILE="@0@/udev/90-libinput-model-quirks.hwdb"'.format(meson.source_root())
-	def_test_rules_file = '-DLIBINPUT_TEST_DEVICE_RULES_FILE="@0@/udev/80-libinput-test-device.rules"'.format(meson.source_root())
-	def_device_groups_file = '-DLIBINPUT_DEVICE_GROUPS_RULES_FILE="@0@"'.format(litest_groups_rules_file)
-	defs_litest = [def_quirks_rules_file,
-		       def_quirks_hwdb_file,
-		       def_test_rules_file,
-		       def_device_groups_file]
 
+	configure_file(input : 'udev/80-libinput-test-device.rules',
+		       output : '80-libinput-test-device.rules',
+		       install : false,
+		       configuration : udev_rules_config)
+
+	config_h.set_quoted('LIBINPUT_MODEL_QUIRKS_UDEV_RULES_FILE',
+			    join_paths(meson.build_root(), '90-libinput-model-quirks.rules'))
+	config_h.set_quoted('LIBINPUT_MODEL_QUIRKS_UDEV_HWDB_FILE',
+			    join_paths(meson.build_root(), '90-libinput-model-quirks.hwdb'))
+	config_h.set_quoted('LIBINPUT_TEST_DEVICE_RULES_FILE',
+			    join_paths(meson.build_root(), '80-libinput-test-device.rules'))
+	config_h.set_quoted('LIBINPUT_DEVICE_GROUPS_RULES_FILE',
+			    join_paths(meson.build_root(), '80-libinput-device-groups.rules'))
 	lib_litest = static_library('litest',
 				    lib_litest_sources,
 				    include_directories : include_directories('src'),
-				    dependencies : deps_litest,
-				    c_args : defs_litest)
+				    dependencies : deps_litest)
 	dep_litest = declare_dependency(link_with : lib_litest,
 					dependencies : deps_litest)
 
@@ -512,7 +519,7 @@ if get_option('enable-tests')
 	defs_litest_selftest = [
 		def_no_main,
 		def_disable_backtrace
-	] + defs_litest
+	]
 	test_litest_selftest_sources = [
 		'test/litest-selftest.c',
 		'test/litest.c',
-- 
2.13.0



More information about the wayland-devel mailing list