aboutsummaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
Diffstat (limited to 'docs')
-rw-r--r--docs/markdown/Builtin-options.md3
-rw-r--r--docs/markdown/Native-environments.md2
-rw-r--r--docs/markdown/Reference-manual.md13
-rw-r--r--docs/markdown/Reference-tables.md3
-rw-r--r--docs/markdown/Release-notes-for-0.38.0.md24
-rw-r--r--docs/markdown/Release-notes-for-0.43.0.md14
-rw-r--r--docs/markdown/Release-notes-for-0.45.0.md3
-rw-r--r--docs/markdown/Release-notes-for-0.48.0.md21
-rw-r--r--docs/markdown/Release-notes-for-0.49.0.md4
-rw-r--r--docs/markdown/Syntax.md8
-rw-r--r--docs/markdown/Vala.md251
11 files changed, 290 insertions, 56 deletions
diff --git a/docs/markdown/Builtin-options.md b/docs/markdown/Builtin-options.md
index ce14304..3ab2380 100644
--- a/docs/markdown/Builtin-options.md
+++ b/docs/markdown/Builtin-options.md
@@ -12,7 +12,8 @@ universal options, base options, compiler options.
A list of these options can be found by running `meson --help`. All
these can be set by passing to `meson` (aka `meson setup`) in any of
-these ways: `--option=value`, `--option value`, `-Doption=value`.
+these ways: `--option=value`, `--option value`, `-Doption=value`, or
+by setting them inside `default_options` of `project()` in your `meson.build`.
They can also be edited after setup using `meson configure`.
diff --git a/docs/markdown/Native-environments.md b/docs/markdown/Native-environments.md
index af7edd2..a9719a7 100644
--- a/docs/markdown/Native-environments.md
+++ b/docs/markdown/Native-environments.md
@@ -40,7 +40,7 @@ like `llvm-config`
c = '/usr/local/bin/clang'
cpp = '/usr/local/bin/clang++'
rust = '/usr/local/bin/rust'
-llvm-conifg = '/usr/local/llvm-svn/bin/llvm-config'
+llvm-config = '/usr/local/llvm-svn/bin/llvm-config'
```
## Loading multiple native files
diff --git a/docs/markdown/Reference-manual.md b/docs/markdown/Reference-manual.md
index a3166e5..2fc61d5 100644
--- a/docs/markdown/Reference-manual.md
+++ b/docs/markdown/Reference-manual.md
@@ -264,7 +264,7 @@ following.
- `build_always` (deprecated) if `true` this target is always considered out of
date and is rebuilt every time. Equivalent to setting both
`build_always_stale` and `build_by_default` to true.
-- `build_always_stale` if `true` the target is always considered out of date.
+- `build_always_stale` *(added 0.47)* if `true` the target is always considered out of date.
Useful for things such as build timestamps or revision control tags.
The associated command is run even if the outputs are up to date.
- `capture`, there are some compilers that can't be told to write
@@ -928,6 +928,10 @@ format and optionally the owner/uid and group/gid for the installed files.
An example value could be `['rwxr-sr-x', 'root', 'root']`.
*(Added 0.47.0)*.
+Since 0.49.0, [manpages are no longer compressed implicitly][install_man_49].
+
+[install_man_49]: https://mesonbuild.com/Release-notes-for-0-49-0.html#manpages-are-no-longer-compressed-implicitly
+
### install_subdir()
``` meson
@@ -1018,6 +1022,9 @@ Joins the given strings into a file system path segment. For example
individual segments is an absolute path, all segments before it are
dropped. That means that `join_paths('foo', '/bar')` returns `/bar`.
+**Warning** Don't use `join_paths()` for sources in [`library`](#library) and
+[`executable`](#executable), you should use [`files`](#files) instead.
+
*Added 0.36.0*
Since 0.49.0 using the`/` operator on strings is equivalent to calling
@@ -2066,6 +2073,10 @@ an external dependency with the following methods:
- `found()` which returns whether the dependency was found
+ - `name()` *(Added 0.48.0)* returns the name of the dependency that was
+ searched. Returns `internal` for dependencies created with
+ `declare_dependency()`.
+
- `get_pkgconfig_variable(varname)` *(Added 0.36.0)* will get the
pkg-config variable specified, or, if invoked on a non pkg-config
dependency, error out. *(Added 0.44.0)* You can also redefine a
diff --git a/docs/markdown/Reference-tables.md b/docs/markdown/Reference-tables.md
index b561e86..fa913f5 100644
--- a/docs/markdown/Reference-tables.md
+++ b/docs/markdown/Reference-tables.md
@@ -59,6 +59,7 @@ set in the cross file.
| ppc64 | 64 bit PPC processors |
| riscv32 | 32 bit RISC-V Open ISA|
| riscv64 | 64 bit RISC-V Open ISA|
+| rl78 | Renesas RL78 |
| rx | Renesas RX 32 bit MCU |
| s390x | IBM zSystem s390x |
| sparc | 32 bit SPARC |
@@ -116,6 +117,8 @@ These are the parameter names for passing language specific arguments to your bu
These environment variables will be used to modify the compiler and
linker flags.
+| Name | Comment |
+| ----- | ------- |
| CFLAGS | Flags for the C compiler |
| CXXFLAGS | Flags for the C++ compiler |
| OBJCFLAGS | Flags for the Objective C compiler |
diff --git a/docs/markdown/Release-notes-for-0.38.0.md b/docs/markdown/Release-notes-for-0.38.0.md
index 741c349..cbd8fff 100644
--- a/docs/markdown/Release-notes-for-0.38.0.md
+++ b/docs/markdown/Release-notes-for-0.38.0.md
@@ -3,11 +3,11 @@ title: Release 0.38
short-description: Release notes for 0.38
...
-# Uninstall target
+## Uninstall target
Meson allows you to uninstall an install step by invoking the uninstall target. This will remove all files installed as part of install. Note that this does not restore the original files. This also does not undo changes done by custom install scripts (because they can do arbitrary install operations).
-# Support for arbitrary test setups
+## Support for arbitrary test setups
Sometimes you need to run unit tests with special settings. For example under Valgrind. Usually this requires extra command line options for the tool. This is supported with the new *test setup* feature. For example to set up a test run with Valgrind, you'd write this in a `meson.build` file:
@@ -23,11 +23,11 @@ This tells Meson to run tests with Valgrind using the given options and multiply
$ mesontest --setup=valgrind
```
-# Intel C/C++ compiler support
+## Intel C/C++ compiler support
As usual, just set `CC=icc CXX=icpc` and Meson will use it as the C/C++ compiler. Currently only Linux is supported.
-# Get values from configuration data objects
+## Get values from configuration data objects
Now it is possible to query values stored in configuration data objects.
@@ -38,7 +38,7 @@ cdata.get('nokey', 'default') # returns 'default'
cdata.get('nokey') # halts with an error
```
-# Python 3 module support
+## Python 3 module support
Building Python 3 extension modules has always been possible, but it is now even easier:
@@ -49,7 +49,7 @@ pylib = py3_mod.extension_module('modname',
dependencies : py3_dep)
```
-# Default options to subprojects
+## Default options to subprojects
Projects can specify overriding values for subprojects' `default_options` when invoking a subproject:
@@ -60,23 +60,23 @@ dependency('some-dep', fallback : ['some_subproject', 'some_dep'], default_optio
The effect is the same as if the default options were written in the subproject's `project` call.
-# Set targets to be built (or not) by default
+## Set targets to be built (or not) by default
Build targets got a new keyword `build_by_default` which tells whether the target should be built by default when running e.g. `ninja`. Custom targets are not built by default but other targets are. Any target that is tagged as installed or to be built always is also built by default, regardless of the value of this keyword.
-# Add option to mesonconf to wipe cached data.
+## Add option to mesonconf to wipe cached data.
Meson caches the results of dependency lookups. Sometimes these may get out of sync with the system state. Mesonconf now has a `--clearcache` option to clear these values so they will be re-searched from the system upon next compile.
-# Can specify file permissions and owner when installing data
+## Can specify file permissions and owner when installing data
The new `install_mode` keyword argument can be used to specify file permissions and uid/gid of files when doing the install. This allows you to, for example, install suid root scripts.
-# `has_header()` checks are now faster
+## `has_header()` checks are now faster
When using compilers that implement the [`__has_include()` preprocessor macro](https://clang.llvm.org/docs/LanguageExtensions.html#include-file-checking-macros), the check is now ~40% faster.
-# Array indexing now supports fallback values
+## Array indexing now supports fallback values
The second argument to the array [`.get()`](Reference-manual.md#array-object) function is now returned if the specified index could not be found
```meson
@@ -86,6 +86,6 @@ array.get(4) # this will give an error about invalid index
array.get(4, 0) # this will return `0`
```
-# Silent mode for Mesontest
+## Silent mode for Mesontest
The Meson test executor got a new argument `-q` (and `--quiet`) that suppresses all output of successful tests. This makes interactive usage nicer because only errors are printed.
diff --git a/docs/markdown/Release-notes-for-0.43.0.md b/docs/markdown/Release-notes-for-0.43.0.md
index 7702f3c..0ca66ae 100644
--- a/docs/markdown/Release-notes-for-0.43.0.md
+++ b/docs/markdown/Release-notes-for-0.43.0.md
@@ -3,7 +3,7 @@ title: Release 0.43
short-description: Release notes for 0.43
...
-# Portability improvements to Boost Dependency
+## Portability improvements to Boost Dependency
The Boost dependency has been improved to better detect the various ways to
install boost on multiple platforms. At the same time the `modules` semantics
@@ -14,12 +14,12 @@ used to specify libraries that require linking.
This is a breaking change and the fix is to remove all modules that aren't
found.
-# Generator learned capture
+## Generator learned capture
Generators can now be configured to capture the standard output. See
`test cases/common/98 gen extra/meson.build` for an example.
-# Can index CustomTarget objects
+## Can index CustomTarget objects
The `CustomTarget` object can now be indexed like an array. The resulting
object can be used as a source file for other Targets, this will create a
@@ -43,7 +43,7 @@ exec = executable(
)
```
-# Can override executables in the cross file
+## Can override executables in the cross file
The cross file can now be used for overriding the result of
`find_program`. As an example if you want to find the `objdump`
@@ -63,7 +63,7 @@ objdump, you can specify the `native` keyword like this:
native_objdump = find_program('objdump', native : true)
```
-# Easier handling of supported compiler arguments
+## Easier handling of supported compiler arguments
A common pattern for handling multiple desired compiler arguments, was to
test their presence and add them to an array one-by-one, e.g.:
@@ -91,7 +91,7 @@ warning_flags = [ ... ]
flags = cc.get_supported_arguments(warning_flags)
```
-# Better support for shared libraries in non-system paths
+## Better support for shared libraries in non-system paths
Meson has support for prebuilt object files and static libraries.
This release adds feature parity to shared libraries that are either
@@ -114,7 +114,7 @@ mydep = declare_dependency(include_directories : include_directories('.'),
Then you can use the dependency object in the same way as any other.
-# wrap-svn
+## wrap-svn
The [Wrap dependency system](Wrap-dependency-system-manual.md) now
supports [Subversion](https://subversion.apache.org/) (svn). This
diff --git a/docs/markdown/Release-notes-for-0.45.0.md b/docs/markdown/Release-notes-for-0.45.0.md
index 19d65b8..2b67f9b 100644
--- a/docs/markdown/Release-notes-for-0.45.0.md
+++ b/docs/markdown/Release-notes-for-0.45.0.md
@@ -176,7 +176,8 @@ defined in it.
## Can use custom targets as Windows resource files
The `compile_resources()` function of the `windows` module can now be used on custom targets as well as regular files.
-# Can promote dependencies with wrap command
+
+## Can promote dependencies with wrap command
The `promote` command makes it easy to copy nested dependencies to the top level.
diff --git a/docs/markdown/Release-notes-for-0.48.0.md b/docs/markdown/Release-notes-for-0.48.0.md
index 270a689..80fc08b 100644
--- a/docs/markdown/Release-notes-for-0.48.0.md
+++ b/docs/markdown/Release-notes-for-0.48.0.md
@@ -311,3 +311,24 @@ clone-recursive=true
This allows you to declare an optional subproject. You can now call `found()`
on the return value of the `subproject()` call to see if the subproject is
available before calling `get_variable()` to fetch information from it.
+
+## `dependency()` objects now support the `.name()` method
+
+You can now fetch the name of the dependency that was searched like so:
+
+```meson
+glib_dep = dependency('glib-2.0')
+...
+message("dependency name is " + glib_dep.name())
+# This outputs `dependency name is glib-2.0`
+
+qt_dep = dependency('qt5')
+...
+message("dependency name is " + qt_dep.name())
+# This outputs `dependency name is qt5`
+
+decl_dep = declare_dependency()
+...
+message("dependency name is " + decl_dep.name())
+# This outputs `dependency name is internal`
+```
diff --git a/docs/markdown/Release-notes-for-0.49.0.md b/docs/markdown/Release-notes-for-0.49.0.md
index 5ccda76..9b0dfaa 100644
--- a/docs/markdown/Release-notes-for-0.49.0.md
+++ b/docs/markdown/Release-notes-for-0.49.0.md
@@ -44,7 +44,9 @@ target specific arguments to the compiler and linker will need to be
added explicitly from the
cross-file(`c_args`/`c_link_args`/`cpp_args`/`cpp_link_args`) or some
other way. Refer to the CC-RX User's manual for additional compiler
-and linker options.## CMake `find_package` dependency backend
+and linker options.
+
+## CMake `find_package` dependency backend
Meson can now use the CMake `find_package` ecosystem to
detect dependencies. Both the old-style `<NAME>_LIBRARIES`
diff --git a/docs/markdown/Syntax.md b/docs/markdown/Syntax.md
index 9ea96c1..cf56dd3 100644
--- a/docs/markdown/Syntax.md
+++ b/docs/markdown/Syntax.md
@@ -216,6 +216,14 @@ path = pathsep.join(['/usr/bin', '/bin', '/usr/local/bin'])
path = join_paths(['/usr', 'local', 'bin'])
# path now has the value '/usr/local/bin'
+# Don't use join_paths for sources files, use files for that:
+my_sources = files('foo.c')
+...
+my_sources += files('bar.c')
+# This has the advantage of always calculating the correct relative path, even
+# if you add files in another directory or use them in a different directory
+# than they're defined in
+
# Example to set an API version for use in library(), install_header(), etc
project('project', 'c', version: '0.2.3')
version_array = meson.project_version().split('.')
diff --git a/docs/markdown/Vala.md b/docs/markdown/Vala.md
index c5d2b79..2184ebc 100644
--- a/docs/markdown/Vala.md
+++ b/docs/markdown/Vala.md
@@ -3,25 +3,147 @@ title: Vala
short-description: Compiling Vala and Genie programs
...
-# Compiling Vala applications
+# Compiling Vala applications and libraries
+Meson supports compiling applications and libraries written in
+[Vala](https://vala-project.org/) and
+[Genie](https://wiki.gnome.org/Projects/Genie) . A skeleton `meson.build` file:
-Meson has support for compiling Vala and Genie programs. A skeleton `meson.build` file for Vala looks like this:
+```meson
+project('vala app', 'vala', 'c')
+
+dependencies = [
+ dependency('glib-2.0'),
+ dependency('gobject-2.0'),
+]
+
+sources = files('app.vala')
+
+executable('app_name', sources, dependencies : dependencies)
+```
+
+You must always specify the `glib-2.0` and `gobject-2.0` libraries as
+dependencies, because all current Vala applications use them.
+[GLib](https://developer.gnome.org/glib/stable/) is used for basic data types
+and [GObject](https://developer.gnome.org/gobject/stable/) is used for the
+runtime type system.
+
+
+## Using libraries
+Meson uses the [`dependency()`](Reference-manual.md#dependency) function to find
+the relevant VAPI, C headers and linker flags when it encounters a Vala source
+file in a build target. Vala needs a VAPI file and a C header or headers to use
+a library. The VAPI file helps map Vala code to the library's C programming
+interface. It is the
+[`pkg-config`](https://www.freedesktop.org/wiki/Software/pkg-config/) tool that
+makes finding these installed files all work seamlessly behind the scenes. When
+a `pkg-config` file doesn't exist for the library then the
+[`find_library()`](Reference-manual.md#find_library) method of the [compiler
+object](Reference-manual.md#compiler-object) needs to be used. Examples are
+given later.
+
+Note Vala uses libraries that follow the C Application Binary Interface (C ABI).
+The library, however, could be written in C, Vala, Rust, Go, C++ or any other
+language that can generate a binary compatible with the C ABI and so provides C
+headers.
+
+
+### The simplest case
+This first example is a simple addition to the `meson.build` file because:
+
+ * the library has a `pkg-config` file, `gtk+-3.0.pc`
+ * the VAPI is distributed with Vala and so installed with the Vala compiler
+ * the VAPI is installed in Vala's standard search path
+ * the VAPI has the same name as the `pkg-config` file, `gtk+-3.0.vapi`
+
+Everything works seamlessly in the background and only a single extra line is
+needed:
```meson
-project('valaprog', 'vala', 'c')
+project('vala app', 'vala', 'c')
-glib_dep = dependency('glib-2.0')
-gobject_dep = dependency('gobject-2.0')
+dependencies = [
+ dependency('glib-2.0'),
+ dependency('gobject-2.0'),
+ dependency('gtk+-3.0'),
+]
-executable('valaprog', 'prog.vala',
- dependencies : [glib_dep, gobject_dep])
+sources = files('app.vala')
+
+executable('app_name', sources, dependencies : dependencies)
```
-You must always specify `glib-2.0` and `gobject-2.0` as dependencies, because all Vala applications use them.
+GTK+ is the graphical toolkit used by GNOME, elementary OS and other desktop
+environments. The binding to the library, the VAPI file, is distributed with
+Vala.
+
+Other libraries may have a VAPI that is distributed with the library itself.
+Such libraries will have their VAPI file installed along with their other
+development files. The VAPI is installed in Vala's standard search path and so
+works just as seamlessly using the `dependency()` function.
+
+
+### Targetting a version of GLib
+Meson's [`dependency()`](Reference-manual.md#dependency) function allows a
+version check of a library. This is often used to check a minimum version is
+installed. When setting a minimum version of GLib, Meson will also pass this to
+the Vala compiler using the `--target-glib` option.
+
+This is needed when using GTK+'s user interface definition files with Vala's
+`[GtkTemplate]`, `[GtkChild]` and `[GtkCallback]` annotations. This requires
+`--target-glib 2.38`, or a newer version, to be passed to Vala. With Meson this
+is simply done with:
+
+```meson
+project('vala app', 'vala', 'c')
+
+dependencies = [
+ dependency('glib-2.0', version: '>=2.38'),
+ dependency('gobject-2.0'),
+ dependency('gtk+-3.0'),
+]
+
+sources = files('app.vala')
-## Using a custom VAPI
+executable('app_name', sources, dependencies : dependencies)
+```
-When dealing with libraries that are not providing Vala bindings, a `--vapidir` flag can be added to extend the search path for the current project.
+Using `[GtkTemplate]` also requires the GTK+ user interface definition files to
+be built in to the binary as GResources. For completeness, the next example
+shows this:
+
+```meson
+project('vala app', 'vala', 'c')
+
+dependencies = [
+ dependency('glib-2.0', version: '>=2.38'),
+ dependency('gobject-2.0'),
+ dependency('gtk+-3.0'),
+]
+
+sources = files('app.vala')
+
+sources += import( 'gnome' ).compile_resources(
+ 'project-resources',
+ 'src/resources/resources.gresource.xml',
+ source_dir: 'src/resources',
+)
+
+executable('app_name', sources, dependencies : dependencies)
+```
+
+
+### Adding to Vala's search path
+So far we have covered the cases where the VAPI file is either distributed with
+Vala or the library. A VAPI can also be included in the source files of your
+project. The convention is to put it in the `vapi` directory of your project.
+
+This is needed when a library does not have a VAPI or your project needs to link
+to another component in the project that uses the C ABI. For example if part of
+the project is written in C.
+
+The Vala compiler's `--vapidir` option is used to add the project directory to
+the VAPI search path. In Meson this is done with the `add_project_arguments()`
+function:
```meson
project('vala app', 'c', 'vala')
@@ -29,53 +151,113 @@ project('vala app', 'c', 'vala')
add_project_arguments(['--vapidir', join_paths(meson.current_source_dir(), 'vapi')],
language: 'vala')
-glib_dep = dependency('glib-2.0')
-gobject_dep = dependency('gobject-2.0')
-foo_dep = dependency('foo') # 'foo.vapi' will be resolved in './vapi/foo.vapi'
+dependencies = [
+ dependency('glib-2.0'),
+ dependency('gobject-2.0'),
+ dependency('foo'), # 'foo.vapi' will be resolved as './vapi/foo.vapi'
+]
-executable('app', 'app.vala', dependencies: [glib_dep, gobject_dep, foo_dep])
+sources = files('app.vala')
+
+executable('app_name', sources, dependencies : dependencies)
```
-In this case, make sure that the VAPI name corresponds to the pkg-config file.
+If the VAPI is for an external library then make sure that the VAPI name
+corresponds to the pkg-config file name.
+
+The [`vala-extra-vapis` repository](https://github.com/nemequ/vala-extra-vapis)
+is a community maintained repository of VAPIs that are not distributed.
+Developers use the repository to share early work on new bindings and
+improvements to existing bindings. So the VAPIs can frequently change. It is
+recommended VAPIs from this repository are copied in to your project's source
+files.
+
+This also works well for starting to write new bindings before they are shared
+with the `vala-extra-vapis` repository.
-If no pkg-config file is provided, you must use `find_library`. Using`declare_dependency` is cleaner because it does not require passing both dependency objects to the target.
+
+### Libraries without pkg-config files
+A library that does not have a corresponding pkg-config file may mean
+`dependency()` is unsuitable for finding the C and Vala interface files. In this
+case it is necessary to use `find_library()`.
+
+The first example uses Vala's POSIX binding. There is no pkg-config file because
+POSIX includes the standard C library on Unix systems. All that is needed is the
+VAPI file, `posix.vapi`. This is included with Vala and installed in Vala's
+standard search path. Meson just needs to be told to only find the library for
+the Vala compiler:
```meson
-foo_lib = meson.get_compiler('c').find_library('foo') # assuming libfoo.so is installed
-foo_vapi = meson.get_compiler('vala').find_library('foo', dirs: join_paths(meson.current_source_dir(), 'vapi'))
-foo_dep = declare_dependency(dependencies: [foo_lib, foo_vapi])
+project('vala app', 'vala', 'c')
-executable('app', 'app.vala', dependencies: [glib_dep, gobject_dep, foo_dep])
-```
+dependencies = [
+ dependency('glib-2.0'),
+ dependency('gobject-2.0'),
+ meson.get_compiler('vala').find_library('posix'),
+]
-## VAPI without pkg-config file
+sources = files('app.vala')
-Some Vala bindings do not need a corresponding pkg-config file and `dependency` is unsuitable for resolving them. It's necessary to use `find_library` in this case.
+executable('app_name', sources, dependencies : dependencies)
+```
+
+The next example shows how to link with a C library where no additional VAPI is
+needed. The standard maths functions are already bound in `glib-2.0.vapi`, but
+the GNU C library requires linking to the maths library separately. In this
+example Meson is told to find the library only for the C compiler:
```meson
-posix_dep = meson.get_compiler('vala').find_library('posix')
+project('vala app', 'vala', 'c')
+
+dependencies = [
+ dependency('glib-2.0'),
+ dependency('gobject-2.0'),
+ meson.get_compiler('c').find_library('m', required: false),
+]
-executable('app', 'app.vala', dependencies: [glib_dep, gobject_dep, posix_dep])
+sources = files('app.vala')
+
+executable('app_name', sources, dependencies : dependencies)
```
-## Custom output names
-If a library target is used, Meson automatically outputs the C header and the VAPI. They can be renamed by setting the `vala_header` and `vala_vapi` arguments respectively. In this case, the second and third elements of the `install_dir` array indicate the destination with `true` to indicate default directories (i.e. `include` and `share/vala/vapi`).
+## Building libraries
+
+
+### Changing C header and VAPI names
+Meson's [`library`](Reference-manual.md#library) target automatically outputs
+the C header and the VAPI. They can be renamed by setting the `vala_header` and
+`vala_vapi` arguments respectively:
```meson
-foo_lib = library('foo', 'foo.vala',
+foo_lib = shared_library('foo', 'foo.vala',
vala_header: 'foo.h',
vala_vapi: 'foo-1.0.vapi',
dependencies: [glib_dep, gobject_dep],
install: true,
install_dir: [true, true, true])
```
+In this example, the second and third elements of the `install_dir` array
+indicate the destination with `true` to use default directories (i.e. `include`
+and `share/vala/vapi`).
+
-## GObject Introspection
+### GObject Introspection and language bindings
+A 'binding' allows another programming language to use a library written in
+Vala. Because Vala uses the GObject type system as its runtime type system it is
+very easy to use introspection to generate a binding. A Meson build of a Vala
+library can generate the GObject introspection metadata. The metadata is then
+used in separate projects with [language specific
+tools](https://wiki.gnome.org/Projects/Vala/LibraryWritingBindings) to generate
+a binding.
-To generate GObject Introspection metadata, the `vala_gir` option has to be set with the desired name.
+The main form of metadata is a GObject Introspection Repository (GIR) XML file.
+GIRs are mostly used by languages that generate bindings at compile time.
+Languages that generate bindings at runtime mostly use a typelib file, which is
+generated from the GIR.
-The fourth element in the `install_dir` array indicate where the GIR file will be installed. The `true` value tells Meson to use the default directory (i.e. `share/gir-1.0`).
+Meson can generate a GIR as part of the build. For a Vala library the
+`vala_gir` option has to be set for the `library`:
```meson
foo_lib = library('foo', 'foo.vala',
@@ -85,7 +267,12 @@ foo_lib = library('foo', 'foo.vala',
install_dir: [true, true, true, true])
```
-For the typelib, use a custom target depending on the library:
+The `true` value in `install_dir` tells Meson to use the default directory (i.e.
+`share/gir-1.0` for GIRs). The fourth element in the `install_dir` array
+indicates where the GIR file will be installed.
+
+To then generate a typelib file use a custom target with the `g-ir-compiler`
+program and a dependency on the library:
```meson
g_ir_compiler = find_program('g-ir-compiler')