forked from Leak_Technologies/VideoTools
Add cross-platform dependency installation and build scripts
Linux: - install-deps-linux.sh: Auto-detect distro and install dependencies - Supports Fedora, Ubuntu, Arch, openSUSE - Installs Go, GCC, OpenGL, X11, ALSA, ffmpeg - Verification checks after installation Windows: - install-deps-windows.ps1: PowerShell dependency installer - Supports Chocolatey and Scoop package managers - Installs Go, MinGW (GCC), ffmpeg, Git - Admin and user-level installation options - GPU detection for NVIDIA/Intel/AMD - build.ps1: Windows build script with error handling - Clean build option - Dependency verification - GPU detection and NVENC notification - File size reporting Documentation: - scripts/README.md: Comprehensive guide for both platforms - Installation instructions - Build commands and options - Troubleshooting section - GPU encoding setup - Development workflow Prepares VideoTools for Windows users (Jake!) in dev14
This commit is contained in:
parent
220c273bcf
commit
292da5c59e
262
scripts/README.md
Normal file
262
scripts/README.md
Normal file
|
|
@ -0,0 +1,262 @@
|
|||
# VideoTools Build Scripts
|
||||
|
||||
This directory contains scripts for building and managing VideoTools on different platforms.
|
||||
|
||||
## Linux
|
||||
|
||||
### Install Dependencies
|
||||
|
||||
Automatically installs all required dependencies for your Linux distribution:
|
||||
|
||||
```bash
|
||||
./scripts/install-deps-linux.sh
|
||||
```
|
||||
|
||||
**Supported distributions:**
|
||||
- Fedora / RHEL / CentOS
|
||||
- Ubuntu / Debian / Pop!_OS / Linux Mint
|
||||
- Arch Linux / Manjaro / EndeavourOS
|
||||
- openSUSE / SLES
|
||||
|
||||
**Installs:**
|
||||
- Go 1.21+
|
||||
- GCC compiler
|
||||
- OpenGL development libraries
|
||||
- X11 development libraries
|
||||
- ALSA audio libraries
|
||||
- ffmpeg
|
||||
|
||||
### Build VideoTools
|
||||
|
||||
```bash
|
||||
./scripts/build.sh
|
||||
```
|
||||
|
||||
**Features:**
|
||||
- Automatic dependency verification
|
||||
- Clean build option
|
||||
- Progress indicators
|
||||
- Error handling
|
||||
|
||||
### Run VideoTools
|
||||
|
||||
```bash
|
||||
./scripts/run.sh
|
||||
```
|
||||
|
||||
Runs VideoTools with proper library paths configured.
|
||||
|
||||
### Shell Alias
|
||||
|
||||
```bash
|
||||
source ./scripts/alias.sh
|
||||
```
|
||||
|
||||
Adds a `VideoTools` command to your current shell session.
|
||||
|
||||
## Windows
|
||||
|
||||
### Install Dependencies
|
||||
|
||||
Run in PowerShell as Administrator:
|
||||
|
||||
```powershell
|
||||
.\scripts\install-deps-windows.ps1
|
||||
```
|
||||
|
||||
**Options:**
|
||||
- `-UseScoop` - Use Scoop package manager instead of Chocolatey
|
||||
- `-SkipFFmpeg` - Skip ffmpeg installation (if you already have it)
|
||||
|
||||
**Installs:**
|
||||
- Go 1.21+
|
||||
- MinGW-w64 (GCC compiler)
|
||||
- ffmpeg
|
||||
- Git (optional, for development)
|
||||
|
||||
**Package managers supported:**
|
||||
- Chocolatey (default, requires admin)
|
||||
- Scoop (user-level, no admin)
|
||||
|
||||
### Build VideoTools
|
||||
|
||||
Run in PowerShell:
|
||||
|
||||
```powershell
|
||||
.\scripts\build.ps1
|
||||
```
|
||||
|
||||
**Options:**
|
||||
- `-Clean` - Clean build cache before building
|
||||
- `-SkipTests` - Skip running tests
|
||||
|
||||
**Features:**
|
||||
- Automatic GPU detection (NVIDIA/Intel/AMD)
|
||||
- Dependency verification
|
||||
- File size reporting
|
||||
- Build status indicators
|
||||
|
||||
## Cross-Platform Notes
|
||||
|
||||
### CGO Requirements
|
||||
|
||||
VideoTools uses [Fyne](https://fyne.io/) for its GUI, which requires CGO (C bindings) for OpenGL support. This means:
|
||||
|
||||
1. **C compiler required** (GCC on Linux, MinGW on Windows)
|
||||
2. **OpenGL libraries required** (system-dependent)
|
||||
3. **Build time is longer** than pure Go applications
|
||||
|
||||
### ffmpeg Requirements
|
||||
|
||||
VideoTools requires `ffmpeg` to be available in the system PATH:
|
||||
|
||||
- **Linux**: Installed via package manager
|
||||
- **Windows**: Installed via Chocolatey/Scoop or manually
|
||||
|
||||
The application will auto-detect available hardware encoders:
|
||||
- NVIDIA: NVENC (h264_nvenc, hevc_nvenc)
|
||||
- Intel: Quick Sync Video (h264_qsv, hevc_qsv)
|
||||
- AMD: AMF (h264_amf, hevc_amf)
|
||||
- VA-API (Linux only)
|
||||
|
||||
### GPU Encoding
|
||||
|
||||
For best performance with hardware encoding:
|
||||
|
||||
**NVIDIA (Recommended for Jake's setup):**
|
||||
- Install latest NVIDIA drivers
|
||||
- GTX 1060 and newer support NVENC
|
||||
- Reduces 2-hour encode from 6-9 hours to <1 hour
|
||||
|
||||
**Intel:**
|
||||
- Install Intel Graphics drivers
|
||||
- 7th gen (Kaby Lake) and newer support Quick Sync
|
||||
- Built into CPU, no dedicated GPU needed
|
||||
|
||||
**AMD:**
|
||||
- Install latest AMD drivers
|
||||
- Most modern Radeon GPUs support AMF
|
||||
- Performance similar to NVENC
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Linux: Missing OpenGL libraries
|
||||
|
||||
```bash
|
||||
# Fedora/RHEL
|
||||
sudo dnf install mesa-libGL-devel
|
||||
|
||||
# Ubuntu/Debian
|
||||
sudo apt install libgl1-mesa-dev
|
||||
|
||||
# Arch
|
||||
sudo pacman -S mesa
|
||||
```
|
||||
|
||||
### Windows: MinGW not in PATH
|
||||
|
||||
After installing MinGW, restart PowerShell or add to PATH manually:
|
||||
|
||||
```powershell
|
||||
$env:Path += ";C:\ProgramData\chocolatey\lib\mingw\tools\install\mingw64\bin"
|
||||
```
|
||||
|
||||
### Build fails with "cgo: C compiler not found"
|
||||
|
||||
**Linux:** Install gcc
|
||||
**Windows:** Install MinGW via `install-deps-windows.ps1`
|
||||
|
||||
### ffmpeg not found
|
||||
|
||||
**Linux:**
|
||||
```bash
|
||||
sudo dnf install ffmpeg-free # Fedora
|
||||
sudo apt install ffmpeg # Ubuntu
|
||||
```
|
||||
|
||||
**Windows:**
|
||||
```powershell
|
||||
choco install ffmpeg
|
||||
# or
|
||||
scoop install ffmpeg
|
||||
```
|
||||
|
||||
### GPU encoding not working
|
||||
|
||||
1. Verify GPU drivers are up to date
|
||||
2. Check ffmpeg encoders:
|
||||
```bash
|
||||
ffmpeg -encoders | grep nvenc # NVIDIA
|
||||
ffmpeg -encoders | grep qsv # Intel
|
||||
ffmpeg -encoders | grep amf # AMD
|
||||
```
|
||||
3. If encoders not listed, reinstall GPU drivers
|
||||
|
||||
## Development
|
||||
|
||||
### Quick Build Cycle
|
||||
|
||||
Linux:
|
||||
```bash
|
||||
./scripts/build.sh && ./scripts/run.sh
|
||||
```
|
||||
|
||||
Windows:
|
||||
```powershell
|
||||
.\scripts\build.ps1 && .\VideoTools.exe
|
||||
```
|
||||
|
||||
### Clean Build
|
||||
|
||||
Linux:
|
||||
```bash
|
||||
./scripts/build.sh # Includes automatic cleaning
|
||||
```
|
||||
|
||||
Windows:
|
||||
```powershell
|
||||
.\scripts\build.ps1 -Clean
|
||||
```
|
||||
|
||||
### Build for Distribution
|
||||
|
||||
**Linux:**
|
||||
```bash
|
||||
CGO_ENABLED=1 go build -ldflags="-s -w" -o VideoTools .
|
||||
strip VideoTools # Further reduce size
|
||||
```
|
||||
|
||||
**Windows:**
|
||||
```powershell
|
||||
$env:CGO_ENABLED = "1"
|
||||
go build -ldflags="-s -w -H windowsgui" -o VideoTools.exe .
|
||||
```
|
||||
|
||||
The `-H windowsgui` flag prevents a console window from appearing on Windows.
|
||||
|
||||
## Platform-Specific Notes
|
||||
|
||||
### Linux: Wayland vs X11
|
||||
|
||||
VideoTools works on both Wayland and X11. The build scripts automatically detect your display server.
|
||||
|
||||
### Windows: Antivirus False Positives
|
||||
|
||||
Some antivirus software may flag the built executable. This is common with Go applications. You may need to:
|
||||
|
||||
1. Add an exception for the build directory
|
||||
2. Submit the binary to your antivirus vendor for whitelisting
|
||||
|
||||
### macOS Support (Future)
|
||||
|
||||
macOS support is planned but not yet implemented. Required changes:
|
||||
|
||||
- Add macOS dependencies (via Homebrew)
|
||||
- Add macOS build script
|
||||
- Test Fyne on macOS
|
||||
- Handle codesigning requirements
|
||||
|
||||
## License
|
||||
|
||||
VideoTools build scripts are part of the VideoTools project.
|
||||
See the main project LICENSE file for details.
|
||||
107
scripts/build.ps1
Normal file
107
scripts/build.ps1
Normal file
|
|
@ -0,0 +1,107 @@
|
|||
# VideoTools Build Script for Windows
|
||||
# Builds the VideoTools application with proper error handling
|
||||
|
||||
param(
|
||||
[switch]$Clean = $false,
|
||||
[switch]$SkipTests = $false
|
||||
)
|
||||
|
||||
Write-Host "════════════════════════════════════════════════════════════════" -ForegroundColor Cyan
|
||||
Write-Host " VideoTools Build Script (Windows)" -ForegroundColor Cyan
|
||||
Write-Host "════════════════════════════════════════════════════════════════" -ForegroundColor Cyan
|
||||
Write-Host ""
|
||||
|
||||
# Get project root (parent of scripts directory)
|
||||
$PROJECT_ROOT = Split-Path -Parent $PSScriptRoot
|
||||
$BUILD_OUTPUT = Join-Path $PROJECT_ROOT "VideoTools.exe"
|
||||
|
||||
# Check if Go is installed
|
||||
if (-not (Get-Command go -ErrorAction SilentlyContinue)) {
|
||||
Write-Host "❌ ERROR: Go is not installed. Please run install-deps-windows.ps1 first." -ForegroundColor Red
|
||||
exit 1
|
||||
}
|
||||
|
||||
Write-Host "📦 Go version:" -ForegroundColor Green
|
||||
go version
|
||||
Write-Host ""
|
||||
|
||||
# Change to project directory
|
||||
Set-Location $PROJECT_ROOT
|
||||
|
||||
if ($Clean) {
|
||||
Write-Host "🧹 Cleaning previous builds and cache..." -ForegroundColor Yellow
|
||||
go clean -cache -modcache -testcache 2>$null
|
||||
if (Test-Path $BUILD_OUTPUT) {
|
||||
Remove-Item $BUILD_OUTPUT -Force
|
||||
}
|
||||
Write-Host "✓ Cache cleaned" -ForegroundColor Green
|
||||
Write-Host ""
|
||||
}
|
||||
|
||||
Write-Host "⬇️ Downloading and verifying dependencies..." -ForegroundColor Yellow
|
||||
go mod download
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
Write-Host "❌ Failed to download dependencies" -ForegroundColor Red
|
||||
exit 1
|
||||
}
|
||||
|
||||
go mod verify
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
Write-Host "❌ Failed to verify dependencies" -ForegroundColor Red
|
||||
exit 1
|
||||
}
|
||||
Write-Host "✓ Dependencies verified" -ForegroundColor Green
|
||||
Write-Host ""
|
||||
|
||||
Write-Host "🔨 Building VideoTools..." -ForegroundColor Yellow
|
||||
Write-Host ""
|
||||
|
||||
# Fyne needs CGO for GLFW/OpenGL bindings
|
||||
$env:CGO_ENABLED = "1"
|
||||
|
||||
# Build the application
|
||||
go build -o $BUILD_OUTPUT .
|
||||
|
||||
if ($LASTEXITCODE -eq 0) {
|
||||
Write-Host "✓ Build successful!" -ForegroundColor Green
|
||||
Write-Host ""
|
||||
Write-Host "════════════════════════════════════════════════════════════════" -ForegroundColor Cyan
|
||||
Write-Host "✅ BUILD COMPLETE" -ForegroundColor Green
|
||||
Write-Host "════════════════════════════════════════════════════════════════" -ForegroundColor Cyan
|
||||
Write-Host ""
|
||||
|
||||
# Get file size
|
||||
$fileSize = (Get-Item $BUILD_OUTPUT).Length
|
||||
$fileSizeMB = [math]::Round($fileSize / 1MB, 2)
|
||||
|
||||
Write-Host "Output: $BUILD_OUTPUT" -ForegroundColor White
|
||||
Write-Host "Size: $fileSizeMB MB" -ForegroundColor White
|
||||
Write-Host ""
|
||||
Write-Host "To run:" -ForegroundColor Yellow
|
||||
Write-Host " .\VideoTools.exe" -ForegroundColor White
|
||||
Write-Host ""
|
||||
|
||||
# Check if ffmpeg is available
|
||||
if (-not (Get-Command ffmpeg -ErrorAction SilentlyContinue)) {
|
||||
Write-Host "⚠️ Warning: ffmpeg not found in PATH" -ForegroundColor Yellow
|
||||
Write-Host " VideoTools requires ffmpeg to convert videos" -ForegroundColor Yellow
|
||||
Write-Host " Run: .\scripts\install-deps-windows.ps1" -ForegroundColor Yellow
|
||||
Write-Host ""
|
||||
}
|
||||
|
||||
# Check for NVIDIA GPU
|
||||
try {
|
||||
$nvidiaGpu = Get-WmiObject Win32_VideoController | Where-Object { $_.Name -like "*NVIDIA*" }
|
||||
if ($nvidiaGpu) {
|
||||
Write-Host "🎮 NVIDIA GPU detected: $($nvidiaGpu.Name)" -ForegroundColor Green
|
||||
Write-Host " Hardware encoding (NVENC) will be available" -ForegroundColor Green
|
||||
Write-Host ""
|
||||
}
|
||||
} catch {
|
||||
# GPU detection failed, not critical
|
||||
}
|
||||
|
||||
} else {
|
||||
Write-Host "❌ Build failed!" -ForegroundColor Red
|
||||
exit 1
|
||||
}
|
||||
171
scripts/install-deps-linux.sh
Executable file
171
scripts/install-deps-linux.sh
Executable file
|
|
@ -0,0 +1,171 @@
|
|||
#!/bin/bash
|
||||
# VideoTools Dependency Installer for Linux
|
||||
# Installs all required build and runtime dependencies
|
||||
|
||||
set -e
|
||||
|
||||
echo "════════════════════════════════════════════════════════════════"
|
||||
echo " VideoTools Dependency Installer (Linux)"
|
||||
echo "════════════════════════════════════════════════════════════════"
|
||||
echo ""
|
||||
|
||||
# Detect Linux distribution
|
||||
if [ -f /etc/os-release ]; then
|
||||
. /etc/os-release
|
||||
DISTRO=$ID
|
||||
else
|
||||
echo "❌ Cannot detect Linux distribution"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "📦 Detected distribution: $DISTRO"
|
||||
echo ""
|
||||
|
||||
# Function to install on Fedora/RHEL/CentOS
|
||||
install_fedora() {
|
||||
echo "Installing dependencies for Fedora/RHEL..."
|
||||
sudo dnf install -y \
|
||||
gcc \
|
||||
pkg-config \
|
||||
libX11-devel \
|
||||
libXcursor-devel \
|
||||
libXrandr-devel \
|
||||
libXinerama-devel \
|
||||
libXi-devel \
|
||||
libXxf86vm-devel \
|
||||
mesa-libGL-devel \
|
||||
alsa-lib-devel \
|
||||
ffmpeg-free \
|
||||
golang
|
||||
echo "✓ Fedora dependencies installed"
|
||||
}
|
||||
|
||||
# Function to install on Ubuntu/Debian
|
||||
install_ubuntu() {
|
||||
echo "Installing dependencies for Ubuntu/Debian..."
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y \
|
||||
gcc \
|
||||
pkg-config \
|
||||
libgl1-mesa-dev \
|
||||
libx11-dev \
|
||||
libxcursor-dev \
|
||||
libxrandr-dev \
|
||||
libxinerama-dev \
|
||||
libxi-dev \
|
||||
libxxf86vm-dev \
|
||||
libasound2-dev \
|
||||
ffmpeg \
|
||||
golang-go
|
||||
echo "✓ Ubuntu/Debian dependencies installed"
|
||||
}
|
||||
|
||||
# Function to install on Arch Linux
|
||||
install_arch() {
|
||||
echo "Installing dependencies for Arch Linux..."
|
||||
sudo pacman -S --needed --noconfirm \
|
||||
gcc \
|
||||
pkgconf \
|
||||
mesa \
|
||||
libx11 \
|
||||
libxcursor \
|
||||
libxrandr \
|
||||
libxinerama \
|
||||
libxi \
|
||||
libxxf86vm \
|
||||
alsa-lib \
|
||||
ffmpeg \
|
||||
go
|
||||
echo "✓ Arch Linux dependencies installed"
|
||||
}
|
||||
|
||||
# Function to install on openSUSE
|
||||
install_opensuse() {
|
||||
echo "Installing dependencies for openSUSE..."
|
||||
sudo zypper install -y \
|
||||
gcc \
|
||||
pkg-config \
|
||||
Mesa-libGL-devel \
|
||||
libX11-devel \
|
||||
libXcursor-devel \
|
||||
libXrandr-devel \
|
||||
libXinerama-devel \
|
||||
libXi-devel \
|
||||
libXxf86vm-devel \
|
||||
alsa-devel \
|
||||
ffmpeg \
|
||||
go
|
||||
echo "✓ openSUSE dependencies installed"
|
||||
}
|
||||
|
||||
# Install based on distribution
|
||||
case "$DISTRO" in
|
||||
fedora|rhel|centos)
|
||||
install_fedora
|
||||
;;
|
||||
ubuntu|debian|pop|linuxmint)
|
||||
install_ubuntu
|
||||
;;
|
||||
arch|manjaro|endeavouros)
|
||||
install_arch
|
||||
;;
|
||||
opensuse*|sles)
|
||||
install_opensuse
|
||||
;;
|
||||
*)
|
||||
echo "❌ Unsupported distribution: $DISTRO"
|
||||
echo ""
|
||||
echo "Please install these packages manually:"
|
||||
echo " - gcc"
|
||||
echo " - pkg-config"
|
||||
echo " - OpenGL development libraries"
|
||||
echo " - X11 development libraries (libX11, libXcursor, libXrandr, libXinerama, libXi, libXxf86vm)"
|
||||
echo " - ALSA development libraries"
|
||||
echo " - ffmpeg"
|
||||
echo " - Go 1.21 or later"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
echo ""
|
||||
echo "════════════════════════════════════════════════════════════════"
|
||||
echo "✅ DEPENDENCIES INSTALLED"
|
||||
echo "════════════════════════════════════════════════════════════════"
|
||||
echo ""
|
||||
|
||||
# Verify installations
|
||||
echo "Verifying installations..."
|
||||
echo ""
|
||||
|
||||
# Check Go
|
||||
if command -v go &> /dev/null; then
|
||||
echo "✓ Go: $(go version)"
|
||||
else
|
||||
echo "⚠️ Go not found in PATH"
|
||||
fi
|
||||
|
||||
# Check GCC
|
||||
if command -v gcc &> /dev/null; then
|
||||
echo "✓ GCC: $(gcc --version | head -1)"
|
||||
else
|
||||
echo "⚠️ GCC not found"
|
||||
fi
|
||||
|
||||
# Check ffmpeg
|
||||
if command -v ffmpeg &> /dev/null; then
|
||||
echo "✓ ffmpeg: $(ffmpeg -version | head -1)"
|
||||
else
|
||||
echo "⚠️ ffmpeg not found in PATH"
|
||||
fi
|
||||
|
||||
# Check pkg-config
|
||||
if command -v pkg-config &> /dev/null; then
|
||||
echo "✓ pkg-config: $(pkg-config --version)"
|
||||
else
|
||||
echo "⚠️ pkg-config not found"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "Dependencies ready! You can now run:"
|
||||
echo " ./scripts/build.sh"
|
||||
echo ""
|
||||
251
scripts/install-deps-windows.ps1
Normal file
251
scripts/install-deps-windows.ps1
Normal file
|
|
@ -0,0 +1,251 @@
|
|||
# VideoTools Dependency Installer for Windows
|
||||
# Installs all required build and runtime dependencies using Chocolatey or Scoop
|
||||
|
||||
param(
|
||||
[switch]$UseScoop = $false,
|
||||
[switch]$SkipFFmpeg = $false
|
||||
)
|
||||
|
||||
Write-Host "════════════════════════════════════════════════════════════════" -ForegroundColor Cyan
|
||||
Write-Host " VideoTools Dependency Installer (Windows)" -ForegroundColor Cyan
|
||||
Write-Host "════════════════════════════════════════════════════════════════" -ForegroundColor Cyan
|
||||
Write-Host ""
|
||||
|
||||
# Check if running as administrator
|
||||
$isAdmin = ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)
|
||||
|
||||
if (-not $isAdmin) {
|
||||
Write-Host "⚠️ This script should be run as Administrator for best results" -ForegroundColor Yellow
|
||||
Write-Host " Right-click PowerShell and select 'Run as Administrator'" -ForegroundColor Yellow
|
||||
Write-Host ""
|
||||
$continue = Read-Host "Continue anyway? (y/N)"
|
||||
if ($continue -ne 'y' -and $continue -ne 'Y') {
|
||||
exit 1
|
||||
}
|
||||
Write-Host ""
|
||||
}
|
||||
|
||||
# Function to check if a command exists
|
||||
function Test-Command {
|
||||
param($Command)
|
||||
$null = Get-Command $Command -ErrorAction SilentlyContinue
|
||||
return $?
|
||||
}
|
||||
|
||||
# Function to install via Chocolatey
|
||||
function Install-ViaChocolatey {
|
||||
Write-Host "📦 Using Chocolatey package manager..." -ForegroundColor Green
|
||||
|
||||
# Check if Chocolatey is installed
|
||||
if (-not (Test-Command choco)) {
|
||||
Write-Host "Installing Chocolatey..." -ForegroundColor Yellow
|
||||
Set-ExecutionPolicy Bypass -Scope Process -Force
|
||||
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072
|
||||
Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
|
||||
|
||||
if (-not (Test-Command choco)) {
|
||||
Write-Host "❌ Failed to install Chocolatey" -ForegroundColor Red
|
||||
exit 1
|
||||
}
|
||||
Write-Host "✓ Chocolatey installed" -ForegroundColor Green
|
||||
} else {
|
||||
Write-Host "✓ Chocolatey already installed" -ForegroundColor Green
|
||||
}
|
||||
|
||||
Write-Host ""
|
||||
Write-Host "Installing dependencies via Chocolatey..." -ForegroundColor Yellow
|
||||
|
||||
# Install Go
|
||||
if (-not (Test-Command go)) {
|
||||
Write-Host "Installing Go..." -ForegroundColor Yellow
|
||||
choco install -y golang
|
||||
} else {
|
||||
Write-Host "✓ Go already installed" -ForegroundColor Green
|
||||
}
|
||||
|
||||
# Install GCC (via TDM-GCC or mingw)
|
||||
if (-not (Test-Command gcc)) {
|
||||
Write-Host "Installing MinGW-w64 (GCC)..." -ForegroundColor Yellow
|
||||
choco install -y mingw
|
||||
} else {
|
||||
Write-Host "✓ GCC already installed" -ForegroundColor Green
|
||||
}
|
||||
|
||||
# Install Git (useful for development)
|
||||
if (-not (Test-Command git)) {
|
||||
Write-Host "Installing Git..." -ForegroundColor Yellow
|
||||
choco install -y git
|
||||
} else {
|
||||
Write-Host "✓ Git already installed" -ForegroundColor Green
|
||||
}
|
||||
|
||||
# Install ffmpeg
|
||||
if (-not $SkipFFmpeg) {
|
||||
if (-not (Test-Command ffmpeg)) {
|
||||
Write-Host "Installing ffmpeg..." -ForegroundColor Yellow
|
||||
choco install -y ffmpeg
|
||||
} else {
|
||||
Write-Host "✓ ffmpeg already installed" -ForegroundColor Green
|
||||
}
|
||||
}
|
||||
|
||||
Write-Host "✓ Chocolatey installation complete" -ForegroundColor Green
|
||||
}
|
||||
|
||||
# Function to install via Scoop
|
||||
function Install-ViaScoop {
|
||||
Write-Host "📦 Using Scoop package manager..." -ForegroundColor Green
|
||||
|
||||
# Check if Scoop is installed
|
||||
if (-not (Test-Command scoop)) {
|
||||
Write-Host "Installing Scoop..." -ForegroundColor Yellow
|
||||
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser -Force
|
||||
Invoke-Expression (New-Object System.Net.WebClient).DownloadString('https://get.scoop.sh')
|
||||
|
||||
if (-not (Test-Command scoop)) {
|
||||
Write-Host "❌ Failed to install Scoop" -ForegroundColor Red
|
||||
exit 1
|
||||
}
|
||||
Write-Host "✓ Scoop installed" -ForegroundColor Green
|
||||
} else {
|
||||
Write-Host "✓ Scoop already installed" -ForegroundColor Green
|
||||
}
|
||||
|
||||
Write-Host ""
|
||||
Write-Host "Installing dependencies via Scoop..." -ForegroundColor Yellow
|
||||
|
||||
# Install Go
|
||||
if (-not (Test-Command go)) {
|
||||
Write-Host "Installing Go..." -ForegroundColor Yellow
|
||||
scoop install go
|
||||
} else {
|
||||
Write-Host "✓ Go already installed" -ForegroundColor Green
|
||||
}
|
||||
|
||||
# Install GCC
|
||||
if (-not (Test-Command gcc)) {
|
||||
Write-Host "Installing MinGW-w64 (GCC)..." -ForegroundColor Yellow
|
||||
scoop install mingw
|
||||
} else {
|
||||
Write-Host "✓ GCC already installed" -ForegroundColor Green
|
||||
}
|
||||
|
||||
# Install Git
|
||||
if (-not (Test-Command git)) {
|
||||
Write-Host "Installing Git..." -ForegroundColor Yellow
|
||||
scoop install git
|
||||
} else {
|
||||
Write-Host "✓ Git already installed" -ForegroundColor Green
|
||||
}
|
||||
|
||||
# Install ffmpeg
|
||||
if (-not $SkipFFmpeg) {
|
||||
if (-not (Test-Command ffmpeg)) {
|
||||
Write-Host "Installing ffmpeg..." -ForegroundColor Yellow
|
||||
scoop install ffmpeg
|
||||
} else {
|
||||
Write-Host "✓ ffmpeg already installed" -ForegroundColor Green
|
||||
}
|
||||
}
|
||||
|
||||
Write-Host "✓ Scoop installation complete" -ForegroundColor Green
|
||||
}
|
||||
|
||||
# Main installation logic
|
||||
Write-Host "Checking system..." -ForegroundColor Yellow
|
||||
Write-Host ""
|
||||
|
||||
# Check Windows version
|
||||
$osVersion = [System.Environment]::OSVersion.Version
|
||||
Write-Host "Windows Version: $($osVersion.Major).$($osVersion.Minor) (Build $($osVersion.Build))" -ForegroundColor Cyan
|
||||
|
||||
if ($osVersion.Major -lt 10) {
|
||||
Write-Host "⚠️ Warning: Windows 10 or later is recommended" -ForegroundColor Yellow
|
||||
}
|
||||
Write-Host ""
|
||||
|
||||
# Choose package manager
|
||||
if ($UseScoop) {
|
||||
Install-ViaScoop
|
||||
} else {
|
||||
# Check if either package manager is already installed
|
||||
$hasChoco = Test-Command choco
|
||||
$hasScoop = Test-Command scoop
|
||||
|
||||
if ($hasChoco) {
|
||||
Install-ViaChocolatey
|
||||
} elseif ($hasScoop) {
|
||||
Install-ViaScoop
|
||||
} else {
|
||||
Write-Host "No package manager detected. Choose one:" -ForegroundColor Yellow
|
||||
Write-Host " 1. Chocolatey (recommended, requires admin)" -ForegroundColor White
|
||||
Write-Host " 2. Scoop (user-level, no admin required)" -ForegroundColor White
|
||||
Write-Host ""
|
||||
$choice = Read-Host "Enter choice (1 or 2)"
|
||||
|
||||
if ($choice -eq "2") {
|
||||
Install-ViaScoop
|
||||
} else {
|
||||
Install-ViaChocolatey
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Write-Host ""
|
||||
Write-Host "════════════════════════════════════════════════════════════════" -ForegroundColor Cyan
|
||||
Write-Host "✅ DEPENDENCIES INSTALLED" -ForegroundColor Green
|
||||
Write-Host "════════════════════════════════════════════════════════════════" -ForegroundColor Cyan
|
||||
Write-Host ""
|
||||
|
||||
# Refresh environment variables
|
||||
$env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User")
|
||||
|
||||
# Verify installations
|
||||
Write-Host "Verifying installations..." -ForegroundColor Yellow
|
||||
Write-Host ""
|
||||
|
||||
if (Test-Command go) {
|
||||
$goVersion = go version
|
||||
Write-Host "✓ Go: $goVersion" -ForegroundColor Green
|
||||
} else {
|
||||
Write-Host "⚠️ Go not found in PATH (restart terminal)" -ForegroundColor Yellow
|
||||
}
|
||||
|
||||
if (Test-Command gcc) {
|
||||
$gccVersion = gcc --version | Select-Object -First 1
|
||||
Write-Host "✓ GCC: $gccVersion" -ForegroundColor Green
|
||||
} else {
|
||||
Write-Host "⚠️ GCC not found in PATH (restart terminal)" -ForegroundColor Yellow
|
||||
}
|
||||
|
||||
if (Test-Command ffmpeg) {
|
||||
$ffmpegVersion = ffmpeg -version | Select-Object -First 1
|
||||
Write-Host "✓ ffmpeg: $ffmpegVersion" -ForegroundColor Green
|
||||
} else {
|
||||
if ($SkipFFmpeg) {
|
||||
Write-Host "ℹ️ ffmpeg skipped (use -SkipFFmpeg:$false to install)" -ForegroundColor Cyan
|
||||
} else {
|
||||
Write-Host "⚠️ ffmpeg not found in PATH (restart terminal)" -ForegroundColor Yellow
|
||||
}
|
||||
}
|
||||
|
||||
if (Test-Command git) {
|
||||
$gitVersion = git --version
|
||||
Write-Host "✓ Git: $gitVersion" -ForegroundColor Green
|
||||
} else {
|
||||
Write-Host "ℹ️ Git not installed (optional)" -ForegroundColor Cyan
|
||||
}
|
||||
|
||||
Write-Host ""
|
||||
Write-Host "════════════════════════════════════════════════════════════════" -ForegroundColor Cyan
|
||||
Write-Host "🎉 Setup complete!" -ForegroundColor Green
|
||||
Write-Host ""
|
||||
Write-Host "Next steps:" -ForegroundColor Yellow
|
||||
Write-Host " 1. Restart your terminal/PowerShell" -ForegroundColor White
|
||||
Write-Host " 2. Clone VideoTools repository" -ForegroundColor White
|
||||
Write-Host " 3. Run: .\scripts\build.ps1" -ForegroundColor White
|
||||
Write-Host ""
|
||||
Write-Host "For GPU encoding support (NVIDIA):" -ForegroundColor Yellow
|
||||
Write-Host " - Ensure latest NVIDIA drivers are installed" -ForegroundColor White
|
||||
Write-Host " - NVENC will be automatically detected and used" -ForegroundColor White
|
||||
Write-Host ""
|
||||
Loading…
Reference in New Issue
Block a user