From c2f37705ad809dffefa90b04b6d4f0b54b6b4202 Mon Sep 17 00:00:00 2001 From: Aleksei Bavshin Date: Fri, 16 Feb 2024 23:59:38 -0800 Subject: [PATCH] build: address meson deprecation warnings: - `ExternalProgram.path` - `dependency.get_pkgconfig_variable` - `meson.build_root` - `meson.source_root` --- meson.build | 20 ++++++++++---------- protocol/meson.build | 4 ++-- test/meson.build | 2 +- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/meson.build b/meson.build index cb2b4a33..2b4f94a2 100644 --- a/meson.build +++ b/meson.build @@ -2,7 +2,7 @@ project( 'waybar', 'cpp', 'c', version: '0.9.24', license: 'MIT', - meson_version: '>= 0.50.0', + meson_version: '>= 0.56.0', default_options : [ 'cpp_std=c++20', 'buildtype=release', @@ -31,10 +31,10 @@ git = find_program('git', native: true, required: false) if not git.found() add_project_arguments('-DVERSION="@0@"'.format(meson.project_version()), language: 'cpp') else - git_path = run_command([git.path(), 'rev-parse', '--show-toplevel']).stdout().strip() - if meson.source_root() == git_path - git_commit_hash = run_command([git.path(), 'describe', '--always', '--tags']).stdout().strip() - git_branch = run_command([git.path(), 'rev-parse', '--abbrev-ref', 'HEAD']).stdout().strip() + git_path = run_command(git, 'rev-parse', '--show-toplevel', check: false).stdout().strip() + if meson.project_source_root() == git_path + git_commit_hash = run_command(git, 'describe', '--always', '--tags', check: false).stdout().strip() + git_branch = run_command(git, 'rev-parse', '--abbrev-ref', 'HEAD', check: false).stdout().strip() version = '"@0@ (branch \'@1@\')"'.format(git_commit_hash, git_branch) add_project_arguments('-DVERSION=@0@'.format(version), language: 'cpp') else @@ -146,7 +146,7 @@ conf_data.set('prefix', prefix) add_project_arguments('-DSYSCONFDIR="/@0@"'.format(join_paths(prefix, sysconfdir)), language : 'cpp') if systemd.found() - user_units_dir = systemd.get_pkgconfig_variable('systemduserunitdir') + user_units_dir = systemd.get_variable(pkgconfig: 'systemduserunitdir') configure_file( configuration: conf_data, @@ -435,7 +435,7 @@ install_data( scdoc = dependency('scdoc', version: '>=1.9.2', native: true, required: get_option('man-pages')) if scdoc.found() - scdoc_prog = find_program(scdoc.get_pkgconfig_variable('scdoc'), native: true) + scdoc_prog = find_program(scdoc.get_variable(pkgconfig: 'scdoc'), native: true) sh = find_program('sh', native: true) main_manpage = configure_file( @@ -446,7 +446,7 @@ if scdoc.found() } ) - main_manpage_path = join_paths(meson.build_root(), '@0@'.format(main_manpage)) + main_manpage_path = join_paths(meson.project_build_root(), '@0@'.format(main_manpage)) mandir = get_option('mandir') man_files = [ @@ -511,7 +511,7 @@ if scdoc.found() input: join_paths('man', path), output: output, command: [ - sh, '-c', '@0@ < @INPUT@ > @1@'.format(scdoc_prog.path(), output) + sh, '-c', '@0@ < @INPUT@ > @1@'.format(scdoc_prog.full_path(), output) ], install: true, install_dir: '@0@/man@1@'.format(mandir, section) @@ -537,7 +537,7 @@ if clangtidy.found() command: [ clangtidy, '-checks=*,-fuchsia-default-arguments', - '-p', meson.build_root() + '-p', meson.project_build_root() ] + src_files) endif diff --git a/protocol/meson.build b/protocol/meson.build index e1e745a9..0935b6c6 100644 --- a/protocol/meson.build +++ b/protocol/meson.build @@ -1,4 +1,4 @@ -wl_protocol_dir = wayland_protos.get_pkgconfig_variable('pkgdatadir') +wl_protocol_dir = wayland_protos.get_variable(pkgconfig: 'pkgdatadir') wayland_scanner = find_program('wayland-scanner') @@ -44,7 +44,7 @@ endforeach gdbus_codegen = find_program('gdbus-codegen') -r = run_command(gdbus_codegen, '--body', '--output', '/dev/null') +r = run_command(gdbus_codegen, '--body', '--output', '/dev/null', check: false) if r.returncode() != 0 gdbus_code_dsnw = custom_target( 'dbus-status-notifier-watcher.[ch]', diff --git a/test/meson.build b/test/meson.build index 4c71d326..7c922671 100644 --- a/test/meson.build +++ b/test/meson.build @@ -31,5 +31,5 @@ waybar_test = executable( test( 'waybar', waybar_test, - workdir: meson.source_root(), + workdir: meson.project_source_root(), )