pdb: fix previous commit to work with old and new meson (+ typo fix).

The `env` option is new (from meson 0.57.0), yet we depend on meson
0.50.0 and bumping the meson requirement is not a possibility (we have
bad experience when we did this for babl).

Instead, implement the new option usage and a workaround which would
work also with older meson.

I could have implemented only the workaround, but it's also nice to
write down the better syntax so that when we actually bump meson
requirement, getting rid of the workaround will just be a matter of
hitting delete and done. Though it also means we must keep both if/else
blocks in sync, so it has its drawbacks.
See the discussion in !506.
This commit is contained in:
Jehan 2021-11-14 12:49:30 +01:00
parent f9e206da01
commit d4df5d0fc7

View file

@ -106,47 +106,92 @@ groups_pl = custom_target('groups.pl',
capture: true, capture: true,
) )
enums_pl = custom_target('enums.pl', if meson.version().version_compare('>=0.57.0')
input : [ 'enumgen.pl', 'enums-external.pl', enum_headers, ], enums_pl = custom_target('enums.pl',
output: [ 'enums.pl', ], input : [ 'enumgen.pl', 'enums-external.pl', enum_headers, ],
evn: perl_env, output: [ 'enums.pl', ],
command: [ env: perl_env,
perl, '@INPUT0@', command: [
enum_headers, perl, '@INPUT0@',
], enum_headers,
) ],
)
## TODO remove that ?
## TODO remove that ? pdbgen = custom_target('stamp-pdbgen',
input : [
files(
'pdbgen.pl',
pdbgen = custom_target('stamp-pdbgen', 'app.pl',
input : [ 'lib.pl',
files( 'pdb.pl',
'pdbgen.pl', 'stddefs.pdb',
'util.pl',
),
enums_pl,
groups_pl,
pdb_sources,
],
output: [ 'stamp-pdbgen', ],
env: perl_env,
command: [
perl, '@INPUT0@',
'app', 'lib',
],
)
'app.pl', stamp_enumcode = custom_target('stamp-enum-code',
'lib.pl', input : [ 'enumcode.pl', ],
'pdb.pl', output: [ 'stamp-enum-code', ],
'stddefs.pdb', env: perl_env,
'util.pl', command: [
), perl, '@INPUT0@',
enums_pl, ],
groups_pl, )
pdb_sources, else
], # TODO: remove this workaround when we bump meson requirement to >= 0.57.0
output: [ 'stamp-pdbgen', ], # See MR !506.
env: perl_env, # In the meantime, make sure the 2 if/else blocks are well synced.
command: [ env = find_program('env')
perl, '@INPUT0@',
'app', 'lib',
],
)
stamp_enumcode = custom_target('stamp-enum-code', enums_pl = custom_target('enums.pl',
input : [ 'enumcode.pl', ], input : [ 'enumgen.pl', 'enums-external.pl', enum_headers, ],
output: [ 'stamp-enum-code', ], output: [ 'enums.pl', ],
env: perl_env, command: [
command: [ env, perl_env, perl, '@INPUT0@',
perl, '@INPUT0@', enum_headers,
], ],
) )
pdbgen = custom_target('stamp-pdbgen',
input : [
files(
'pdbgen.pl',
'app.pl',
'lib.pl',
'pdb.pl',
'stddefs.pdb',
'util.pl',
),
enums_pl,
groups_pl,
pdb_sources,
],
output: [ 'stamp-pdbgen', ],
command: [
env, perl_env, perl, '@INPUT0@',
'app', 'lib',
],
)
stamp_enumcode = custom_target('stamp-enum-code',
input : [ 'enumcode.pl', ],
output: [ 'stamp-enum-code', ],
command: [
env, perl_env, perl, '@INPUT0@',
],
)
endif