build: use hwdata's pkg-config file

Ensures the system has the proper dependency, and avoids hardcoding
the path.
This commit is contained in:
Simon Ser 2022-09-27 19:54:00 +02:00
parent 91fbb22bda
commit f4a33bd37e
2 changed files with 3 additions and 2 deletions

View file

@ -45,6 +45,7 @@ cap_dep = dependency('libcap')
sdl_dep = dependency('SDL2') sdl_dep = dependency('SDL2')
pipewire_dep = dependency('libpipewire-0.3', required: get_option('pipewire')) pipewire_dep = dependency('libpipewire-0.3', required: get_option('pipewire'))
librt_dep = cppc.find_library('rt', required : get_option('pipewire')) librt_dep = cppc.find_library('rt', required : get_option('pipewire'))
hwdata_dep = dependency('hwdata')
stb_dep = dependency('stb') stb_dep = dependency('stb')
@ -112,6 +113,7 @@ liftoff_dep = dependency(
add_project_arguments( add_project_arguments(
'-DHAVE_PIPEWIRE=@0@'.format(pipewire_dep.found().to_int()), '-DHAVE_PIPEWIRE=@0@'.format(pipewire_dep.found().to_int()),
'-DHWDATA_PNP_IDS="@0@"'.format(hwdata_dep.get_variable('pkgdatadir') / 'pnp.ids'),
language: 'cpp', language: 'cpp',
) )

View file

@ -746,8 +746,7 @@ static bool setup_best_connector(struct drm_t *drm, bool force)
void load_pnps(void) void load_pnps(void)
{ {
// TODO: use hwdata's pkg-config file once they ship one const char *filename = HWDATA_PNP_IDS;
const char *filename = "/usr/share/hwdata/pnp.ids";
FILE *f = fopen(filename, "r"); FILE *f = fopen(filename, "r");
if (!f) { if (!f) {
drm_log.infof("failed to open PNP IDs file at '%s'", filename); drm_log.infof("failed to open PNP IDs file at '%s'", filename);