generated from nhcarrigan/template
feat: prep the scaffolding
This commit is contained in:
Executable
+89
@@ -0,0 +1,89 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Colors for output
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
BLUE='\033[0;34m'
|
||||
NC='\033[0m' # No Color
|
||||
|
||||
echo -e "${BLUE}🚀 Building Chronara for all platforms...${NC}"
|
||||
|
||||
# Function to run a build and check its status
|
||||
run_build() {
|
||||
local target=$1
|
||||
local desc=$2
|
||||
|
||||
echo -e "\n${YELLOW}Building: ${desc}${NC}"
|
||||
|
||||
if pnpm tauri build --target "$target"; then
|
||||
echo -e "${GREEN}✓ ${desc} build succeeded${NC}"
|
||||
return 0
|
||||
else
|
||||
echo -e "${RED}✗ ${desc} build failed${NC}"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Ensure we're using the correct Node version
|
||||
source /home/naomi/.nvm/nvm.sh
|
||||
nvm use 24.11.1
|
||||
|
||||
# Install dependencies if needed
|
||||
echo -e "${YELLOW}Installing dependencies...${NC}"
|
||||
pnpm install
|
||||
|
||||
# Build frontend first
|
||||
echo -e "${YELLOW}Building frontend...${NC}"
|
||||
pnpm build
|
||||
|
||||
# Track if any builds fail
|
||||
failed=0
|
||||
|
||||
# Linux builds (native in WSL)
|
||||
echo -e "\n${BLUE}Building Linux targets...${NC}"
|
||||
run_build "x86_64-unknown-linux-gnu" "Linux AppImage/Deb/RPM" || failed=1
|
||||
|
||||
# Windows build (cross-compile from WSL)
|
||||
echo -e "\n${BLUE}Building Windows target...${NC}"
|
||||
|
||||
# Check if Windows target is installed
|
||||
if ! rustup target list --installed | grep -q "x86_64-pc-windows-gnu"; then
|
||||
echo -e "${YELLOW}Installing Windows target...${NC}"
|
||||
rustup target add x86_64-pc-windows-gnu
|
||||
fi
|
||||
|
||||
# Check if full mingw-w64 toolchain is installed
|
||||
if ! command -v x86_64-w64-mingw32-gcc &> /dev/null || ! command -v x86_64-w64-mingw32-dlltool &> /dev/null; then
|
||||
echo -e "${RED}Windows cross-compilation tools are missing!${NC}"
|
||||
echo -e "${YELLOW}Please install the full mingw-w64 toolchain:${NC}"
|
||||
echo -e "${YELLOW} sudo apt-get update${NC}"
|
||||
echo -e "${YELLOW} sudo apt-get install -y gcc-mingw-w64-x86-64 g++-mingw-w64-x86-64 mingw-w64-tools${NC}"
|
||||
echo -e "${RED}Skipping Windows build...${NC}"
|
||||
SKIP_WINDOWS=1
|
||||
fi
|
||||
|
||||
# Set up environment for Windows cross-compilation
|
||||
export CARGO_TARGET_X86_64_PC_WINDOWS_GNU_LINKER="x86_64-w64-mingw32-gcc"
|
||||
export CC_x86_64_pc_windows_gnu="x86_64-w64-mingw32-gcc"
|
||||
export CXX_x86_64_pc_windows_gnu="x86_64-w64-mingw32-g++"
|
||||
export AR_x86_64_pc_windows_gnu="x86_64-w64-mingw32-ar"
|
||||
|
||||
if [ -z "$SKIP_WINDOWS" ]; then
|
||||
run_build "x86_64-pc-windows-gnu" "Windows NSIS" || failed=1
|
||||
fi
|
||||
|
||||
# Summary
|
||||
echo -e "\n${YELLOW}========================================${NC}"
|
||||
if [ $failed -eq 0 ]; then
|
||||
echo -e "${GREEN}✨ All builds completed successfully!${NC}"
|
||||
echo -e "${GREEN}Build outputs:${NC}"
|
||||
echo -e "${GREEN} Linux: src-tauri/target/release/bundle/appimage/chronara_*.AppImage${NC}"
|
||||
echo -e "${GREEN} Linux: src-tauri/target/release/bundle/deb/chronara_*.deb${NC}"
|
||||
echo -e "${GREEN} Linux: src-tauri/target/release/bundle/rpm/chronara-*.rpm${NC}"
|
||||
echo -e "${GREEN} Windows: src-tauri/target/x86_64-pc-windows-gnu/release/bundle/nsis/Chronara_*.exe${NC}"
|
||||
exit 0
|
||||
else
|
||||
echo -e "${RED}❌ Some builds failed. Check the output above for details.${NC}"
|
||||
exit 1
|
||||
fi
|
||||
Reference in New Issue
Block a user