aboutsummaryrefslogtreecommitdiff
path: root/docs/markdown
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2017-11-14 15:08:35 -0800
committerJussi Pakkanen <jpakkane@gmail.com>2017-11-30 22:34:27 +0200
commit6f25e93b524ec827a55c13632c9ff23a20d8d3c2 (patch)
tree5ac3f4638928f8201a8641efaeb8a3263c9ced7d /docs/markdown
parentecba22965d438e94a260c6c5d00a034a8d144904 (diff)
downloadmeson-6f25e93b524ec827a55c13632c9ff23a20d8d3c2.zip
meson-6f25e93b524ec827a55c13632c9ff23a20d8d3c2.tar.gz
meson-6f25e93b524ec827a55c13632c9ff23a20d8d3c2.tar.bz2
cross: Implement support for loading cross files from system paths
One thing that makes cross compiling with meson a pain is the need for cross files. The problem is not with cross files themselves (they're actually rather brilliant in that they allow for a much greater deal of flexibility than autotools hardcoded paths approach) but that each user needs to reimplement them themselves, when for most people what they really want is a cross file that could be provided by their distro, all they really want is the correct toolchain. This patch is the first stop to making it easier for distros to ship their own cross files (and for users to put their's somewhere safe so they don't get `git clean`ed. It allows the cross files (on Linux and *BSD) to be stored in home and system paths (~/.config/meson/cross, /usr/share/meson/cross, and /usr/local/share/meson/cross), and to be loaded by simply by specificying --cross-file. With this patch meson will check the locations its always checked first, (is cross file absolute, or is it relative to $PWD), then will check ~/.config/meson/cross, /usr/local/share/meson/cross, /usr/share/meson/cross, (or $XDG_CONFIG_PATH and $XDG_DATA_DIRS) for the files, raising an exception if it cannot find the specified cross file. Fixes #2283
Diffstat (limited to 'docs/markdown')
-rw-r--r--docs/markdown/Cross-compilation.md26
-rw-r--r--docs/markdown/snippets/system-wide-cross-files.md20
2 files changed, 46 insertions, 0 deletions
diff --git a/docs/markdown/Cross-compilation.md b/docs/markdown/Cross-compilation.md
index f68b1f5..c1ad317 100644
--- a/docs/markdown/Cross-compilation.md
+++ b/docs/markdown/Cross-compilation.md
@@ -257,3 +257,29 @@ then you can access that using the `meson` object like this:
myvar = meson.get_cross_property('somekey')
# myvar now has the value 'somevalue'
```
+
+## Cross file locations
+
+As of version 0.44.0 meson supports loading cross files from system locations
+on Linux and the BSDs. This will be $XDG_DATA_DIRS/meson/cross, or if
+XDG_DATA_DIRS is undefined, then /usr/local/share/meson/cross and
+/usr/share/meson/cross will be tried in that order, for system wide cross
+files. User local files can be put in $XDG_DATA_HOME/meson/cross, or
+~/.local/share/meson/cross if that is undefined.
+
+The order of locations tried is as follows:
+ - A file relative to the local dir
+ - The user local location
+ - The system wide locations in order
+
+Linux and BSD distributions are encouraged to ship cross files either with
+their cross compiler toolchain packages or as a standalone package, and put
+them in one of the system paths referenced above.
+
+These files can be loaded automatically without adding a path to the cross
+file. For example, if a ~/.local/share/meson/cross contains a file called x86-linux,
+then the following command would start a cross build using that cross files:
+
+```sh
+meson builddir/ --cross-file x86-linux
+```
diff --git a/docs/markdown/snippets/system-wide-cross-files.md b/docs/markdown/snippets/system-wide-cross-files.md
new file mode 100644
index 0000000..66c454f
--- /dev/null
+++ b/docs/markdown/snippets/system-wide-cross-files.md
@@ -0,0 +1,20 @@
+## System wide and user local cross files
+
+Meson has gained the ability to load cross files from predefined locations
+without passing a full path on Linux and the BSD OSes. User local files will be
+loaded from `$XDG_DATA_HOME/meson/cross`, or if XDG_DATA_HOME is undefined,
+`~/.local/share/meson/cross` will be used.
+
+For system wide paths the values of `$XDG_DATA_DIRS` + `/meson/cross` will be used,
+if XDG_DATA_DIRS is undefined then `/usr/local/share/meson/cross:/usr/share/meson/cross`
+will be used instead.
+
+A file relative to the current working directory will be tried first, then the
+user specific path will be tried before the system wide paths.
+
+Assuming that a file x86-linux is located in one of those places a cross build
+can be started with:
+
+```sh
+meson builddir/ --cross-file x86-linux
+```