From cc90cdc6dfd7409cbb822f7a0da38f48ae8067e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Date: Mon, 17 Mar 2025 19:28:54 +0100 Subject: [PATCH] docs: Update to reference `host_platform` instead of `target_platform` Update the documentation throughout to replace the references to `target_platform` with `host_platform` where appropriate. That said, unless I've missed some fine point, this means pretty much everywhere. --- docs/compilers.md | 6 +++--- docs/index.md | 2 +- docs/reference/jinja.md | 12 ++++++------ docs/selectors.md | 19 ++++++++++--------- docs/tutorials/rust.md | 2 +- 5 files changed, 21 insertions(+), 20 deletions(-) diff --git a/docs/compilers.md b/docs/compilers.md index b4bd43240..2e0e61375 100644 --- a/docs/compilers.md +++ b/docs/compilers.md @@ -3,7 +3,7 @@ To use a compiler in your project, it's best to use the `${{ compiler('lang') }}` template function. The compiler function works by taking a language, determining the configured compiler for that language, and adding some -information about the target platform to the selected compiler. To configure a +information about the host platform to the selected compiler. To configure a compiler for a specific language, the `variant_config.yaml` file can be used. For example, in a recipe that uses a C-compiler, you can use the following code: @@ -35,7 +35,7 @@ variant config. Cross-compilation is supported by `rattler-build` and the compiler template function is part of what makes it possible. When you want to cross-compile from -`linux-64` to `linux-aarch64` (i.e. intel to ARM), you can pass `--target-platform +`linux-64` to `linux-aarch64` (i.e. intel to ARM), you can pass `--host-platform linux-aarch64` to the `rattler-build` command. This will cause the compiler template function to select a compiler that is configured for `linux-aarch64`. The above example would resolve to `gcc_linux-aarch64 9.3.0`. Provided that the @@ -57,7 +57,7 @@ build: - cmake - ${{ compiler('c') }} # packages that we want to link against in the architecture we are -# cross-compiling to the target_platform +# cross-compiling to the host_platform host: - libcurl - openssl diff --git a/docs/index.md b/docs/index.md index 7a3b74162..932d4345b 100644 --- a/docs/index.md +++ b/docs/index.md @@ -324,7 +324,7 @@ For the `curl` library recipe, two additional script files (`build.sh` and `buil # Get an updated config.sub and config.guess cp $BUILD_PREFIX/share/libtool/build-aux/config.* . -if [[ $target_platform =~ linux.* ]]; then +if [[ $host_platform =~ linux.* ]]; then USESSL="--with-openssl=${PREFIX}" else USESSL="--with-secure-transport" diff --git a/docs/reference/jinja.md b/docs/reference/jinja.md index 571212c9e..7129b34f1 100644 --- a/docs/reference/jinja.md +++ b/docs/reference/jinja.md @@ -8,11 +8,11 @@ functions and filters that can be used in the recipe. ### The compiler function The compiler function can be used to put together a compiler that works for the -current platform and the compilation "`target_platform`". The syntax looks like: +current platform and the compilation "`host_platform`". The syntax looks like: `${{ compiler('c') }}` where `'c'` signifies the programming language that is used. -This function evaluates to `_ `. +This function evaluates to `_ `. For example, when compiling _on_ `linux` and _to_ `linux-64`, this function evaluates to `gcc_linux-64`. @@ -38,9 +38,9 @@ c_compiler_version: ``` The variables shown above would select the `clang` compiler in version `9.0`. -Note that the final output will still contain the `target_platform`, so that the +Note that the final output will still contain the `host_platform`, so that the full compiler will read `clang_linux-64 9.0` when compiling with -`--target-platform linux-64`. +`--host-platform linux-64`. `rattler-build` defines some default compilers for the following languages (inherited from `conda-build`): @@ -54,11 +54,11 @@ full compiler will read `clang_linux-64 9.0` when compiling with The `stdlib` function closely mirrors the compiler function. It can be used to put together a standard library that works for the current platform and the -compilation "`target_platform`". +compilation "`host_platform`". Usage: `${{ stdlib('c') }}` -Results in `_ `. And uses the variant +Results in `_ `. And uses the variant variables `_stdlib` and `_stdlib_version` to influence the output. #### Usage in a recipe: diff --git a/docs/selectors.md b/docs/selectors.md index 9b52d25b7..58a121086 100644 --- a/docs/selectors.md +++ b/docs/selectors.md @@ -54,7 +54,7 @@ host: Other examples often found in the wild: ```yaml -if: build_platform != target_platform ... # true if cross-platform build +if: build_platform != host_platform ... # true if cross-platform build if: osx and arm64 ... # true for apple silicon (osx-arm64) if: linux and (aarch64 or ppc64le)) ... # true for linux ppc64le or linux-aarch64 ``` @@ -65,12 +65,13 @@ The following variables are available during rendering of the recipe: | Variable | Description | |----------------------|------------------------------------------------------------------------| -| `target_platform` | the configured `target_platform` for the build | | `build_platform` | the configured `build_platform` for the build | -| `linux` | "true" if `target_platform` is Linux | -| `osx` | "true" if `target_platform` is OSX / macOS | -| `win` | "true" if `target_platform` is Windows | -| `unix` | "true" if `target_platform` is a Unix (macOS or Linux) | +| `host_platform` | the configured `host_platform` for the build | +| `target_platform` | the configured `target_platform` for the build | +| `linux` | "true" if `host_platform` is Linux | +| `osx` | "true" if `host_platform` is OSX / macOS | +| `win` | "true" if `host_platform` is Windows | +| `unix` | "true" if `host_platform` is a Unix (macOS or Linux) | | `x86`, `x86_64` | x86 32/64-bit Architecture | | `aarch64`, `arm64` | 64-bit Arm (these are the same but are both supported for legacy) | | `armV6l`, `armV7l` | 32-bit Arm | @@ -149,9 +150,9 @@ Some notable options are: ```yaml - if: python == "3.8" # equal - if: python != "3.8" # not equal -- if: python and linux # true if python variant is set and the target_platform is linux -- if: python and not linux # true if python variant is set and the target_platform is not linux -- if: python and (linux or osx) # true if python variant is set and the target_platform is linux or osx +- if: python and linux # true if python variant is set and the host_platform is linux +- if: python and not linux # true if python variant is set and the host_platform is not linux +- if: python and (linux or osx) # true if python variant is set and the host_platform is linux or osx ``` [minijinja]: https://github.com/mitsuhiko/minijinja diff --git a/docs/tutorials/rust.md b/docs/tutorials/rust.md index 692135cfd..c3a838108 100644 --- a/docs/tutorials/rust.md +++ b/docs/tutorials/rust.md @@ -41,7 +41,7 @@ about: !!! note The `${{ compiler(...) }}` functions are very useful in the context of cross-compilation. - When the function is evaluated it will insert the correct compiler (as selected with the variant config) as well the `target_platform`. + When the function is evaluated it will insert the correct compiler (as selected with the variant config) as well the `host_platform`. The "rendered" compiler will look like `rust_linux-64` when you are targeting the `linux-64` platform. You can read more about this in the [cross-compilation](../compilers.md) section.