init, basic glogg clone
This commit is contained in:
87
build-release.sh
Executable file
87
build-release.sh
Executable file
@@ -0,0 +1,87 @@
|
||||
#!/bin/bash
|
||||
# Build script for creating release binaries for all platforms
|
||||
|
||||
set -e
|
||||
|
||||
echo "RLogg - Multi-platform Release Builder"
|
||||
echo "======================================"
|
||||
echo ""
|
||||
|
||||
# Colors for output
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
NC='\033[0m' # No Color
|
||||
|
||||
# Create dist directory
|
||||
DIST_DIR="dist"
|
||||
mkdir -p "$DIST_DIR"
|
||||
|
||||
# Function to build for a target
|
||||
build_target() {
|
||||
local target=$1
|
||||
local name=$2
|
||||
|
||||
echo -e "${YELLOW}Building for $name ($target)...${NC}"
|
||||
|
||||
if cargo build --release --target "$target"; then
|
||||
echo -e "${GREEN}✓ Build successful for $name${NC}"
|
||||
|
||||
# Copy binary to dist directory
|
||||
if [[ "$target" == *"windows"* ]]; then
|
||||
cp "target/$target/release/rlogg.exe" "$DIST_DIR/rlogg-$name.exe"
|
||||
echo -e "${GREEN}✓ Binary copied to $DIST_DIR/rlogg-$name.exe${NC}"
|
||||
else
|
||||
cp "target/$target/release/rlogg" "$DIST_DIR/rlogg-$name"
|
||||
# Strip binary on Unix-like systems
|
||||
strip "$DIST_DIR/rlogg-$name" 2>/dev/null || true
|
||||
echo -e "${GREEN}✓ Binary copied to $DIST_DIR/rlogg-$name${NC}"
|
||||
fi
|
||||
echo ""
|
||||
return 0
|
||||
else
|
||||
echo -e "${RED}✗ Build failed for $name${NC}"
|
||||
echo ""
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Detect current platform
|
||||
PLATFORM=$(uname -s)
|
||||
ARCH=$(uname -m)
|
||||
|
||||
echo "Current platform: $PLATFORM ($ARCH)"
|
||||
echo ""
|
||||
|
||||
# Build for current platform first
|
||||
case "$PLATFORM" in
|
||||
Linux)
|
||||
echo "=== Building for Linux ==="
|
||||
build_target "x86_64-unknown-linux-gnu" "linux-x86_64"
|
||||
;;
|
||||
Darwin)
|
||||
echo "=== Building for macOS ==="
|
||||
if [[ "$ARCH" == "arm64" ]]; then
|
||||
build_target "aarch64-apple-darwin" "macos-aarch64"
|
||||
else
|
||||
build_target "x86_64-apple-darwin" "macos-x86_64"
|
||||
fi
|
||||
;;
|
||||
MINGW* | MSYS* | CYGWIN*)
|
||||
echo "=== Building for Windows ==="
|
||||
build_target "x86_64-pc-windows-msvc" "windows-x86_64"
|
||||
;;
|
||||
*)
|
||||
echo -e "${RED}Unknown platform: $PLATFORM${NC}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
echo ""
|
||||
echo -e "${GREEN}=== Build Complete ===${NC}"
|
||||
echo "Binaries are in the '$DIST_DIR' directory:"
|
||||
ls -lh "$DIST_DIR"
|
||||
echo ""
|
||||
echo "To build for additional platforms, install the target and run:"
|
||||
echo " rustup target add <target-triple>"
|
||||
echo " cargo build --release --target <target-triple>"
|
||||
Reference in New Issue
Block a user