Skip to content

Commit

Permalink
Merge branch 'strip-binaries-with-cargo'
Browse files Browse the repository at this point in the history
  • Loading branch information
faern committed Jan 25, 2024
2 parents a27ec77 + 321e5c8 commit 81be487
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 13 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ once_cell = "1.13"
[profile.release]
opt-level = 3
lto = true
strip = true

# Key generation may take over one minute without optimizations
# enabled.
Expand Down
16 changes: 3 additions & 13 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -200,17 +200,12 @@ function sign_win {
}

# Build the daemon and other Rust/C++ binaries, optionally
# sign them, strip them of debug symbols and copy to `dist-assets/`.
# sign them, and copy to `dist-assets/`.
function build {
local current_target=${1:-""}
local for_target_string=" for local target $HOST"
local stripbin="strip"
if [[ -n $current_target ]]; then
for_target_string=" for $current_target"

if [[ "$current_target" == "aarch64-unknown-linux-gnu" && "$(uname -m)" != "aarch64" ]]; then
stripbin="aarch64-linux-gnu-strip"
fi
fi

################################################################################
Expand Down Expand Up @@ -287,13 +282,8 @@ function build {
local source="$cargo_output_dir/$binary"
local destination="$destination_dir/$binary"

if [[ "$(uname -s)" == "MINGW"* || "$binary" == *.dylib ]]; then
log_info "Copying $source => $destination"
cp "$source" "$destination"
else
log_info "Stripping $source => $destination"
"${stripbin}" "$source" -o "$destination"
fi
log_info "Copying $source => $destination"
cp "$source" "$destination"

if [[ "$SIGN" == "true" && "$(uname -s)" == "MINGW"* ]]; then
sign_win "$destination"
Expand Down

0 comments on commit 81be487

Please sign in to comment.