-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathbuild-cross-zig.sh
More file actions
41 lines (33 loc) · 1.19 KB
/
Copy pathbuild-cross-zig.sh
File metadata and controls
41 lines (33 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/bin/bash
# Clear the target directory
rm -rf target/release-cross/*
mkdir -p target/release-cross
build_and_package() {
TARGET=$1
OUTPUT_NAME="git-cryptx-${TARGET}"
if cargo zigbuild --release --target "$TARGET"; then
if [[ "$TARGET" == "x86_64-pc-windows-gnu" ]]; then
# Use zip format for Windows
zip -r "target/release-cross/${OUTPUT_NAME}.zip" -j "target/$TARGET/release/git-cryptx.exe"
echo "Packaging successful: ${OUTPUT_NAME}.zip"
else
# Use tar.gz format for other platforms
tar -czf "target/release-cross/${OUTPUT_NAME}.tar.gz" -C "target/$TARGET/release/" git-cryptx
echo "Packaging successful: ${OUTPUT_NAME}.tar.gz"
fi
else
echo "Compilation failed: $TARGET"
fi
}
# macOS
build_and_package "aarch64-apple-darwin"
build_and_package "x86_64-apple-darwin"
# Windows
build_and_package "x86_64-pc-windows-gnu"
# Linux
build_and_package "x86_64-unknown-linux-musl"
rm -f .intentionally-empty-file.o
# Homebrew
echo "Homebrew sha256:"
shasum -a 256 target/release-cross/git-cryptx-aarch64-apple-darwin.tar.gz
shasum -a 256 target/release-cross/git-cryptx-x86_64-apple-darwin.tar.gz