From 995ca77349f384318cd55792bd80386e4bda99d2 Mon Sep 17 00:00:00 2001 From: Niladri Halder Date: Tue, 22 Oct 2024 06:35:02 +0000 Subject: [PATCH] build: add option to build without debug symbols Signed-off-by: Niladri Halder --- scripts/release.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/scripts/release.sh b/scripts/release.sh index 68513d5..c200915 100644 --- a/scripts/release.sh +++ b/scripts/release.sh @@ -261,6 +261,10 @@ parse_common_arg() { STATIC_LINKING="false" shift ;; + ---no-debug-symbols) + DISABLE_DEBUG_SYMBOLS="true" + shift + ;; --skip-bins) shift BUILD_BINARIES= @@ -459,7 +463,7 @@ build_images() { # the images we already have locally. if [ -z "$SKIP_BUILD" ]; then echo "Building $image:$TAG ..." - $NIX_BUILD --out-link "$archive-image" -A "images.$BUILD_TYPE.$archive" --arg allInOne "$ALL_IN_ONE" --arg incremental "$INCREMENTAL" --argstr product_prefix "$PRODUCT_PREFIX" + $NIX_BUILD --out-link "$archive-image" -A "images.$BUILD_TYPE.$archive" --arg allInOne "$ALL_IN_ONE" --arg noDebugSymbols "$DISABLE_DEBUG_SYMBOLS" --arg incremental "$INCREMENTAL" --argstr product_prefix "$PRODUCT_PREFIX" if [ -n "$CONTAINER_LOAD" ]; then container_load "$archive-image" if [ "$image" != "$image_basename" ]; then @@ -562,7 +566,7 @@ build_bins() { mkdir -p "$BINARY_OUT_LINK" for name in $BUILD_BINARIES; do echo "Building static $name ..." - $NIX_BUILD --out-link "$BINARY_OUT_LINK/$name" -A "$PROJECT.$BUILD_TYPE.$name" --arg allInOne "$ALL_IN_ONE" --arg static "$STATIC_LINKING" + $NIX_BUILD --out-link "$BINARY_OUT_LINK/$name" -A "$PROJECT.$BUILD_TYPE.$name" --arg allInOne "$ALL_IN_ONE" --arg static "$STATIC_LINKING" --arg noDebugSymbols "$DISABLE_DEBUG_SYMBOLS" done fi } @@ -599,6 +603,7 @@ common_help() { --incremental Builds components in two stages allowing for faster rebuilds during development. --build-bins Builds all the static binaries. --no-static-linking Don't build the binaries with static linking. + --no-debug-symbols Don't add debug symbols when building Rust binaries. --build-bin Specify which binary to build. --skip-bins Don't build the static binaries. --build-binary-out Specify the outlink path for the binaries (otherwise it's the current directory). @@ -637,6 +642,7 @@ INCREMENTAL="false" DEFAULT_BINARIES=${BUILD_BINARIES:-} BUILD_BINARIES= STATIC_LINKING="true" +DISABLE_DEBUG_SYMBOLS="false" BINARY_OUT_LINK="." CARGO_VENDOR_DIR=${CARGO_VENDOR_DIR:-} CARGO_VENDOR_ATTEMPTS=${CARGO_VENDOR_ATTEMPTS:-25}