Skip to content

Commit

Permalink
ci: combine and export RUSTFLAGS rather than passing inline
Browse files Browse the repository at this point in the history
This cleans things up and allows us to pass more flags externally.
  • Loading branch information
tgross35 committed Nov 20, 2024
1 parent d2e004f commit 20b2eed
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions ci/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ test_target() {
target="${2}"
no_std="${3}"

RUSTFLAGS="${RUSTFLAGS:-}"

# If there is a std component, fetch it:
if [ "${no_std}" != "1" ]; then
# FIXME: rustup often fails to download some artifacts due to network
Expand All @@ -36,15 +38,17 @@ test_target() {
n=$((n+1))
sleep 1
done

# FIXME: With `build-std` feature, `compiler_builtins` emits a lof of lint warnings.
RUSTFLAGS="${RUSTFLAGS:-} -Aimproper_ctypes_definitions"
export RUSTFLAGS
fi

# Test that libc builds without any default features (no std)
if [ "$no_std" != "1" ]; then
cargo "+$rust" "$build_cmd" --no-default-features --target "$target"
else
# FIXME: With `build-std` feature, `compiler_builtins` emits a lof of lint warnings.
RUSTFLAGS="-A improper_ctypes_definitions" \
cargo "+$rust" "$build_cmd" \
cargo "+$rust" "$build_cmd" \
-Z build-std=core,alloc \
--no-default-features \
--target "$target"
Expand All @@ -55,8 +59,7 @@ test_target() {
if [ "$no_std" != "1" ]; then
cargo "+$rust" "$build_cmd" --target "$target"
else
RUSTFLAGS="-A improper_ctypes_definitions" \
cargo "+$rust" "${build_cmd}" \
cargo "+$rust" "${build_cmd}" \
-Z build-std=core,alloc \
--target "$target"
fi
Expand All @@ -68,8 +71,7 @@ test_target() {
--features extra_traits \
--target "$target"
else
RUSTFLAGS="-A improper_ctypes_definitions" \
cargo "+$rust" "$build_cmd" \
cargo "+$rust" "$build_cmd" \
-Z build-std=core,alloc \
--no-default-features \
--features extra_traits \
Expand All @@ -84,8 +86,7 @@ test_target() {
--features const-extern-fn \
--target "$target"
else
RUSTFLAGS="-A improper_ctypes_definitions" \
cargo "+$rust" "$build_cmd" \
cargo "+$rust" "$build_cmd" \
-Z build-std=core,alloc \
--no-default-features \
--features const-extern-fn \
Expand All @@ -99,8 +100,7 @@ test_target() {
--target "$target" \
--features extra_traits
else
RUSTFLAGS="-A improper_ctypes_definitions" \
cargo "+$rust" "$build_cmd" \
cargo "+$rust" "$build_cmd" \
-Z build-std=core,alloc \
--target "$target" \
--features extra_traits
Expand Down

0 comments on commit 20b2eed

Please sign in to comment.