clone and build rosettax87

This commit is contained in:
2025-07-25 14:17:25 -07:00
parent d03c5ee7cc
commit 3d55a8da05
8 changed files with 272 additions and 81 deletions

View File

@@ -137,7 +137,7 @@ func createBottomBar(myWindow fyne.Window) fyne.CanvasObject {
})
// Git button
gitButton := widget.NewButton("Source Code", func() {
gitButton := widget.NewButton("Website", func() {
githubURL := "https://git.burkey.co/eburk/epochsilicon"
parsedURL, err := url.Parse(githubURL)
if err != nil {

View File

@@ -1,15 +1,18 @@
package ui
import (
"epochsilicon/pkg/log"
"epochsilicon/pkg/patching"
"errors"
"fmt"
"os"
"path/filepath"
"strings"
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/container"
"fyne.io/fyne/v2/dialog"
"fyne.io/fyne/v2/widget"
"os"
"os/exec"
"path/filepath"
"strings"
"howett.net/plist"
@@ -198,12 +201,83 @@ func showTroubleshootingPopup() {
}, currentWindow).Show()
})
// --- Build Rosettax87 Locally ---
buildRosettaButton = widget.NewButton("Build", func() {
msg := "Building rosettax87 on your computer may speed up launch times. This requires xcode-commandline-tools and Cmake to be installed. See the instructions at https://git.burkey.co/eburk/epochsilicon/README.md"
dialog.NewConfirm("Build rosettax87", msg, func(confirm bool) {
if confirm {
// Check for dependencies
if _, err := exec.LookPath("clang"); err != nil {
m := fmt.Errorf("xcode command line tools are not installed on your computer. Click the Website button in the app and read the instructions on building rosettax87 before trying again")
log.Error(m.Error())
dialog.ShowError(m, currentWindow)
return
}
if _, err := exec.LookPath("cmake"); err != nil {
m := fmt.Errorf("Cmake is not installed on your computer. Click the Website button in the app and read the instructions on building rosettax87 before trying again")
log.Error(m.Error())
dialog.ShowError(m, currentWindow)
return
}
xPath, lPath, err := patching.BuildRosetta()
if err != nil {
m := fmt.Errorf("Error building rosettax87: %v\nClick on File Issue to upload your logs and file a support issue", err)
log.Error(m.Error())
dialog.ShowError(m, currentWindow)
return
}
d := filepath.Join(paths.EpochPath, "rosettax87")
if err = os.RemoveAll(d); err != nil {
m := fmt.Errorf("Error removing existing rosettax87 directory: %v", err)
log.Error(m.Error())
dialog.ShowError(m, currentWindow)
return
}
if err = os.MkdirAll(d, 0755); err != nil {
m := fmt.Errorf("Error creating existing rosettax87 directory: %v", err)
log.Error(m.Error())
dialog.ShowError(m, currentWindow)
return
}
pathMap := map[string]string{
xPath: filepath.Join(paths.EpochPath, "rosettax87", "rosettax87"),
lPath: filepath.Join(paths.EpochPath, "rosettax87", "libRuntimeRosettax87"),
}
for srcPath, destPath := range pathMap {
fBytes, err := os.ReadFile(srcPath)
if err != nil {
errMsg := fmt.Sprintf("failed to read source file %s: %v", srcPath, err)
dialog.ShowError(errors.New(errMsg), currentWindow)
log.Debug(errMsg)
return
}
err = os.WriteFile(destPath, fBytes, 0755)
if err != nil {
errMsg := fmt.Sprintf("failed to write file %s: %v", destPath, err)
dialog.ShowError(errors.New(errMsg), currentWindow)
log.Debug(errMsg)
return
}
log.Debugf("Successfully copied %s to %s", srcPath, destPath)
}
dialog.ShowInformation("Build Successful", "Rosettax87 installed successfully.", currentWindow)
}
}, currentWindow).Show()
})
troubleshootingTitle := widget.NewLabel("Troubleshooting")
troubleshootingTitle.TextStyle = fyne.TextStyle{Bold: true}
rowCrossover := container.NewBorder(nil, nil, widget.NewLabel("CrossOver version:"), crossoverStatusShort, nil)
rowWDB := container.NewBorder(nil, nil, widget.NewLabel("Delete WDB directory (cache):"), wdbDeleteButton, nil)
rowWine := container.NewBorder(nil, nil, widget.NewLabel("Delete Wine prefixes (~/.wine & Epoch/.wine):"), wineDeleteButton, nil)
rowBuildRosetta := container.NewBorder(nil, nil, widget.NewLabel("Build Rosettax87 locally):"), buildRosettaButton, nil)
appMgmtNote := widget.NewLabel("Please ensure EpochSilicon is enabled in System Settings > Privacy & Security > App Management.")
appMgmtNote.Wrapping = fyne.TextWrapWord
appMgmtNote.TextStyle = fyne.TextStyle{Italic: true}
@@ -215,6 +289,7 @@ func showTroubleshootingPopup() {
crossoverStatusDetail,
rowWDB,
rowWine,
rowBuildRosetta,
appMgmtNote,
)

View File

@@ -61,6 +61,7 @@ var (
crossoverVersionStatusLabel *widget.RichText
wdbDeleteButton *widget.Button
wineDeleteButton *widget.Button
buildRosettaButton *widget.Button
appMgmtPermissionButton *widget.Button
troubleshootingCloseButton *widget.Button
)