docs: Update documentation for add_*_script

pull/7060/head
Dylan Baker 5 years ago
parent c239ce31f5
commit 81f35f1549
  1. 7
      docs/markdown/Reference-manual.md
  2. 24
      docs/markdown/snippets/add_foo_script_type_additions.md

@ -1735,6 +1735,8 @@ the following methods.
0.49.0, the function only accepted a single argument. Since 0.54.0 0.49.0, the function only accepted a single argument. Since 0.54.0
the `MESON_SOURCE_ROOT` and `MESON_BUILD_ROOT` environment variables the `MESON_SOURCE_ROOT` and `MESON_BUILD_ROOT` environment variables
are set when dist scripts are run. are set when dist scripts are run.
*(Since 0.55.0)* The output of `configure_file`, `files`, and `find_program`
as well as strings.
- `add_install_script(script_name, arg1, arg2, ...)` causes the script - `add_install_script(script_name, arg1, arg2, ...)` causes the script
given as an argument to be run during the install step, this script given as an argument to be run during the install step, this script
@ -1742,6 +1744,9 @@ the following methods.
`MESON_BUILD_ROOT`, `MESON_INSTALL_PREFIX`, `MESON_BUILD_ROOT`, `MESON_INSTALL_PREFIX`,
`MESON_INSTALL_DESTDIR_PREFIX`, and `MESONINTROSPECT` set. `MESON_INSTALL_DESTDIR_PREFIX`, and `MESONINTROSPECT` set.
All positional arguments are passed as parameters. All positional arguments are passed as parameters.
*(Since 0.55.0)* The output of `configure_file`, `files`, `find_program`,
`custom_target`, indexes of `custom_target`, `executable`, `library`, and
other built targets as well as strings.
*(added 0.54)* If `meson install` is called with the `--quiet` option, the *(added 0.54)* If `meson install` is called with the `--quiet` option, the
environment variable `MESON_INSTALL_QUIET` will be set. environment variable `MESON_INSTALL_QUIET` will be set.
@ -1772,6 +1777,8 @@ the following methods.
executable given as an argument after all project files have been executable given as an argument after all project files have been
generated. This script will have the environment variables generated. This script will have the environment variables
`MESON_SOURCE_ROOT` and `MESON_BUILD_ROOT` set. `MESON_SOURCE_ROOT` and `MESON_BUILD_ROOT` set.
*(Since 0.55.0)* The output of `configure_file`, `files`, and `find_program`
as well as strings.
- `backend()` *(added 0.37.0)* returns a string representing the - `backend()` *(added 0.37.0)* returns a string representing the
current backend: `ninja`, `vs2010`, `vs2015`, `vs2017`, `vs2019`, current backend: `ninja`, `vs2010`, `vs2015`, `vs2017`, `vs2019`,

@ -0,0 +1,24 @@
## meson.add_*_script methods accept new types
All three (`add_install_script`, `add_dist_script`, and
`add_postconf_script`) now accept ExternalPrograms (as returned by
`find_program`), Files, and the output of `configure_file`. The dist and
postconf methods cannot accept other types because of when they are run.
While dist could, in theory, take other dependencies, it would require more
extensive changes, particularly to the backend.
```meson
meson.add_install_script(find_program('foo'), files('bar'))
meson.add_dist_script(find_program('foo'), files('bar'))
meson.add_postconf_script(find_program('foo'), files('bar'))
```
The install script variant is also able to accept custom_targets,
custom_target indexes, and build targets (executables, libraries), and can
use built executables a the script to run
```meson
installer = executable('installer', ...)
meson.add_install_script(installer, ...)
meson.add_install_script('foo.py', installer)
```
Loading…
Cancel
Save