diff options
author | Eli Schwartz <eschwartz@archlinux.org> | 2022-02-11 14:48:30 -0500 |
---|---|---|
committer | Eli Schwartz <eschwartz@archlinux.org> | 2022-02-15 16:50:41 -0500 |
commit | 6240920c213fb76b4e4be8b6b59ae3346cbbcf77 (patch) | |
tree | 33ea225046c625f5942cf1972df9e52a17992482 /docs/markdown/snippets | |
parent | 2d56ff135e6e0f3cdf455797a6561796a8c1b7b4 (diff) | |
download | meson-6240920c213fb76b4e4be8b6b59ae3346cbbcf77.zip meson-6240920c213fb76b4e4be8b6b59ae3346cbbcf77.tar.gz meson-6240920c213fb76b4e4be8b6b59ae3346cbbcf77.tar.bz2 |
pkgconfig module: allow custom variables to reference builtin directories
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
248e6cf4736ef9ec636228da66c28f9be03aa74f 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.
Diffstat (limited to 'docs/markdown/snippets')
-rw-r--r-- | docs/markdown/snippets/pkgconfig_directory_variables.md | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/docs/markdown/snippets/pkgconfig_directory_variables.md b/docs/markdown/snippets/pkgconfig_directory_variables.md new file mode 100644 index 0000000..27a4069 --- /dev/null +++ b/docs/markdown/snippets/pkgconfig_directory_variables.md @@ -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. |