added option to build for windows on linux

This commit is contained in:
partisan 2025-05-08 20:50:03 +02:00
parent a13f43086f
commit 4de8657894

19
main.go
View file

@ -8,6 +8,7 @@ import (
"path/filepath"
"runtime"
"spitfire-builder/spitfire"
"strings"
"time"
//"errors"
)
@ -215,6 +216,12 @@ func BuildProcess() (string, error) {
if err := spitfire.ApplyPatches(sourcePath, patchesRepo, "pre-compile-patches", filepath.Join(sourcePath, "patcher"), skipPatchUpdate); err != nil {
return "", fmt.Errorf("❌ pre-patch: %w", err)
}
if strings.ToLower(platform) == "windows" {
fmt.Println("🪟 Applying Windows-specific patches...")
if err := spitfire.ApplyPatches(sourcePath, patchesRepo, "os-windows", filepath.Join(sourcePath, "patcher"), skipPatchUpdate); err != nil {
return "", fmt.Errorf("❌ windows-specific patches: %w", err)
}
}
if err := spitfire.Configure(sourcePath); err != nil {
return "", fmt.Errorf("❌ configure: %w", err)
}
@ -240,6 +247,12 @@ func BuildProcess() (string, error) {
if err := spitfire.ApplyPatches(sourcePath, patchesRepo, "pre-compile-patches", filepath.Join(sourcePath, "patcher"), skipPatchUpdate); err != nil {
return "", fmt.Errorf("❌ pre-patch: %w", err)
}
if strings.ToLower(platform) == "windows" {
fmt.Println("🪟 Applying Windows-specific patches...")
if err := spitfire.ApplyPatches(sourcePath, patchesRepo, "os-windows", filepath.Join(sourcePath, "patcher"), skipPatchUpdate); err != nil {
return "", fmt.Errorf("❌ windows-specific patches: %w", err)
}
}
}
if err := spitfire.Configure(sourcePath); err != nil {
return "", fmt.Errorf("❌ configure: %w", err)
@ -285,6 +298,12 @@ func BuildProcess() (string, error) {
if err := spitfire.ApplyPatches(sourcePath, patchesRepo, "pre-compile-patches", filepath.Join(sourcePath, "patcher"), skipPatchUpdate); err != nil {
return "", fmt.Errorf("❌ pre-patch: %w", err)
}
if strings.ToLower(platform) == "windows" {
fmt.Println("🪟 Applying Windows-specific patches...")
if err := spitfire.ApplyPatches(sourcePath, patchesRepo, "os-windows", filepath.Join(sourcePath, "patcher"), skipPatchUpdate); err != nil {
return "", fmt.Errorf("❌ windows-specific patches: %w", err)
}
}
fmt.Println("✅ Pre-compile patches applied")
} else if postPatch {
fmt.Println("🔧 Applying post-compile patches...")