From 28b4f8ea39f0ae67bda9973e89600043ac78adec Mon Sep 17 00:00:00 2001 From: Carson McManus Date: Sun, 12 Jun 2022 09:46:44 -0400 Subject: [PATCH] build releases using cross for more portable builds --- scripts/full-release.sh | 9 +++++++-- scripts/package-deb.sh | 9 +++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/scripts/full-release.sh b/scripts/full-release.sh index 25f1274..1e62f28 100755 --- a/scripts/full-release.sh +++ b/scripts/full-release.sh @@ -58,11 +58,16 @@ if [[ $SKIP_CRATE_PUBLISH == true ]]; then fi cargo smart-release --update-crates-index --no-changelog "${params[@]}" -cargo build --release +if ! which cross; then + echo "cross not found, installing..." + cargo install cross +fi + +cross build --release --target=x86_64-unknown-linux-musl ./scripts/package-deb.sh -BIN_PATH="target/release/steamguard-cli" +BIN_PATH="target/x86_64-unknown-linux-musl/release/steamguard-cli-x86_64-unknown-linux-musl" RAW_VERSION="$("$BIN_PATH" --version | cut -d " " -f 2)" TAGGED_VERSION="$(git tag | grep "^v" | tail -n 1 | tr -d v)" if [[ "v$RAW_VERSION" != "v$TAGGED_VERSION" ]]; then diff --git a/scripts/package-deb.sh b/scripts/package-deb.sh index b20aaa1..fb7565a 100755 --- a/scripts/package-deb.sh +++ b/scripts/package-deb.sh @@ -5,10 +5,15 @@ set -e DISTRO=$(lsb_release -i -s) DISTRO_VERSION=$(lsb_release -r -s) -BIN_PATH="target/release/steamguard-cli" +if ! which cross; then + echo "cross not found, installing..." + cargo install cross +fi + +BIN_PATH="target/x86_64-unknown-linux-musl/release/steamguard-cli" if [[ ! -f "$BIN_PATH" ]]; then echo "ERROR: Could not find release binaries, building them..." - cargo build --release + cross build --release --target=x86_64-unknown-linux-musl fi VERSION="$("$BIN_PATH" --version | cut -d " " -f 2)" TEMP_PKG_PATH="/tmp/steamguard-cli_$VERSION"