Skip to content

Commit ae42da2

Browse files
author
DaanSelen
committed
cross compile builds
1 parent 5ef080c commit ae42da2

5 files changed

Lines changed: 104 additions & 23 deletions

File tree

.github/workflows/cross-compile.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ jobs:
196196
export CGO_LDFLAGS="-static-libgcc -static-libstdc++"
197197
go-winres simply --icon ./src/Icon.png --manifest gui
198198
mv *.syso ./src
199-
go build -o ./patchworks.exe -ldflags -H=windowsgui ./src
199+
go build -o ./patchworks.exe -tags "windows" -ldflags -H=windowsgui ./src
200200
201201
- name: Compile the fyne application DEBUG style for Windows
202202
run: |

go.mod

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@ require (
1515
github.com/fyne-io/image v0.1.1 // indirect
1616
github.com/fyne-io/oksvg v0.2.0 // indirect
1717
github.com/go-gl/gl v0.0.0-20231021071112-07e5d0ea2e71 // indirect
18-
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20250301202403-da16c1255728 // indirect
18+
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20240506104042-037f3cc74f2a // indirect
1919
github.com/go-text/render v0.2.0 // indirect
2020
github.com/go-text/typesetting v0.3.3 // indirect
21-
github.com/godbus/dbus/v5 v5.2.2 // indirect
21+
github.com/godbus/dbus/v5 v5.1.0 // indirect
2222
github.com/hack-pad/go-indexeddb v0.3.2 // indirect
2323
github.com/hack-pad/safejs v0.1.0 // indirect
2424
github.com/jeandeaual/go-locale v0.0.0-20250612000132-0ef82f21eade // indirect
2525
github.com/jsummers/gobmp v0.0.0-20230614200233-a9de23ed2e25 // indirect
26-
github.com/kr/text v0.1.0 // indirect
26+
github.com/kr/text v0.2.0 // indirect
2727
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 // indirect
2828
github.com/nicksnyder/go-i18n/v2 v2.5.1 // indirect
2929
github.com/pmezard/go-difflib v1.0.0 // indirect
@@ -32,9 +32,9 @@ require (
3232
github.com/srwiley/rasterx v0.0.0-20220730225603-2ab79fcdd4ef // indirect
3333
github.com/stretchr/testify v1.11.1 // indirect
3434
github.com/yuin/goldmark v1.7.8 // indirect
35-
golang.org/x/image v0.38.0 // indirect
36-
golang.org/x/net v0.52.0 // indirect
37-
golang.org/x/sys v0.42.0 // indirect
38-
golang.org/x/text v0.35.0 // indirect
35+
golang.org/x/image v0.24.0 // indirect
36+
golang.org/x/net v0.35.0 // indirect
37+
golang.org/x/sys v0.30.0 // indirect
38+
golang.org/x/text v0.22.0 // indirect
3939
gopkg.in/yaml.v3 v3.0.1 // indirect
4040
)

go.sum

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ fyne.io/systray v1.12.0 h1:CA1Kk0e2zwFlxtc02L3QFSiIbxJ/P0n582YrZHT7aTM=
44
fyne.io/systray v1.12.0/go.mod h1:RVwqP9nYMo7h5zViCBHri2FgjXF7H2cub7MAq4NSoLs=
55
github.com/BurntSushi/toml v1.5.0 h1:W5quZX/G/csjUnuI8SUYlsHs9M38FC7znL0lIO+DvMg=
66
github.com/BurntSushi/toml v1.5.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho=
7+
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
78
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
89
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
910
github.com/felixge/fgprof v0.9.3 h1:VvyZxILNuCiUCSXtPtYmmtGvb65nqXh2QFWc0Wpf2/g=
@@ -22,16 +23,16 @@ github.com/fyne-io/oksvg v0.2.0 h1:mxcGU2dx6nwjJsSA9PCYZDuoAcsZ/OuJlvg/Q9Njfo8=
2223
github.com/fyne-io/oksvg v0.2.0/go.mod h1:dJ9oEkPiWhnTFNCmRgEze+YNprJF7YRbpjgpWS4kzoI=
2324
github.com/go-gl/gl v0.0.0-20231021071112-07e5d0ea2e71 h1:5BVwOaUSBTlVZowGO6VZGw2H/zl9nrd3eCZfYV+NfQA=
2425
github.com/go-gl/gl v0.0.0-20231021071112-07e5d0ea2e71/go.mod h1:9YTyiznxEY1fVinfM7RvRcjRHbw2xLBJ3AAGIT0I4Nw=
25-
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20250301202403-da16c1255728 h1:RkGhqHxEVAvPM0/R+8g7XRwQnHatO0KAuVcwHo8q9W8=
26-
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20250301202403-da16c1255728/go.mod h1:SyRD8YfuKk+ZXlDqYiqe1qMSqjNgtHzBTG810KUagMc=
26+
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20240506104042-037f3cc74f2a h1:vxnBhFDDT+xzxf1jTJKMKZw3H0swfWk9RpWbBbDK5+0=
27+
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20240506104042-037f3cc74f2a/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
2728
github.com/go-text/render v0.2.0 h1:LBYoTmp5jYiJ4NPqDc2pz17MLmA3wHw1dZSVGcOdeAc=
2829
github.com/go-text/render v0.2.0/go.mod h1:CkiqfukRGKJA5vZZISkjSYrcdtgKQWRa2HIzvwNN5SU=
2930
github.com/go-text/typesetting v0.3.3 h1:ihGNJU9KzdK2QRDy1Bm7FT5RFQoYb+3n3EIhI/4eaQc=
3031
github.com/go-text/typesetting v0.3.3/go.mod h1:vIRUT25mLQaSh4C8H/lIsKppQz/Gdb8Pu/tNwpi52ts=
3132
github.com/go-text/typesetting-utils v0.0.0-20250618110550-c820a94c77b8 h1:4KCscI9qYWMGTuz6BpJtbUSRzcBrUSSE0ENMJbNSrFs=
3233
github.com/go-text/typesetting-utils v0.0.0-20250618110550-c820a94c77b8/go.mod h1:3/62I4La/HBRX9TcTpBj4eipLiwzf+vhI+7whTc9V7o=
33-
github.com/godbus/dbus/v5 v5.2.2 h1:TUR3TgtSVDmjiXOgAAyaZbYmIeP3DPkld3jgKGV8mXQ=
34-
github.com/godbus/dbus/v5 v5.2.2/go.mod h1:3AAv2+hPq5rdnr5txxxRwiGjPXamgoIHgz9FPBfOp3c=
34+
github.com/godbus/dbus/v5 v5.1.0 h1:4KLkAxT3aOY8Li4FRJe/KvhoNFFxo0m6fNuFUO8QJUk=
35+
github.com/godbus/dbus/v5 v5.1.0/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
3536
github.com/google/pprof v0.0.0-20211214055906-6f57359322fd h1:1FjCyPC+syAzJ5/2S8fqdZK1R22vvA0J7JZKcuOIQ7Y=
3637
github.com/google/pprof v0.0.0-20211214055906-6f57359322fd/go.mod h1:KgnwoLYCZ8IQu3XUZ8Nc/bM9CCZFOyjUNOSygVozoDg=
3738
github.com/hack-pad/go-indexeddb v0.3.2 h1:DTqeJJYc1usa45Q5r52t01KhvlSN02+Oq+tQbSBI91A=
@@ -42,9 +43,8 @@ github.com/jeandeaual/go-locale v0.0.0-20250612000132-0ef82f21eade h1:FmusiCI1wH
4243
github.com/jeandeaual/go-locale v0.0.0-20250612000132-0ef82f21eade/go.mod h1:ZDXo8KHryOWSIqnsb/CiDq7hQUYryCgdVnxbj8tDG7o=
4344
github.com/jsummers/gobmp v0.0.0-20230614200233-a9de23ed2e25 h1:YLvr1eE6cdCqjOe972w/cYF+FjW34v27+9Vo5106B4M=
4445
github.com/jsummers/gobmp v0.0.0-20230614200233-a9de23ed2e25/go.mod h1:kLgvv7o6UM+0QSf0QjAse3wReFDsb9qbZJdfexWlrQw=
45-
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
46-
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
47-
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
46+
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
47+
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
4848
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 h1:zYyBkD/k9seD2A7fsi6Oo2LfFZAehjjQMERAvZLEDnQ=
4949
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646/go.mod h1:jpp1/29i3P1S/RLdc7JQKbRpFeM1dOBd8T9ki5s+AY8=
5050
github.com/nicksnyder/go-i18n/v2 v2.5.1 h1:IxtPxYsR9Gp60cGXjfuR/llTqV8aYMsC472zD0D1vHk=
@@ -65,14 +65,14 @@ github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu
6565
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
6666
github.com/yuin/goldmark v1.7.8 h1:iERMLn0/QJeHFhxSt3p6PeN9mGnvIKSpG9YYorDMnic=
6767
github.com/yuin/goldmark v1.7.8/go.mod h1:uzxRWxtg69N339t3louHJ7+O03ezfj6PlliRlaOzY1E=
68-
golang.org/x/image v0.38.0 h1:5l+q+Y9JDC7mBOMjo4/aPhMDcxEptsX+Tt3GgRQRPuE=
69-
golang.org/x/image v0.38.0/go.mod h1:/3f6vaXC+6CEanU4KJxbcUZyEePbyKbaLoDOe4ehFYY=
70-
golang.org/x/net v0.52.0 h1:He/TN1l0e4mmR3QqHMT2Xab3Aj3L9qjbhRm78/6jrW0=
71-
golang.org/x/net v0.52.0/go.mod h1:R1MAz7uMZxVMualyPXb+VaqGSa3LIaUqk0eEt3w36Sw=
72-
golang.org/x/sys v0.42.0 h1:omrd2nAlyT5ESRdCLYdm3+fMfNFE/+Rf4bDIQImRJeo=
73-
golang.org/x/sys v0.42.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw=
74-
golang.org/x/text v0.35.0 h1:JOVx6vVDFokkpaq1AEptVzLTpDe9KGpj5tR4/X+ybL8=
75-
golang.org/x/text v0.35.0/go.mod h1:khi/HExzZJ2pGnjenulevKNX1W67CUy0AsXcNubPGCA=
68+
golang.org/x/image v0.24.0 h1:AN7zRgVsbvmTfNyqIbbOraYL8mSwcKncEj8ofjgzcMQ=
69+
golang.org/x/image v0.24.0/go.mod h1:4b/ITuLfqYq1hqZcjofwctIhi7sZh2WaCjvsBNjjya8=
70+
golang.org/x/net v0.35.0 h1:T5GQRQb2y08kTAByq9L4/bz8cipCdA8FbRTXewonqY8=
71+
golang.org/x/net v0.35.0/go.mod h1:EglIi67kWsHKlRzzVMUD93VMSWGFOMSZgxFjparz1Qk=
72+
golang.org/x/sys v0.30.0 h1:QjkSwP/36a20jFYWkSue1YwXzLmsV5Gfq7Eiy72C1uc=
73+
golang.org/x/sys v0.30.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
74+
golang.org/x/text v0.22.0 h1:bofq7m3/HAFvbF51jz3Q9wLg3jkvSPuiZu/pD1XwgtM=
75+
golang.org/x/text v0.22.0/go.mod h1:YRoo4H8PVmsu+E3Ou7cqLVH8oXWIHVoX0jqUWALQhfY=
7676
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
7777
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU=
7878
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
//go:build linux
2+
// +build linux
3+
14
package runner
25

36
import (
@@ -55,6 +58,7 @@ func RunMeshbook(binPath, bookPath, targGroup string) (bool, string) {
5558
log.Printf("running with parameters: %v", args)
5659

5760
cmd := exec.Command(binPath, args...)
61+
5862
outputData, err := cmd.CombinedOutput()
5963
cleanData := ansi.ReplaceAllString(string(outputData), "")
6064

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
//go:build windows
2+
// +build windows
3+
4+
package runner
5+
6+
import (
7+
"log"
8+
"os"
9+
"os/exec"
10+
"regexp"
11+
"runtime"
12+
"syscall"
13+
)
14+
15+
var ansi = regexp.MustCompile(`\x1b\[[0-9;]*m`)
16+
17+
func FindMeshbookBinary() (bool, string) {
18+
var osBin string
19+
20+
switch runtime.GOOS {
21+
case "windows":
22+
osBin = "meshbook.exe"
23+
case "linux":
24+
osBin = "meshbook"
25+
default:
26+
log.Println("undefined operating system")
27+
}
28+
29+
log.Println("going to search for:", osBin)
30+
31+
binaryFound := false
32+
var binaryPath string
33+
for _, f := range []string{("./" + osBin), ("./bin/" + osBin)} {
34+
objInfo, err := os.Stat(f)
35+
36+
if err == nil && objInfo.Mode().IsRegular() {
37+
binaryFound = true
38+
binaryPath = f
39+
log.Printf("found binary at %s", f)
40+
break
41+
}
42+
}
43+
44+
if binaryFound {
45+
return true, binaryPath
46+
} else {
47+
log.Println("binary not found!")
48+
return false, ""
49+
}
50+
}
51+
52+
func RunMeshbook(binPath, bookPath, targGroup string) (bool, string) {
53+
var args []string
54+
if len(bookPath) == 0 {
55+
args = []string{"--help"}
56+
} else {
57+
args = []string{"--nograce", "--indent", "-mb", bookPath, "--group", targGroup}
58+
}
59+
log.Printf("running with parameters: %v", args)
60+
61+
cmd := exec.Command(binPath, args...)
62+
cmd.SysProcAttr = &syscall.SysProcAttr{
63+
HideWindow: true,
64+
}
65+
66+
outputData, err := cmd.CombinedOutput()
67+
cleanData := ansi.ReplaceAllString(string(outputData), "")
68+
69+
if err != nil {
70+
log.Printf("something went wrong when running the command: %v", err)
71+
log.Printf("captured output: %s", cleanData)
72+
73+
return false, cleanData
74+
} else {
75+
return true, cleanData
76+
}
77+
}

0 commit comments

Comments
 (0)