Skip to content

Commit

Permalink
Update cross-build script to zip up results
Browse files Browse the repository at this point in the history
  • Loading branch information
sunsided committed Jul 22, 2023
1 parent fa869fa commit 469ea8d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
/.env
/.idea
/*.bak
/*.gz
23 changes: 17 additions & 6 deletions cross-build.sh
Original file line number Diff line number Diff line change
@@ -1,18 +1,29 @@
#!/usr/bin/env bash
set -euo pipefail

PACKAGE_VERSION=$(sed -n 's/^version *= *"\(.*\)"/\1/p' "Cargo.toml")
echo "Cross-building for version ${PACKAGE_VERSION}"

PROFILE=release-lto

echo "Building for Linux (GNU libc)"
LINUX_FLAVOR=linux-gnu
TARGET=x86_64-unknown-${LINUX_FLAVOR}
# rustup target add x86_64-unknown-linux-gnu
cargo auditable build --profile=release-lto --target=x86_64-unknown-linux-gnu
ls -lah target/x86_64-unknown-linux-gnu/release-lto/k8sfwd
cargo auditable build --profile=${PROFILE} --target=${TARGET}
ls -lah target/${TARGET}/${PROFILE}/k8sfwd
gzip --keep -c target/${TARGET}/${PROFILE}/k8sfwd > "k8sfwd-${PACKAGE_VERSION}-${LINUX_FLAVOR}.gz"

echo "Building for Linux (musl)"
LINUX_FLAVOR=linux-musl
TARGET=x86_64-unknown-${LINUX_FLAVOR}
# rustup target add x86_64-unknown-linux-musl
cargo auditable build --profile=release-lto --target=x86_64-unknown-linux-musl
ls -lah target/x86_64-unknown-linux-musl/release-lto/k8sfwd
cargo auditable build --profile=${PROFILE} --target=${TARGET}
ls -lah target/${TARGET}/${PROFILE}/k8sfwd
gzip --keep -c target/${TARGET}/${PROFILE}/k8sfwd > "k8sfwd-${PACKAGE_VERSION}-${LINUX_FLAVOR}.gz"

# TODO: Add OSX support
# echo "Building for Apple Darwin"
# # rustup target add x86_64-apple-darwin
# cargo auditable build --profile=release-lto --target=x86_64-apple-darwin
# ls -lah target/x86_64-apple-darwin/release-lto/k8sfwd
# cargo auditable build --profile=${PROFILE} --target=x86_64-apple-darwin
# ls -lah target/x86_64-apple-darwin/${PROFILE}/k8sfwd

0 comments on commit 469ea8d

Please sign in to comment.