mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-02-19 19:10:18 +02:00
parent
77f97a6092
commit
8d9a693843
@ -597,14 +597,14 @@ Builds environment variables accept templates.
|
||||
You can leverage that to have a single build configuration with different
|
||||
environment variables for each platform, for example.
|
||||
|
||||
A common example of this is the variables `CC` and `CCX`.
|
||||
A common example of this is the variables `CC` and `CXX`.
|
||||
|
||||
Here are two different examples:
|
||||
|
||||
### Using multiple envs
|
||||
|
||||
This example creates once `CC_` and `CCX_` variable for each platform, and then
|
||||
set `CC` and `CCX` to the right one:
|
||||
This example creates once `CC_` and `CXX_` variable for each platform, and then
|
||||
set `CC` and `CXX` to the right one:
|
||||
|
||||
```yaml
|
||||
# .goreleaser.yml
|
||||
@ -622,18 +622,18 @@ builds:
|
||||
env:
|
||||
- CGO_ENABLED=0
|
||||
- CC_darwin_amd64=o64-clang
|
||||
- CCX_darwin_amd64=o64-clang+
|
||||
- CXX_darwin_amd64=o64-clang+
|
||||
- CC_darwin_arm64=aarch64-apple-darwin20.2-clang
|
||||
- CCX_darwin_arm64=aarch64-apple-darwin20.2-clang++
|
||||
- CXX_darwin_arm64=aarch64-apple-darwin20.2-clang++
|
||||
- CC_windows_amd64=x86_64-w64-mingw32-gc
|
||||
- CCX_windows_amd64=x86_64-w64-mingw32-g++
|
||||
- CXX_windows_amd64=x86_64-w64-mingw32-g++
|
||||
- 'CC={{ index .Env (print "CC_" .Os "_" .Arch) }}'
|
||||
- 'CCX={{ index .Env (print "CCX_" .Os "_" .Arch) }}'
|
||||
- 'CXX={{ index .Env (print "CXX_" .Os "_" .Arch) }}'
|
||||
```
|
||||
|
||||
### Using `if` statements
|
||||
|
||||
This example uses `if` statements to set `CC` and `CCX`:
|
||||
This example uses `if` statements to set `CC` and `CXX`:
|
||||
|
||||
```yaml
|
||||
# .goreleaser.yml
|
||||
|
Loading…
x
Reference in New Issue
Block a user