mirror of
https://github.com/rustfs/rustfs.git
synced 2026-07-26 08:18:18 +00:00
build: optimize release profile (#4806)
This commit is contained in:
+6
-2
@@ -353,15 +353,19 @@ debug = "line-tables-only"
|
|||||||
|
|
||||||
[profile.release]
|
[profile.release]
|
||||||
opt-level = 3
|
opt-level = 3
|
||||||
|
lto = "thin"
|
||||||
|
codegen-units = 1
|
||||||
|
debug = 0
|
||||||
|
split-debuginfo = "off"
|
||||||
|
strip = "symbols"
|
||||||
|
|
||||||
[profile.production]
|
[profile.production]
|
||||||
inherits = "release"
|
inherits = "release"
|
||||||
lto = "fat"
|
|
||||||
codegen-units = 1
|
|
||||||
|
|
||||||
[profile.profiling]
|
[profile.profiling]
|
||||||
inherits = "release"
|
inherits = "release"
|
||||||
debug = true
|
debug = true
|
||||||
|
strip = "none"
|
||||||
|
|
||||||
# Pin hyper to a revision that carries the HTTP/1 "flush buffered data before
|
# Pin hyper to a revision that carries the HTTP/1 "flush buffered data before
|
||||||
# shutdown" fix (hyperium/hyper#4018, commit 72046cc7). This lands as a
|
# shutdown" fix (hyperium/hyper#4018, commit 72046cc7). This lands as a
|
||||||
|
|||||||
+2
-2
@@ -217,7 +217,7 @@ setup_rust_environment() {
|
|||||||
# Set up environment variables for musl targets
|
# Set up environment variables for musl targets
|
||||||
if [[ "$PLATFORM" == *"musl"* ]]; then
|
if [[ "$PLATFORM" == *"musl"* ]]; then
|
||||||
print_message $YELLOW "Setting up environment for musl target..."
|
print_message $YELLOW "Setting up environment for musl target..."
|
||||||
export RUSTFLAGS="--cfg tokio_unstable -C target-feature=-crt-static"
|
export RUSTFLAGS="${RUSTFLAGS:+$RUSTFLAGS }-C target-feature=-crt-static"
|
||||||
|
|
||||||
# For cargo-zigbuild, set up additional environment variables
|
# For cargo-zigbuild, set up additional environment variables
|
||||||
if command -v cargo-zigbuild &> /dev/null; then
|
if command -v cargo-zigbuild &> /dev/null; then
|
||||||
@@ -434,7 +434,7 @@ build_binary() {
|
|||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
# Native compilation
|
# Native compilation
|
||||||
build_cmd="RUSTFLAGS='--cfg tokio_unstable -Clink-arg=-lm' cargo build"
|
build_cmd="RUSTFLAGS='${RUSTFLAGS:+$RUSTFLAGS }-Clink-arg=-lm' cargo build"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$BUILD_TYPE" = "release" ]; then
|
if [ "$BUILD_TYPE" = "release" ]; then
|
||||||
|
|||||||
@@ -85,7 +85,6 @@
|
|||||||
|
|
||||||
# Set environment variables for build
|
# Set environment variables for build
|
||||||
PROTOC = "${pkgs.protobuf}/bin/protoc";
|
PROTOC = "${pkgs.protobuf}/bin/protoc";
|
||||||
RUSTFLAGS = "--cfg tokio_unstable";
|
|
||||||
|
|
||||||
doCheck = false;
|
doCheck = false;
|
||||||
|
|
||||||
@@ -123,7 +122,6 @@
|
|||||||
];
|
];
|
||||||
|
|
||||||
PROTOC = "${pkgs.protobuf}/bin/protoc";
|
PROTOC = "${pkgs.protobuf}/bin/protoc";
|
||||||
RUSTFLAGS = "--cfg tokio_unstable";
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -38,6 +38,9 @@ cat >"$BIN_DIR/cargo" <<'STUB'
|
|||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
printf '%s\n' "$*" >>"${CARGO_LOG:?}"
|
printf '%s\n' "$*" >>"${CARGO_LOG:?}"
|
||||||
|
if [[ -n "${RUSTFLAGS_LOG:-}" ]]; then
|
||||||
|
printf 'RUSTFLAGS=<%s>\n' "${RUSTFLAGS:-}" >>"$RUSTFLAGS_LOG"
|
||||||
|
fi
|
||||||
if [[ -n "${CARGO_ARG_LOG:-}" ]]; then
|
if [[ -n "${CARGO_ARG_LOG:-}" ]]; then
|
||||||
i=0
|
i=0
|
||||||
for arg in "$@"; do
|
for arg in "$@"; do
|
||||||
@@ -70,9 +73,10 @@ chmod +x "$BIN_DIR/rustup" "$BIN_DIR/git" "$BIN_DIR/cargo"
|
|||||||
|
|
||||||
run_log="$TMP_DIR/run.log"
|
run_log="$TMP_DIR/run.log"
|
||||||
cargo_log="$TMP_DIR/cargo.log"
|
cargo_log="$TMP_DIR/cargo.log"
|
||||||
|
rustflags_log="$TMP_DIR/rustflags.log"
|
||||||
(
|
(
|
||||||
cd "$PROJECT_DIR"
|
cd "$PROJECT_DIR"
|
||||||
PATH="$BIN_DIR:$PATH" CARGO_LOG="$cargo_log" ./build-rustfs.sh \
|
PATH="$BIN_DIR:$PATH" CARGO_LOG="$cargo_log" RUSTFLAGS_LOG="$rustflags_log" ./build-rustfs.sh \
|
||||||
--dev \
|
--dev \
|
||||||
--no-console \
|
--no-console \
|
||||||
--skip-verification \
|
--skip-verification \
|
||||||
@@ -82,6 +86,10 @@ cargo_log="$TMP_DIR/cargo.log"
|
|||||||
|
|
||||||
grep -q -- "Features: webdav" "$run_log"
|
grep -q -- "Features: webdav" "$run_log"
|
||||||
grep -q -- "--features webdav" "$cargo_log"
|
grep -q -- "--features webdav" "$cargo_log"
|
||||||
|
if grep -q -- "--cfg tokio_unstable" "$rustflags_log"; then
|
||||||
|
echo "Default build must not enable tokio_unstable" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
short_run_log="$TMP_DIR/run-short.log"
|
short_run_log="$TMP_DIR/run-short.log"
|
||||||
short_cargo_log="$TMP_DIR/cargo-short.log"
|
short_cargo_log="$TMP_DIR/cargo-short.log"
|
||||||
|
|||||||
Reference in New Issue
Block a user