From b2e55308d668c19cec7dc4a2bd62884ddb1fea31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Wed, 4 Dec 2019 13:44:08 +0100 Subject: [PATCH] meson: Move generated source to fpi- prefix and use more readable code Instead of concatenating strings, use an array of strings and finally join them using newline. --- libfprint/meson.build | 4 ++-- meson.build | 19 +++++++++++++------ 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/libfprint/meson.build b/libfprint/meson.build index 99ebf73..f73aba3 100644 --- a/libfprint/meson.build +++ b/libfprint/meson.build @@ -172,11 +172,11 @@ fpi_enums = gnome.mkenums_simple('fpi-enums', fpi_enums_h = fpi_enums[1] drivers_sources += configure_file(input: 'empty_file', - output: 'fp-drivers.c', + output: 'fpi-drivers.c', capture: true, command: [ 'echo', - drivers_type_list + '\n\n' + drivers_type_func + '\n'.join(drivers_type_list + [] + drivers_type_func) ]) mapfile = 'libfprint.ver' diff --git a/meson.build b/meson.build index 265ce30..65077c5 100644 --- a/meson.build +++ b/meson.build @@ -117,15 +117,22 @@ foreach driver: drivers endforeach # Export the drivers' types to the core code -drivers_type_list = '#include \n' -drivers_type_list += '#include "fpi-context.h"\n' -drivers_type_func = 'void fpi_get_driver_types(GArray *drivers)\n{\n\tGType t;\n' +drivers_type_list = [] +drivers_type_func = [] +drivers_type_list += '#include ' +drivers_type_list += '#include "fpi-context.h"' +drivers_type_list += '' +drivers_type_func += 'void fpi_get_driver_types (GArray *drivers)' +drivers_type_func += ' {' +drivers_type_func += ' GType t;' +drivers_type_func += '' foreach driver: drivers - drivers_type_list += 'extern GType (fpi_device_' + driver + '_get_type) (void);\n' - drivers_type_func += ' t = fpi_device_' + driver + '_get_type(); g_array_append_val (drivers, t);\n' + drivers_type_list += 'extern GType (fpi_device_' + driver + '_get_type) (void);' + drivers_type_func += ' t = fpi_device_' + driver + '_get_type ();' + drivers_type_func += ' g_array_append_val (drivers, t);\n' endforeach drivers_type_list += '' -drivers_type_func += '};' +drivers_type_func += '}' root_inc = include_directories('.')