Automatically generate additional variables and write them into the
generated pkg-config file.
This means projects no longer need to manually define the ones they
use, which is annoying for dataonly usages (it used to forbid setting
the base library-relevant "reserved" ones, and now allows it only for
dataonly. But it's bloat to manualy list them anyway).
It also fixes a regression in commit
248e6cf473
which caused libdir to not be
set, and to be unsettable, if the pkg-config file has no libraries but
uses the ${libdir} expansion in a custom variable. This could be
considered likely a case for dataonly, but it's not guaranteed.
pull/9994/head
parent
2d56ff135e
commit
6240920c21
4 changed files with 107 additions and 12 deletions
@ -0,0 +1,31 @@ |
||||
## pkgconfig.generate will now include variables for builtin directories when referenced |
||||
|
||||
When using the `variables:` family of kwargs to `pkgconfig.generate` to refer |
||||
to installed paths, traditionally only `prefix`, `includedir`, and `libdir` |
||||
were available by default, and generating a correct (relocatable) pkg-config |
||||
file required manually constructing variables for e.g. `datadir`. |
||||
|
||||
Meson now checks each variable to see if it begins with a reference to a |
||||
standard directory, and if so, adds it to the list of directories for which a |
||||
builtin variable is created. |
||||
|
||||
For example, before it was necessary to do this: |
||||
```meson |
||||
pkgconfig.generate( |
||||
name: 'bash-completion', |
||||
description: 'programmable completion for the bash shell', |
||||
dataonly: true, |
||||
variables: { |
||||
'prefix': get_option('prefix'), |
||||
'datadir': join_paths('${prefix}', get_option('datadir')), |
||||
'sysconfdir': join_paths('${prefix}', get_option('sysconfdir')), |
||||
|
||||
'compatdir': '${sysconfdir}/bash_completion.d', |
||||
'completionsdir': '${datadir}/bash-completion/completions', |
||||
'helpersdir': '${datadir}/bash-completion/helpers', |
||||
}, |
||||
install_dir: join_paths(get_option('datadir'), 'pkgconfig'), |
||||
) |
||||
``` |
||||
|
||||
Now the first three variables are not needed. |
Loading…
Reference in new issue