Skip to content

Commit 241dfc3

Browse files
authored
Merge pull request #4275 from masatake/meson--cfgdata-inline-cfgvars
Meson: extract config vars defined inside configuration_data({...})
2 parents d80d5de + 8511130 commit 241dfc3

File tree

7 files changed

+518
-76
lines changed

7 files changed

+518
-76
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
--sort=no
2+
--map-Meson=+.meson
3+
--fields=+K
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
insights-client input.meson /^project('insights-client',$/;" project
2+
python input.meson /^python = import('python')$/;" variable
3+
python_installation input.meson /^python_installation = python.find_installation(get_option('python'))$/;" variable
4+
python_exec input.meson /^python_exec = '\/usr\/bin\/python3'$/;" variable
5+
systemd input.meson /^systemd = dependency('systemd', version: '>=231')$/;" variable
6+
config_data input.meson /^config_data = configuration_data({$/;" cfgdata
7+
bindir input.meson /^ 'bindir': get_option('prefix') \/ get_option('bindir'),$/;" cfgvar cfgdata:config_data
8+
BINDIR input.meson /^ 'BINDIR': get_option('prefix') \/ get_option('bindir'),$/;" cfgvar cfgdata:config_data
9+
DATADIR input.meson /^ 'DATADIR': get_option('prefix') \/ get_option('datadir'),$/;" cfgvar cfgdata:config_data
10+
DATAROOTDIR input.meson /^ 'DATAROOTDIR':get_option('prefix') \/ get_option('datadir'),$/;" cfgvar cfgdata:config_data
11+
DOCDIR input.meson /^ 'DOCDIR': get_option('prefix') \/ get_option('datadir') \/ 'doc' \/ meson.project_name(),$/;" cfgvar cfgdata:config_data
12+
LIBEXECDIR input.meson /^ 'LIBEXECDIR': get_option('prefix') \/ get_option('libexecdir'),$/;" cfgvar cfgdata:config_data
13+
LOCALSTATEDIR input.meson /^ 'LOCALSTATEDIR': get_option('localstatedir'),$/;" cfgvar cfgdata:config_data
14+
PACKAGE input.meson /^ 'PACKAGE': meson.project_name(),$/;" cfgvar cfgdata:config_data
15+
PACKAGE_VERSION input.meson /^ 'PACKAGE_VERSION': meson.project_version(),$/;" cfgvar cfgdata:config_data
16+
pkgsysconfdir input.meson /^ 'pkgsysconfdir': '\/' \/ get_option('sysconfdir') \/ meson.project_name(),$/;" cfgvar cfgdata:config_data
17+
PREFIX input.meson /^ 'PREFIX': get_option('prefix'),$/;" cfgvar cfgdata:config_data
18+
PYTHON input.meson /^ 'PYTHON': python_exec,$/;" cfgvar cfgdata:config_data
19+
pythondir input.meson /^ 'pythondir': python_installation.get_install_dir(),$/;" cfgvar cfgdata:config_data
20+
SBINDIR input.meson /^ 'SBINDIR': get_option('prefix') \/ get_option('sbindir'),$/;" cfgvar cfgdata:config_data
21+
SYSCONFDIR input.meson /^ 'SYSCONFDIR': '\/' \/ get_option('sysconfdir'),$/;" cfgvar cfgdata:config_data
22+
sysconfdir input.meson /^ 'sysconfdir': '\/' \/ get_option('sysconfdir'),$/;" cfgvar cfgdata:config_data
23+
top_srcdir input.meson /^ 'top_srcdir': meson.source_root()$/;" cfgvar cfgdata:config_data
24+
update-egg input.meson /^run_target('update-egg', command: 'scripts\/01-upgrade-egg.sh')$/;" run
25+
data input.meson /^subdir('data')$/;" subdir
26+
docs input.meson /^subdir('docs')$/;" subdir
27+
src input.meson /^subdir('src')$/;" subdir
28+
configuration input.meson /^configuration = '**Configuration**\\n'$/;" variable
29+
cfgf5631d8f0109 input-0.meson /^configuration_data({$/;" cfgdata
30+
a input-0.meson /^ 'a': get_option('prefix') \/ get_option('bindir'),$/;" cfgvar cfgdata:cfgf5631d8f0109
31+
b input-0.meson /^ 'b': meson.source_root()$/;" cfgvar cfgdata:cfgf5631d8f0109
32+
update-eggx input-0.meson /^run_target('update-eggx', command: 'scripts\/01-upgrade-egg.sh')$/;" run
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
configuration_data({
2+
'a': get_option('prefix') / get_option('bindir'),
3+
# ...
4+
'b': meson.source_root()
5+
})
6+
7+
run_target('update-eggx', command: 'scripts/01-upgrade-egg.sh')
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# Taken from insights-client-3.2.8/meson.build
2+
3+
project('insights-client',
4+
version: '3.2.8',
5+
meson_version: '>=0.49'
6+
)
7+
8+
python = import('python')
9+
10+
python_installation = python.find_installation(get_option('python'))
11+
12+
python_exec = '/usr/bin/python3'
13+
14+
systemd = dependency('systemd', version: '>=231')
15+
16+
config_data = configuration_data({
17+
'bindir': get_option('prefix') / get_option('bindir'),
18+
'BINDIR': get_option('prefix') / get_option('bindir'),
19+
'DATADIR': get_option('prefix') / get_option('datadir'),
20+
'DATAROOTDIR':get_option('prefix') / get_option('datadir'),
21+
'DOCDIR': get_option('prefix') / get_option('datadir') / 'doc' / meson.project_name(),
22+
'LIBEXECDIR': get_option('prefix') / get_option('libexecdir'),
23+
'LOCALSTATEDIR': get_option('localstatedir'),
24+
'PACKAGE': meson.project_name(),
25+
'PACKAGE_VERSION': meson.project_version(),
26+
'pkgsysconfdir': '/' / get_option('sysconfdir') / meson.project_name(),
27+
'PREFIX': get_option('prefix'),
28+
'PYTHON': python_exec,
29+
'pythondir': python_installation.get_install_dir(),
30+
'SBINDIR': get_option('prefix') / get_option('sbindir'),
31+
'SYSCONFDIR': '/' / get_option('sysconfdir'),
32+
'sysconfdir': '/' / get_option('sysconfdir'),
33+
'top_srcdir': meson.source_root()
34+
})
35+
36+
run_target('update-egg', command: 'scripts/01-upgrade-egg.sh')
37+
38+
subdir('data')
39+
subdir('docs')
40+
subdir('src')
41+
42+
configuration = '**Configuration**\n'
43+
configuration += '\tpython\t\t\t: ' + get_option('python') + '\n'
44+
if get_option('checkin').enabled()
45+
configuration += '\tcheckin\t: ' + 'enabled' + '\n'
46+
else
47+
configuration += '\tcheckin\t: ' + 'disabled' + '\n'
48+
endif
49+
if get_option('auto_registration').enabled()
50+
configuration += '\tauto_registration\t: ' + 'enabled' + '\n'
51+
else
52+
configuration += '\tauto_registration\t: ' + 'disabled' + '\n'
53+
endif
54+
message(configuration)

docs/news/HEAD.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ C#:
2525
* Fix a bug that prevents the parser from extracting methods
2626
if the method has nullable parameters.
2727

28+
Meson:
29+
30+
* Extract config vars defined inside configuration_data({...}).
31+
2832
New parsers
2933
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3034
The following parsers have been added:

0 commit comments

Comments
 (0)