| 1 |
--- |
| 2 |
short-description: Setting up native compilation |
| 3 |
... |
| 4 |
|
| 5 |
# Persistent native environments |
| 6 |
|
| 7 |
New in 0.49.0 |
| 8 |
|
| 9 |
Meson has [cross files for describing cross compilation |
| 10 |
environments](Cross-compilation.md), for describing native |
| 11 |
environments it has equivalent "native files". |
| 12 |
|
| 13 |
Natives describe the *build machine*, and can be used to override |
| 14 |
properties of non-cross builds, as well as properties that are marked |
| 15 |
as "native" in a cross build. |
| 16 |
|
| 17 |
There are a couple of reasons you might want to use a native file to |
| 18 |
keep a persistent environment: |
| 19 |
|
| 20 |
* To build with a non-default native tool chain (such as clang instead of gcc) |
| 21 |
* To use a non-default version of another binary, such as yacc, or llvm-config |
| 22 |
|
| 23 |
## Using a native file |
| 24 |
|
| 25 |
During the `setup` phase, use the native file as such: |
| 26 |
```sh |
| 27 |
meson setup --native-file my-native-file.ini builddir/ |
| 28 |
``` |
| 29 |
|
| 30 |
## Changing native file settings |
| 31 |
|
| 32 |
All of the rules about cross files and changed settings apply to native files |
| 33 |
as well, see [here](Cross-compilation.md#changing-cross-file-settings) |
| 34 |
|
| 35 |
## Defining the environment |
| 36 |
|
| 37 |
See the [config-files section](Machine-files.md), for options shared by cross |
| 38 |
and native files. |
| 39 |
|
| 40 |
## Native file locations |
| 41 |
|
| 42 |
Like cross files, native files may be installed to user or system wide |
| 43 |
locations, defined as: |
| 44 |
- $XDG_DATA_DIRS/meson/native |
| 45 |
(/usr/local/share/meson/native:/usr/share/meson/native if $XDG_DATA_DIRS is |
| 46 |
undefined) |
| 47 |
- $XDG_DATA_HOME/meson/native ($HOME/.local/share/meson/native if |
| 48 |
$XDG_DATA_HOME is undefined) |
| 49 |
|
| 50 |
The order of locations tried is as follows: |
| 51 |
- A file relative to the local dir |
| 52 |
- The user local location |
| 53 |
- The system wide locations in order |
| 54 |
|
| 55 |
These files are not intended to be shipped by distributions, unless |
| 56 |
they are specifically for distribution packaging, they are mainly |
| 57 |
intended for developers. |