build: address meson deprecation warnings:

- `ExternalProgram.path`
- `dependency.get_pkgconfig_variable`
- `meson.build_root`
- `meson.source_root`
This commit is contained in:
Aleksei Bavshin 2024-02-16 23:59:38 -08:00
parent 72406fa3f2
commit c2f37705ad
No known key found for this signature in database
GPG Key ID: 4F071603387A382A
3 changed files with 13 additions and 13 deletions

View File

@ -2,7 +2,7 @@ project(
'waybar', 'cpp', 'c', 'waybar', 'cpp', 'c',
version: '0.9.24', version: '0.9.24',
license: 'MIT', license: 'MIT',
meson_version: '>= 0.50.0', meson_version: '>= 0.56.0',
default_options : [ default_options : [
'cpp_std=c++20', 'cpp_std=c++20',
'buildtype=release', 'buildtype=release',
@ -31,10 +31,10 @@ git = find_program('git', native: true, required: false)
if not git.found() if not git.found()
add_project_arguments('-DVERSION="@0@"'.format(meson.project_version()), language: 'cpp') add_project_arguments('-DVERSION="@0@"'.format(meson.project_version()), language: 'cpp')
else else
git_path = run_command([git.path(), 'rev-parse', '--show-toplevel']).stdout().strip() git_path = run_command(git, 'rev-parse', '--show-toplevel', check: false).stdout().strip()
if meson.source_root() == git_path if meson.project_source_root() == git_path
git_commit_hash = run_command([git.path(), 'describe', '--always', '--tags']).stdout().strip() git_commit_hash = run_command(git, 'describe', '--always', '--tags', check: false).stdout().strip()
git_branch = run_command([git.path(), 'rev-parse', '--abbrev-ref', 'HEAD']).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) version = '"@0@ (branch \'@1@\')"'.format(git_commit_hash, git_branch)
add_project_arguments('-DVERSION=@0@'.format(version), language: 'cpp') add_project_arguments('-DVERSION=@0@'.format(version), language: 'cpp')
else else
@ -146,7 +146,7 @@ conf_data.set('prefix', prefix)
add_project_arguments('-DSYSCONFDIR="/@0@"'.format(join_paths(prefix, sysconfdir)), language : 'cpp') add_project_arguments('-DSYSCONFDIR="/@0@"'.format(join_paths(prefix, sysconfdir)), language : 'cpp')
if systemd.found() if systemd.found()
user_units_dir = systemd.get_pkgconfig_variable('systemduserunitdir') user_units_dir = systemd.get_variable(pkgconfig: 'systemduserunitdir')
configure_file( configure_file(
configuration: conf_data, configuration: conf_data,
@ -435,7 +435,7 @@ install_data(
scdoc = dependency('scdoc', version: '>=1.9.2', native: true, required: get_option('man-pages')) scdoc = dependency('scdoc', version: '>=1.9.2', native: true, required: get_option('man-pages'))
if scdoc.found() 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) sh = find_program('sh', native: true)
main_manpage = configure_file( 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') mandir = get_option('mandir')
man_files = [ man_files = [
@ -511,7 +511,7 @@ if scdoc.found()
input: join_paths('man', path), input: join_paths('man', path),
output: output, output: output,
command: [ 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: true,
install_dir: '@0@/man@1@'.format(mandir, section) install_dir: '@0@/man@1@'.format(mandir, section)
@ -537,7 +537,7 @@ if clangtidy.found()
command: [ command: [
clangtidy, clangtidy,
'-checks=*,-fuchsia-default-arguments', '-checks=*,-fuchsia-default-arguments',
'-p', meson.build_root() '-p', meson.project_build_root()
] + src_files) ] + src_files)
endif endif

View File

@ -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') wayland_scanner = find_program('wayland-scanner')
@ -44,7 +44,7 @@ endforeach
gdbus_codegen = find_program('gdbus-codegen') 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 if r.returncode() != 0
gdbus_code_dsnw = custom_target( gdbus_code_dsnw = custom_target(
'dbus-status-notifier-watcher.[ch]', 'dbus-status-notifier-watcher.[ch]',

View File

@ -31,5 +31,5 @@ waybar_test = executable(
test( test(
'waybar', 'waybar',
waybar_test, waybar_test,
workdir: meson.source_root(), workdir: meson.project_source_root(),
) )