Skip to content

Commit

Permalink
meson: use a/b instead of join_paths(a,b)
Browse files Browse the repository at this point in the history
It is nicer and shorter.
  • Loading branch information
keszybz committed Jul 27, 2021
1 parent 0b5f1bd commit fce9abb
Show file tree
Hide file tree
Showing 22 changed files with 163 additions and 164 deletions.
2 changes: 1 addition & 1 deletion hwdb.d/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ if conf.get('ENABLE_HWDB') == 1

if install_sysconfdir
meson.add_install_script('sh', '-c',
mkdir_p.format(join_paths(sysconfdir, 'udev/hwdb.d')))
mkdir_p.format(sysconfdir / 'udev/hwdb.d'))

meson.add_install_script('sh', '-c',
'test -n "$DESTDIR" || @0@/systemd-hwdb update'.format(rootbindir))
Expand Down
12 changes: 6 additions & 6 deletions man/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ foreach tuple : xsltproc.found() ? manpages : []
htmlaliases += alias + '.html'
endforeach

mandirn = join_paths(get_option('mandir'), 'man' + section)
mandirn = get_option('mandir') / ('man' + section)

if condition == '' or conf.get(condition) == 1
p1 = custom_target(
Expand All @@ -74,7 +74,7 @@ foreach tuple : xsltproc.found() ? manpages : []
output : htmlalias,
command : [ln, '-fs', html, '@OUTPUT@'])
if want_html
dst = join_paths(docdir, 'html', htmlalias)
dst = docdir / 'html' / htmlalias
cmd = 'ln -fs @0@ $DESTDIR@1@'.format(html, dst)
meson.add_install_script('sh', '-c', cmd)
p2 += link
Expand All @@ -89,7 +89,7 @@ foreach tuple : xsltproc.found() ? manpages : []
command : xslt_cmd + [custom_html_xsl, '@INPUT@'],
depends : [custom_entities_ent, p2],
install : want_html,
install_dir : join_paths(docdir, 'html'))
install_dir : docdir / 'html')
html_pages += p3

