-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathbuild-quick.sh
More file actions
executable file
·60 lines (47 loc) · 1.44 KB
/
build-quick.sh
File metadata and controls
executable file
·60 lines (47 loc) · 1.44 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/bin/bash
set -e
VERSION=${1:-$(git describe --tags --always --dirty 2>/dev/null || echo "dev")}
PROJECT_NAME="rustun"
DIST_DIR="dist"
BINARIES=("server" "client")
echo "Quick build for current platform"
echo "Binaries: ${BINARIES[@]}"
cargo build --release
mkdir -p ${DIST_DIR}
# Detect current platform
case "$OSTYPE" in
linux*) PLATFORM="linux" ;;
darwin*) PLATFORM="macos" ;;
msys*|cygwin*|win32) PLATFORM="windows" ;;
*) PLATFORM="unknown" ;;
esac
# Detect architecture
ARCH=$(uname -m)
if [[ "$PLATFORM" == "windows" ]]; then
EXT=".exe"
else
EXT=""
fi
OUTPUT_NAME="${PROJECT_NAME}-${VERSION}-${PLATFORM}-${ARCH}"
mkdir -p ${DIST_DIR}/${OUTPUT_NAME}
# Copy binaries
for binary in "${BINARIES[@]}"; do
if [ -f "target/release/${binary}${EXT}" ]; then
cp target/release/${binary}${EXT} ${DIST_DIR}/${OUTPUT_NAME}/
echo " ✓ Copied ${binary}${EXT}"
else
echo " ✗ Warning: ${binary}${EXT} not found"
fi
done
cp README.md ${DIST_DIR}/${OUTPUT_NAME}/ 2>/dev/null || true
cp etc/server.toml ${DIST_DIR}/${OUTPUT_NAME}/server.toml.example 2>/dev/null || true
cp etc/routes.json ${DIST_DIR}/${OUTPUT_NAME}/routes.json.example 2>/dev/null || true
cd ${DIST_DIR}
if [[ "$PLATFORM" == "windows" ]]; then
zip -r ${OUTPUT_NAME}.zip ${OUTPUT_NAME}
else
tar czf ${OUTPUT_NAME}.tar.gz ${OUTPUT_NAME}
fi
cd ..
echo "✓ Built for ${PLATFORM}-${ARCH}"
echo "Output: ${DIST_DIR}/${OUTPUT_NAME}.tar.gz"