Skip to content

Commit

Permalink
CI: Add release build for x86h-apple-darwin
Browse files Browse the repository at this point in the history
Signed-off-by: Jiahao XU <[email protected]>
  • Loading branch information
NobodyXu committed Aug 2, 2023
1 parent b70cb9b commit 3689021
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 7 deletions.
1 change: 1 addition & 0 deletions .github/workflows/release-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ jobs:
matrix:
include:
- { o: macos-latest, t: x86_64-apple-darwin, r: true }
- { o: macos-latest, t: x86_64h-apple-darwin, }
- { o: macos-latest, t: aarch64-apple-darwin }
- { o: ubuntu-latest, t: x86_64-unknown-linux-gnu, g: 2.17, r: true, c: true }
- { o: ubuntu-latest, t: armv7-unknown-linux-gnueabihf, g: 2.17, c: true }
Expand Down
24 changes: 17 additions & 7 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ override-features := env_var_or_default("JUST_OVERRIDE_FEATURES", "")
glibc-version := env_var_or_default("GLIBC_VERSION", "")
use-auditable := env_var_or_default("JUST_USE_AUDITABLE", "")
timings := env_var_or_default("JUST_TIMINGS", "")
build-std := env_var_or_default("JUST_BUILD_STD", "")

export BINSTALL_LOG_LEVEL := if env_var_or_default("RUNNER_DEBUG", "0") == "1" { "debug" } else { "info" }
export BINSTALL_RATE_LIMIT := "30/1"
Expand Down Expand Up @@ -55,9 +56,11 @@ ci-or-no := if ci != "" { "ci" } else { "noci" }

# In release builds in CI, build the std library ourselves so it uses our
# compile profile, and optimise panic messages out with immediate abort.
cargo-buildstd := "" #if (cargo-profile / ci-or-no) == "release/ci" {
#" -Z build-std=std,panic_abort -Z build-std-features=panic_immediate_abort"
#} else { "" }
cargo-buildstd := if build-std != "" {
" -Z build-std=std,panic_abort -Z build-std-features=panic_immediate_abort"
} else if target == "x86_64h-apple-darwin" {
" -Z build-std=std,panic_abort -Z build-std-features=panic_immediate_abort"
}else { "" }

# In musl release builds in CI, statically link gcclibs.
rustc-gcclibs := if (cargo-profile / ci-or-no / target-libc) == "release/ci/musl" {
Expand All @@ -80,6 +83,8 @@ support-pkg-config := if target == target-host {
# ",zlib-ng"
git-max-perf-feature := if target == "x86_64-apple-darwin" {
",zlib-ng"
} else if target == "x86_64h-apple-darwin" {
",zlib-ng"
} else if target == "aarch64-apple-darwin" {
",zlib-ng"
} else if target-os == "windows" {
Expand Down Expand Up @@ -185,10 +190,15 @@ ci-install-deps:
[windows]
ci-install-deps:

toolchain components="":
rustup toolchain install stable {{ if components != "" { "--component " + components } else { "" } }} --no-self-update --profile minimal
{{ if ci != "" { "rustup default stable" } else { "rustup override set stable" } }}
{{ if target != "" { "rustup target add " + target } else { "" } }}
toolchain-name := if cargo-buildstd != "" { "nightly" } else { "stable" }
# x86_64h-apple-darwin does not contain pre-built libstd, instead we will
# install rust-src and use build-std to build it.
target-name := if target == "x86_64h-apple-darwin" { "" } else { target }
default-components := if cargo-buildstd != "" { "rust-src" } else { "" }

toolchain components=default-components:
rustup toolchain install {{toolchain-name}} {{ if components != "" { "--component " + components } else { "" } }} --no-self-update --profile minimal {{ if target-name != "" { "--target " + target-name } else { "" } }}
rustup override set {{toolchain-name}}

print-env:
@echo "env RUSTFLAGS='$RUSTFLAGS', CARGO='$CARGO'"
Expand Down

0 comments on commit 3689021

Please sign in to comment.