mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-02-04 00:00:28 +01:00
meson.build: use install_subdir() to install the quirks files
This removes the need to check whether the files were added in meson.build but requires litest to traverse the source dir now. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
d724dc060b
commit
727dc44b04
3 changed files with 18 additions and 57 deletions
44
meson.build
44
meson.build
|
|
@ -307,48 +307,10 @@ libinput_data_override_path = join_paths(dir_sysconf, 'local-overrides.quirks')
|
|||
config_h.set_quoted('LIBINPUT_QUIRKS_DIR', dir_data)
|
||||
config_h.set_quoted('LIBINPUT_QUIRKS_OVERRIDE_FILE', libinput_data_override_path)
|
||||
|
||||
quirks_data = [
|
||||
'quirks/10-generic-keyboard.quirks',
|
||||
'quirks/10-generic-lid.quirks',
|
||||
'quirks/10-generic-trackball.quirks',
|
||||
'quirks/30-vendor-aiptek.quirks',
|
||||
'quirks/30-vendor-alps.quirks',
|
||||
'quirks/30-vendor-contour.quirks',
|
||||
'quirks/30-vendor-cypress.quirks',
|
||||
'quirks/30-vendor-elantech.quirks',
|
||||
'quirks/30-vendor-ibm.quirks',
|
||||
'quirks/30-vendor-kensington.quirks',
|
||||
'quirks/30-vendor-logitech.quirks',
|
||||
'quirks/30-vendor-madcatz.quirks',
|
||||
'quirks/30-vendor-microsoft.quirks',
|
||||
'quirks/30-vendor-razer.quirks',
|
||||
'quirks/30-vendor-synaptics.quirks',
|
||||
'quirks/30-vendor-trust.quirks',
|
||||
'quirks/30-vendor-vmware.quirks',
|
||||
'quirks/30-vendor-wacom.quirks',
|
||||
'quirks/50-system-acer.quirks',
|
||||
'quirks/50-system-apple.quirks',
|
||||
'quirks/50-system-asus.quirks',
|
||||
'quirks/50-system-chicony.quirks',
|
||||
'quirks/50-system-cyborg.quirks',
|
||||
'quirks/50-system-dell.quirks',
|
||||
'quirks/50-system-google.quirks',
|
||||
'quirks/50-system-hp.quirks',
|
||||
'quirks/50-system-lenovo.quirks',
|
||||
'quirks/50-system-system76.quirks',
|
||||
'quirks/50-system-toshiba.quirks',
|
||||
]
|
||||
|
||||
test('quirks-in-meson.build',
|
||||
find_program('quirks/test-quirks-in-meson.build.sh'),
|
||||
args : [meson.current_source_dir()],
|
||||
suite : ['all']
|
||||
)
|
||||
|
||||
config_h.set_quoted('LIBINPUT_QUIRKS_FILES', ':'.join(quirks_data))
|
||||
config_h.set_quoted('LIBINPUT_QUIRKS_SRCDIR', dir_src_quirks)
|
||||
|
||||
install_data(quirks_data, install_dir : dir_data)
|
||||
install_subdir('quirks',
|
||||
exclude_files: ['README.md'],
|
||||
install_dir : dir_data)
|
||||
|
||||
src_libquirks = [
|
||||
'src/quirks.c',
|
||||
|
|
|
|||
|
|
@ -1,5 +0,0 @@
|
|||
#!/bin/bash -e
|
||||
|
||||
pushd "$1" > /dev/null
|
||||
diff -U1 <(grep -o 'quirks/.*\.quirks' meson.build) <(ls quirks/*.quirks)
|
||||
popd > /dev/null
|
||||
|
|
@ -1392,6 +1392,10 @@ litest_init_device_quirk_file(const char *data_dir,
|
|||
return safe_strdup(path);
|
||||
}
|
||||
|
||||
static int is_quirks_file(const struct dirent *dir) {
|
||||
return strendswith(dir->d_name, ".quirks");
|
||||
}
|
||||
|
||||
/**
|
||||
* Install the quirks from the quirks/ source directory.
|
||||
*/
|
||||
|
|
@ -1399,30 +1403,30 @@ static void
|
|||
litest_install_source_quirks(struct list *created_files_list,
|
||||
const char *dirname)
|
||||
{
|
||||
const char *quirksdir = "quirks/";
|
||||
char **quirks, **q;
|
||||
struct dirent **namelist;
|
||||
int ndev;
|
||||
|
||||
quirks = strv_from_string(LIBINPUT_QUIRKS_FILES, ":");
|
||||
litest_assert(quirks);
|
||||
ndev = scandir(LIBINPUT_QUIRKS_SRCDIR,
|
||||
&namelist,
|
||||
is_quirks_file,
|
||||
versionsort);
|
||||
litest_assert_int_ge(ndev, 0);
|
||||
|
||||
q = quirks;
|
||||
while (*q) {
|
||||
for (int idx = 0; idx < ndev; idx++) {
|
||||
struct created_file *file;
|
||||
char *filename;
|
||||
char dest[PATH_MAX];
|
||||
char src[PATH_MAX];
|
||||
|
||||
litest_assert(strstartswith(*q, quirksdir));
|
||||
filename = &(*q)[strlen(quirksdir)];
|
||||
|
||||
filename = namelist[idx]->d_name;
|
||||
snprintf(src, sizeof(src), "%s/%s",
|
||||
LIBINPUT_QUIRKS_SRCDIR, filename);
|
||||
snprintf(dest, sizeof(dest), "%s/%s", dirname, filename);
|
||||
file = litest_copy_file(dest, src, NULL, true);
|
||||
list_append(created_files_list, &file->link);
|
||||
q++;
|
||||
free(namelist[idx]);
|
||||
}
|
||||
strv_free(quirks);
|
||||
free(namelist);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue