Hi, On 2024-04-05 16:12:12 -0400, Andrew Dunstan wrote: > OK, this has been fixed and checked. The attached is what I propose.
The perl command is pretty hard to read. What about using python's shlex module instead? Rough draft attached. Still not very pretty, but seems easier to read? It'd be even better if we could just get perl to print out the flags in an easier to parse way, but I couldn't immediately see a way. Greetings, Andres Freund
diff --git i/meson.build w/meson.build index d6401fb8e30..191a051defb 100644 --- i/meson.build +++ w/meson.build @@ -997,13 +997,20 @@ if not perlopt.disabled() undesired = run_command(perl_conf_cmd, 'ccdlflags', check: true).stdout().split() undesired += run_command(perl_conf_cmd, 'ldflags', check: true).stdout().split() + ldopts_split = run_command(python, '-c', ''' +import shlex +import sys + +print('\n'.join(shlex.split(sys.argv[1])), end='') +''', + ldopts, check: true).stdout().split('\n') + perl_ldopts = [] - foreach ldopt : ldopts.split(' ') - if ldopt == '' or ldopt in undesired + foreach ldopt : ldopts_split + if ldopt in undesired continue endif - - perl_ldopts += ldopt.strip('"') + perl_ldopts += ldopt endforeach message('LDFLAGS recommended by perl: "@0@"'.format(ldopts))