libsysprof, libsysprof-ui: Generate pkg-config dependencies

Otherwise, using libsysprof-ui will usually fail because <dazzle.h>
is not added to the search path.

Resolves: https://gitlab.gnome.org/GNOME/sysprof/-/issues/49
Signed-off-by: Simon McVittie <smcv@debian.org>
This commit is contained in:
Simon McVittie
2020-09-15 20:03:19 +01:00
parent 68c50ba869
commit 04b6fdfcbe
3 changed files with 32 additions and 6 deletions

View File

@ -72,5 +72,6 @@ if not meson.is_subproject()
description: 'The static capture library for tools that generate profiling capture data', description: 'The static capture library for tools that generate profiling capture data',
install_dir: join_paths(get_option('libdir'), 'pkgconfig'), install_dir: join_paths(get_option('libdir'), 'pkgconfig'),
variables: [ 'datadir=' + datadir_for_pc_file ], variables: [ 'datadir=' + datadir_for_pc_file ],
requires_private: libsysprof_capture_deps,
) )
endif endif

View File

@ -84,13 +84,27 @@ libsysprof_ui_resources = gnome.compile_resources(
c_name: 'lisysprof_ui', c_name: 'lisysprof_ui',
) )
libsysprof_ui_deps = [ # Subset of dependencies used in generating the pkg-config file
libsysprof_ui_pkg_deps = [
dependency('gio-2.0', version: glib_req_version), dependency('gio-2.0', version: glib_req_version),
dependency('gtk+-3.0', version: gtk_req_version), dependency('gtk+-3.0', version: gtk_req_version),
dependency('libdazzle-1.0', version: dazzle_req_version, fallback: ['libdazzle', 'libdazzle_dep']), ]
libsysprof_ui_deps = libsysprof_ui_pkg_deps + [
libsysprof_dep, libsysprof_dep,
] ]
# Meson's pkgconfig module wants to see a library here, not an internal
# dependency object
libsysprof_ui_pkg_deps += libsysprof
dazzle_dep = dependency('libdazzle-1.0', version: dazzle_req_version, fallback: ['libdazzle', 'libdazzle_dep'])
libsysprof_ui_deps += dazzle_dep
if dazzle_dep.type_name() == 'pkgconfig'
libsysprof_ui_pkg_deps += dazzle_dep
endif
libsysprof_ui = shared_library( libsysprof_ui = shared_library(
'sysprof-ui-@0@'.format(libsysprof_api_version), 'sysprof-ui-@0@'.format(libsysprof_api_version),
libsysprof_ui_public_sources + libsysprof_ui_private_sources + libsysprof_ui_resources, libsysprof_ui_public_sources + libsysprof_ui_private_sources + libsysprof_ui_resources,
@ -117,6 +131,7 @@ pkgconfig.generate(
description: 'The UI library for GTK applications embedding sysprof', description: 'The UI library for GTK applications embedding sysprof',
install_dir: join_paths(get_option('libdir'), 'pkgconfig'), install_dir: join_paths(get_option('libdir'), 'pkgconfig'),
requires: [ 'gio-2.0', 'gtk+-3.0' ], requires: [ 'gio-2.0', 'gtk+-3.0' ],
requires_private: libsysprof_ui_pkg_deps,
variables: [ variables: [
'datadir=' + datadir_for_pc_file, 'datadir=' + datadir_for_pc_file,
], ],

View File

@ -109,12 +109,12 @@ if dependency('polkit-gobject-1', version: '>= 0.114', required: false).found()
libsysprof_c_args += ['-DHAVE_POLKIT_AUTOPTR'] libsysprof_c_args += ['-DHAVE_POLKIT_AUTOPTR']
endif endif
libsysprof_deps = [ # Subset of dependencies used in generating the pkg-config file
libsysprof_capture_deps, libsysprof_pkg_deps = [
dependency('gio-2.0', version: glib_req_version), dependency('gio-2.0', version: glib_req_version),
dependency('gio-unix-2.0', version: glib_req_version), dependency('gio-unix-2.0', version: glib_req_version),
polkit_dep, polkit_dep,
librax_dep, libsysprof_capture_deps,
] ]
if host_machine.system() == 'linux' if host_machine.system() == 'linux'
@ -134,12 +134,20 @@ if host_machine.system() == 'linux'
endif endif
if host_machine.system() == 'darwin' if host_machine.system() == 'darwin'
libsysprof_deps += [ dependency('libelf') ] libsysprof_pkg_deps += [ dependency('libelf') ]
libsysprof_c_args += [ '-DNT_GNU_BUILD_ID=3', '-DELF_NOTE_GNU="GNU"', '-D__LIBELF_INTERNAL__' ] libsysprof_c_args += [ '-DNT_GNU_BUILD_ID=3', '-DELF_NOTE_GNU="GNU"', '-D__LIBELF_INTERNAL__' ]
endif endif
# Meson's pkgconfig module doesn't understand this one
libsysprof_deps = libsysprof_pkg_deps + [
librax_dep,
]
libsysprof_libs_private = []
if host_machine.system() != 'darwin' if host_machine.system() != 'darwin'
libsysprof_deps += [cxx.find_library('stdc++')] libsysprof_deps += [cxx.find_library('stdc++')]
libsysprof_libs_private += '-lstdc++'
endif endif
libsysprof = shared_library( libsysprof = shared_library(
@ -171,6 +179,8 @@ pkgconfig.generate(
description: 'The library for console applications embedding sysprof', description: 'The library for console applications embedding sysprof',
install_dir: join_paths(get_option('libdir'), 'pkgconfig'), install_dir: join_paths(get_option('libdir'), 'pkgconfig'),
requires: [ 'gio-2.0' ], requires: [ 'gio-2.0' ],
requires_private: libsysprof_pkg_deps,
libraries_private: libsysprof_libs_private,
variables: [ variables: [
'datadir=' + datadir_for_pc_file, 'datadir=' + datadir_for_pc_file,
], ],