file = files(tuple[0] + '.xml')
Expand Down Expand Up @@ -132,7 +132,7 @@ foreach tuple : xsltproc.found() ? [['systemd.directives', '7', systemd_directiv
html = stem + '.html'
man = stem + '.' + section

mandirn = join_paths(get_option('mandir'), 'man' + section)
mandirn = get_option('mandir') / ('man' + section)

p1 = custom_target(
man,
Expand All @@ -152,7 +152,7 @@ foreach tuple : xsltproc.found() ? [['systemd.directives', '7', systemd_directiv
output : htmlalias,
command : [ln, '-fs', html, '@OUTPUT@'])
if want_html
dst = join_paths(docdir, 'html', htmlalias)
dst = docdir / 'html' / htmlalias
cmd = 'ln -fs @0@ $DESTDIR@1@'.format(html, dst)
meson.add_install_script('sh', '-c', cmd)
p2 += link
Expand All @@ -167,7 +167,7 @@ foreach tuple : xsltproc.found() ? [['systemd.directives', '7', systemd_directiv
command : xslt_cmd + [custom_html_xsl, '@INPUT@'],
depends : [custom_entities_ent, p2],
install : want_html and have_lxml,
install_dir : join_paths(docdir, 'html'))
install_dir : docdir / 'html')
html_pages += p3
endforeach

Expand Down
232 changes: 116 additions & 116 deletions meson.build

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion network/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ if conf.get('ENABLE_NETWORKD') == 1

if install_sysconfdir
meson.add_install_script('sh', '-c',
mkdir_p.format(join_paths(sysconfdir, 'systemd/network')))
mkdir_p.format(sysconfdir / 'systemd/network'))
endif
endif

Expand Down
2 changes: 1 addition & 1 deletion shell-completion/bash/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ if bashcompletiondir == ''
if bash_completion.found()
bashcompletiondir = bash_completion.get_pkgconfig_variable('completionsdir')
else
bashcompletiondir = join_paths(datadir, 'bash-completion/completions')
bashcompletiondir = datadir / 'bash-completion/completions'
endif
endif

Expand Down
2 changes: 1 addition & 1 deletion shell-completion/zsh/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

zshcompletiondir = get_option('zshcompletiondir')
if zshcompletiondir == ''
zshcompletiondir = join_paths(datadir, 'zsh/site-functions')
zshcompletiondir = datadir / 'zsh/site-functions'
endif

custom_target(
Expand Down
18 changes: 9 additions & 9 deletions src/boot/efi/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,14 @@ if conf.get('ENABLE_EFI') == 1 and get_option('gnu-efi') != 'false'
efi_libdir = get_option('efi-libdir')
if efi_libdir == ''
# New location first introduced with gnu-efi 3.0.11
efi_libdir = join_paths('/usr/lib/gnuefi', EFI_MACHINE_TYPE_NAME)
efi_libdir = '/usr/lib/gnuefi' / EFI_MACHINE_TYPE_NAME
cmd = run_command(test, '-e', efi_libdir)

if cmd.returncode() != 0
# Fall back to the old approach
cmd = run_command(efi_cc + ['-print-multi-os-directory'])
if cmd.returncode() == 0
path = join_paths('/usr/lib', cmd.stdout().strip())
path = '/usr/lib' / cmd.stdout().strip()
cmd = run_command(env, 'realpath', '-e', path)
if cmd.returncode() == 0
efi_libdir = cmd.stdout().strip()
Expand Down Expand Up @@ -148,13 +148,13 @@ if have_gnu_efi

efi_location_map = [
# New locations first introduced with gnu-efi 3.0.11
[join_paths(efi_libdir, 'efi.lds'),
join_paths(efi_libdir, 'crt0.o')],
[efi_libdir / 'efi.lds',
efi_libdir / 'crt0.o'],
# Older locations...
[join_paths(efi_libdir, 'gnuefi', 'elf_@0@_efi.lds'.format(gnu_efi_path_arch)),
join_paths(efi_libdir, 'gnuefi', 'crt0-efi-@0@.o'.format(gnu_efi_path_arch))],
[join_paths(efi_libdir, 'elf_@0@_efi.lds'.format(gnu_efi_path_arch)),
join_paths(efi_libdir, 'crt0-efi-@0@.o'.format(gnu_efi_path_arch))]]
[efi_libdir / 'gnuefi' / 'elf_@0@_efi.lds'.format(gnu_efi_path_arch),
efi_libdir / 'gnuefi' / 'crt0-efi-@0@.o'.format(gnu_efi_path_arch)],
[efi_libdir / 'elf_@0@_efi.lds'.format(gnu_efi_path_arch),
efi_libdir / 'crt0-efi-@0@.o'.format(gnu_efi_path_arch)]]
efi_lds = ''
foreach location : efi_location_map
if efi_lds == ''
Expand Down Expand Up @@ -191,7 +191,7 @@ if have_gnu_efi
'-nostdlib',
'-std=gnu99',
'-isystem', efi_incdir,
'-isystem', join_paths(efi_incdir, gnu_efi_path_arch),
'-isystem', efi_incdir / gnu_efi_path_arch,
'-I', fundamental_path,
'-DSD_BOOT',
'-include', efi_config_h,
Expand Down
6 changes: 3 additions & 3 deletions src/core/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -210,9 +210,9 @@ meson.add_install_script('sh', '-c', mkdir_p.format(systemgeneratordir))
meson.add_install_script('sh', '-c', mkdir_p.format(usergeneratordir))

if install_sysconfdir
meson.add_install_script('sh', '-c', mkdir_p.format(join_paths(pkgsysconfdir, 'system')))
meson.add_install_script('sh', '-c', mkdir_p.format(join_paths(pkgsysconfdir, 'user')))
meson.add_install_script('sh', '-c', mkdir_p.format(join_paths(sysconfdir, 'xdg/systemd')))
meson.add_install_script('sh', '-c', mkdir_p.format(pkgsysconfdir / 'system'))
meson.add_install_script('sh', '-c', mkdir_p.format(pkgsysconfdir / 'user'))
meson.add_install_script('sh', '-c', mkdir_p.format(sysconfdir / 'xdg/systemd'))
endif

############################################################
Expand Down
2 changes: 1 addition & 1 deletion src/cryptsetup/cryptsetup-tokens/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ if conf.get('HAVE_LIBCRYPTSETUP_PLUGINS') == 1
cryptsetup_token_c_args = ['-fvisibility=hidden']

cryptsetup_token_sym = files('cryptsetup-token.sym')
cryptsetup_token_sym_path = join_paths(meson.current_source_dir(), 'cryptsetup-token.sym')
cryptsetup_token_sym_path = meson.current_source_dir() / 'cryptsetup-token.sym'

if conf.get('HAVE_TPM2') == 1
cryptsetup_token_systemd_tpm2_sources = files('''
Expand Down
4 changes: 2 additions & 2 deletions src/fundamental/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ sources = '''

# for sd-boot
fundamental_source_paths = []
foreach s : sources
fundamental_source_paths += join_paths(meson.current_source_dir(), s)
foreach source : sources
fundamental_source_paths += meson.current_source_dir() / source
endforeach

# for libbasic
Expand Down
2 changes: 1 addition & 1 deletion src/journal-remote/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ endforeach

if conf.get('ENABLE_REMOTE') == 1 and conf.get('HAVE_MICROHTTPD') == 1
install_data('browse.html',
install_dir : join_paths(pkgdatadir, 'gatewayd'))
install_dir : pkgdatadir / 'gatewayd')

if get_option('create-log-dirs')
meson.add_install_script('sh', '-c',
Expand Down
2 changes: 1 addition & 1 deletion src/kernel-install/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ if want_kernel_install

if install_sysconfdir
meson.add_install_script('sh', '-c',
mkdir_p.format(join_paths(sysconfdir, 'kernel/install.d')))
mkdir_p.format(sysconfdir / 'kernel/install.d'))
endif

endif
2 changes: 1 addition & 1 deletion src/libsystemd/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ libsystemd_static = static_library(
c_args : libsystemd_c_args)

libsystemd_sym = files('libsystemd.sym')
libsystemd_sym_path = join_paths(meson.current_source_dir(), 'libsystemd.sym')
libsystemd_sym_path = meson.current_source_dir() / 'libsystemd.sym'

static_libsystemd = get_option('static-libsystemd')
static_libsystemd_pic = static_libsystemd == 'true' or static_libsystemd == 'pic'
Expand Down
4 changes: 2 additions & 2 deletions src/libudev/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ libudev_sources = files(
libudev_includes = [includes, include_directories('.')]

libudev_sym = files('libudev.sym')
libudev_sym_path = join_paths(meson.current_source_dir(), 'libudev.sym')
libudev_sym_path = meson.current_source_dir() / 'libudev.sym'

install_headers('libudev.h')
libudev_h_path = join_paths(meson.current_source_dir(), 'libudev.h')
libudev_h_path = meson.current_source_dir() / 'libudev.h'

libudev_basic = static_library(
'udev-basic',
Expand Down
4 changes: 2 additions & 2 deletions src/locale/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ endif
# If you know a way that allows the same variables to be used
# in sources list and concatenated to a string for test_env,
# let me know.
kbd_model_map = join_paths(meson.current_source_dir(), 'kbd-model-map')
language_fallback_map = join_paths(meson.current_source_dir(), 'language-fallback-map')
kbd_model_map = meson.current_source_dir() / 'kbd-model-map'
language_fallback_map = meson.current_source_dir() / 'language-fallback-map'

if conf.get('ENABLE_LOCALED') == 1
install_data('kbd-model-map',
Expand Down
8 changes: 4 additions & 4 deletions src/portable/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ if conf.get('ENABLE_PORTABLED') == 1
install_data('org.freedesktop.portable1.policy',
install_dir : polkitpolicydir)

install_data('profile/default/service.conf', install_dir : join_paths(profiledir, 'default'))
install_data('profile/nonetwork/service.conf', install_dir : join_paths(profiledir, 'nonetwork'))
install_data('profile/strict/service.conf', install_dir : join_paths(profiledir, 'strict'))
install_data('profile/trusted/service.conf', install_dir : join_paths(profiledir, 'trusted'))
install_data('profile/default/service.conf', install_dir : profiledir / 'default')
install_data('profile/nonetwork/service.conf', install_dir : profiledir / 'nonetwork')
install_data('profile/strict/service.conf', install_dir : profiledir / 'strict')
install_data('profile/trusted/service.conf', install_dir : profiledir / 'trusted')
endif
2 changes: 1 addition & 1 deletion src/systemd/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ foreach header : _systemd_headers + _not_installed_headers + [libudev_h_path]
check_compilation_sh,
args : cc.cmd_array() + ['-c', '-x'] + opt +
['-Werror', '-include',
join_paths(meson.current_source_dir(), header)])
meson.current_source_dir() / header])
endif
endforeach
endforeach
4 changes: 2 additions & 2 deletions src/udev/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ endforeach

if install_sysconfdir_samples
install_data('udev.conf',
install_dir : join_paths(sysconfdir, 'udev'))
install_dir : sysconfdir / 'udev')
endif

custom_target(
Expand All @@ -167,7 +167,7 @@ custom_target(

if install_sysconfdir
meson.add_install_script('sh', '-c',
mkdir_p.format(join_paths(sysconfdir, 'udev/rules.d')))
mkdir_p.format(sysconfdir / 'udev/rules.d'))
endif

fuzzers += [
Expand Down
2 changes: 1 addition & 1 deletion sysctl.d/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@ custom_target(

if install_sysconfdir
meson.add_install_script('sh', '-c',
mkdir_p.format(join_paths(sysconfdir, 'sysctl.d')))
mkdir_p.format(sysconfdir / 'sysctl.d'))
endif
2 changes: 1 addition & 1 deletion test/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ if want_tests != 'false' and dmi_arches.contains(host_machine.cpu_family())
endif

foreach p : out.stdout().split()
source = join_paths(project_source_root, p)
source = project_source_root / p
name = 'dmidecode_' + p.split('/')[-1].split('.')[0]

test(name,
Expand Down
3 changes: 1 addition & 2 deletions tmpfiles.d/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,5 @@ endforeach

if enable_tmpfiles and install_sysconfdir
meson.add_install_script(
'sh', '-c',
mkdir_p.format(join_paths(sysconfdir, 'tmpfiles.d')))
'sh', '-c', mkdir_p.format(sysconfdir / 'tmpfiles.d'))
endif
10 changes: 5 additions & 5 deletions units/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -307,17 +307,17 @@ install_data('user-.slice.d/10-defaults.conf',

if install_sysconfdir
meson.add_install_script(meson_make_symlink,
join_paths(pkgsysconfdir, 'user'),
join_paths(sysconfdir, 'xdg/systemd/user'))
pkgsysconfdir / 'user',
sysconfdir / 'xdg/systemd/user')
endif
meson.add_install_script(meson_make_symlink,
join_paths(dbussystemservicedir, 'org.freedesktop.systemd1.service'),
join_paths(dbussessionservicedir, 'org.freedesktop.systemd1.service'))
dbussystemservicedir / 'org.freedesktop.systemd1.service',
dbussessionservicedir / 'org.freedesktop.systemd1.service')
if conf.get('HAVE_SYSV_COMPAT') == 1
foreach i : [1, 2, 3, 4, 5]
meson.add_install_script(
'sh', '-c',
mkdir_p.format(join_paths(systemunitdir, 'runlevel@0@.target.wants'.format(i))))
mkdir_p.format(systemunitdir / 'runlevel@0@.target.wants'.format(i)))
endforeach
endif

Expand Down

0 comments on commit fce9abb

Please sign in to comment.