summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cmd/rescribe/makefile66
-rw-r--r--go.mod2
-rw-r--r--go.sum10
3 files changed, 64 insertions, 14 deletions
diff --git a/cmd/rescribe/makefile b/cmd/rescribe/makefile
index aee2114..21a59fb 100644
--- a/cmd/rescribe/makefile
+++ b/cmd/rescribe/makefile
@@ -1,19 +1,69 @@
# See LICENSE file for copyright and license details.
+#
+# This is a set of make(1) rules to cross compile rescribe
+# from Linux to other architectures - as we use Fyne, CGO
+# is required, so we have to do more to cross compile than
+# just rely on the standard go tools. It relies on osxcross
+# being set up for the Mac builds, and mingw-w64 being
+# installed for the Windows build.
+#
+# The standard go tools work perfectly for native builds on
+# all architectures - note that "go generate" needs to be
+# run before building to download the dependencies which are
+# embedded.
-all: dist/linux/rescribe dist/darwin_amd64/rescribe dist/darwin_arm64/rescribe dist/windows/rescribe.exe
+# For osxcross, there are many versions of the MacOS SDK
+# that are too old or too new to build Rescribe correctly.
+# SDK 11.3, as extracted from XCode 12.5.1, seems to work
+# perfectly for us.
+OSXCROSSBIN=$(HOME)/src/osxcross/target/bin
-dist/linux/rescribe:
+EMBEDS=embed_darwin_amd64.go embed_linux.go embed_windows.go gui.go embed_darwin_arm64.go embed_other.go
+GODEPS=gui.go main.go $(EMBEDS)
+
+all: dist/linux/rescribe dist/darwin_universal/Rescribe.app dist/windows/rescribe.exe
+
+dist/linux/rescribe: $(GODEPS)
+ go generate
mkdir -p dist/linux
GOOS=linux GOARCH=amd64 go build -o $@ .
-dist/darwin_amd64/rescribe:
+dist/darwin_amd64/rescribe: $(GODEPS)
+ go generate
mkdir -p dist/darwin_amd64
- GOOS=darwin GOARCH=amd64 go build -o $@ .
+ PATH="$(PATH):$(OSXCROSSBIN)" CC="o64-clang" CGO_ENABLED=1 GOOS=darwin GOARCH=amd64 go build -o $@ .
-dist/darwin_arm64/rescribe:
+dist/darwin_arm64/rescribe: $(GODEPS)
+ go generate
mkdir -p dist/darwin_arm64
- GOOS=darwin GOARCH=arm64 go build -o $@ .
+ PATH="$(PATH):$(OSXCROSSBIN)" CC="oa64-clang" CGO_ENABLED=1 GOOS=darwin GOARCH=arm64 go build -o $@ .
+
+dist/darwin_universal/rescribe: dist/darwin_amd64/rescribe dist/darwin_arm64/rescribe
+ mkdir -p dist/darwin_universal
+ PATH="$(PATH):$(OSXCROSSBIN)" lipo -create dist/darwin_amd64/rescribe dist/darwin_arm64/rescribe -output $@
+
+# TODO: remove this, once universal is confirmed working
+dist/darwin_amd64/Rescribe.app: dist/darwin_amd64/rescribe
+ go install fyne.io/fyne/v2/cmd/fyne@latest
+ fyne package --name Rescribe --exe dist/darwin_amd64/rescribe --os darwin --icon icon.png
+ mv Rescribe.app $@
-dist/windows/rescribe.exe:
+# TODO: remove this, once universal is confirmed working
+dist/darwin_arm64/Rescribe.app: dist/darwin_arm64/rescribe
+ go install fyne.io/fyne/v2/cmd/fyne@latest
+ fyne package --name Rescribe --exe dist/darwin_arm64/rescribe --os darwin --icon icon.png
+ mv Rescribe.app $@
+
+dist/darwin_universal/Rescribe.app: dist/darwin_universal/rescribe
+ go install fyne.io/fyne/v2/cmd/fyne@latest
+ fyne package --name Rescribe --exe dist/darwin_universal/rescribe --os darwin --icon icon.png
+ mv Rescribe.app $@
+
+dist/windows/rescribe-bin.exe: $(GODEPS)
+ #go generate
mkdir -p dist/windows
- GOOS=windows GOARCH=386 go build -o $@ .
+ CC="x86_64-w64-mingw32-gcc" CGO_ENABLED=1 GOOS=windows GOARCH=amd64 go build -o $@ .
+
+dist/windows/rescribe.exe: dist/windows/rescribe-bin.exe
+ CC="x86_64-w64-mingw32-gcc" fyne package --name Rescribe --exe dist/windows/rescribe-bin.exe --os windows --icon icon.png
+ mv rescribe.exe $@
diff --git a/go.mod b/go.mod
index f12564b..8ccafd9 100644
--- a/go.mod
+++ b/go.mod
@@ -3,7 +3,7 @@ module rescribe.xyz/bookpipeline
go 1.16
require (
- fyne.io/fyne/v2 v2.1.1
+ fyne.io/fyne/v2 v2.1.2
github.com/aws/aws-sdk-go v1.40.6
github.com/nickjwhite/gofpdf v1.12.7-0.20210817123627-3cbaeb9797ef
github.com/wcharczuk/go-chart/v2 v2.1.0
diff --git a/go.sum b/go.sum
index eb92ea0..69c51fc 100644
--- a/go.sum
+++ b/go.sum
@@ -1,5 +1,5 @@
-fyne.io/fyne/v2 v2.1.1 h1:3p39SwQ/rBiYODVYI4ggTuwMufWYmqaRMJvXTFg7jSw=
-fyne.io/fyne/v2 v2.1.1/go.mod h1:c1vwI38Ebd0dAdxVa6H1Pj6/+cK1xtDy61+I31g+s14=
+fyne.io/fyne/v2 v2.1.2 h1:avp9CvLAUdvE7fDMtH1tVKyjxEWHWcpow6aI6L7Kvvw=
+fyne.io/fyne/v2 v2.1.2/go.mod h1:p+E/Dh+wPW8JwR2DVcsZ9iXgR9ZKde80+Y+40Is54AQ=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/BurntSushi/toml v0.4.1/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
github.com/Kodeworks/golang-image-ico v0.0.0-20141118225523-73f0f4cfade9/go.mod h1:7uhhqiBaR4CpN0k9rMjOtjpcfGd6DG2m04zQxKnWQ0I=
@@ -17,9 +17,9 @@ github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWo
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
github.com/go-gl/gl v0.0.0-20210813123233-e4099ee2221f h1:s0O46d8fPwk9kU4k1jj76wBquMVETx7uveQD9MCIQoU=
github.com/go-gl/gl v0.0.0-20210813123233-e4099ee2221f/go.mod h1:wjpnOv6ONl2SuJSxqCPVaPZibGFdSci9HFocT9qtVYM=
-github.com/go-gl/glfw/v3.3/glfw v0.0.0-20210410170116-ea3d685f79fb h1:T6gaWBvRzJjuOrdCtg8fXXjKai2xSDqWTcKFUPuw8Tw=
-github.com/go-gl/glfw/v3.3/glfw v0.0.0-20210410170116-ea3d685f79fb/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
-github.com/go-ole/go-ole v1.2.5/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0=
+github.com/go-gl/glfw/v3.3/glfw v0.0.0-20211024062804-40e447a793be h1:Z28GdQBfKOL8tNHjvaDn3wHDO7AzTRkmAXvHvnopp98=
+github.com/go-gl/glfw/v3.3/glfw v0.0.0-20211024062804-40e447a793be/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
+github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0=
github.com/godbus/dbus/v5 v5.0.4 h1:9349emZab16e7zQvpmsbtjc18ykshndd8y2PG3sgJbA=
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
github.com/goki/freetype v0.0.0-20181231101311-fa8a33aabaff h1:W71vTCKoxtdXgnm1ECDFkfQnpdqAO00zzGXLA5yaEX8=