Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions docs/compilers.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
12 changes: 6 additions & 6 deletions docs/reference/jinja.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 `<compiler>_<target_platform> <compiler_version>`.
This function evaluates to `<compiler>_<host_platform> <compiler_version>`.
For example, when compiling _on_ `linux` and _to_ `linux-64`, this function
evaluates to `gcc_linux-64`.

Expand All @@ -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`):
Expand All @@ -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 `<stdlib>_<target_platform> <stdlib_version>`. And uses the variant
Results in `<stdlib>_<host_platform> <stdlib_version>`. And uses the variant
variables `<lang>_stdlib` and `<lang>_stdlib_version` to influence the output.

#### Usage in a recipe:
Expand Down
19 changes: 10 additions & 9 deletions docs/selectors.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```
Expand All @@ -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 |
Expand Down Expand Up @@ -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
2 changes: 1 addition & 1 deletion docs/tutorials/rust.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down