Skip to content

Commit 4724cda

Browse files
Add a simple shell script for building binaries with cross
1 parent ea8bc3b commit 4724cda

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

build_binaries.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# A simple shell script for building binaries, in preparation to be uploaded to GitHub releases.
2+
# Tested on Arch Linux
3+
# Requirements: `cross` (cross-rs)
4+
# May require targets to be added using `rustup target add <target-triple>`
5+
6+
targets=(
7+
x86_64-unknown-linux-gnu
8+
x86_64-pc-windows-gnu
9+
# x86_64-apple-darwin
10+
aarch64-unknown-linux-gnu
11+
)
12+
13+
version=$(cargo run --bin rusty_man_computer -- --version | cut -d ' ' -f 2)
14+
15+
mkdir -p target/dist
16+
for target in "${targets[@]}"; do
17+
cross build --release --target "$target"
18+
# Copy both binaries to `target/dist`
19+
cp "target/$target/release/rusty_man_computer" "target/dist/rusty-man-computer-$version-$target" || \
20+
cp "target/$target/release/rusty_man_computer.exe" "target/dist/rusty-man-computer-$version-$target.exe"
21+
cp "target/$target/release/bin_creator" "target/dist/rusty-man-computer-$version-$target" || \
22+
cp "target/$target/release/bin_creator.exe" "target/dist/rusty-man-computer-$version-$target.exe"
23+
done

0 commit comments

Comments
 (0)