forked from dailker/everyutil-c
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.ps1
More file actions
48 lines (40 loc) · 1.29 KB
/
build.ps1
File metadata and controls
48 lines (40 loc) · 1.29 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
# PowerShell script for building the project on Windows with MSYS2/MinGW
$ErrorActionPreference = "Stop"
# Clean up m4 and build directories if they exist
Write-Host "Cleaning up m4 and build directories..."
if (Test-Path -Path "m4") { Remove-Item -Path "m4" -Recurse -Force }
if (Test-Path -Path "build") { Remove-Item -Path "build" -Recurse -Force }
# Function to check if a command exists
function Test-Command {
param (
[string]$Command
)
return Get-Command $Command -ErrorAction SilentlyContinue
}
# Check and install dependencies
$tools = @("gcc", "make", "autoreconf")
foreach ($tool in $tools) {
if (-not (Test-Command $tool)) {
Write-Host "Installing dependencies with pacman..."
& pacman -S --noconfirm autoconf gcc make
if ($LASTEXITCODE -ne 0) {
Write-Error "$tool not found and installation failed. Ensure MSYS2 is installed and pacman is accessible."
exit 1
}
break
}
}
# Run autoreconf to generate configure script
Write-Host "Running autoreconf..."
autoreconf --install
# Run configure
Write-Host "Running configure..."
.\configure
# Build the project
Write-Host "Building project..."
make clean
make
# Run tests
Write-Host "Running tests..."
make test
Write-Host "Build and test completed successfully."