diff options
Diffstat (limited to 'cmd/rescribe/makefile')
-rw-r--r-- | cmd/rescribe/makefile | 81 |
1 files changed, 70 insertions, 11 deletions
diff --git a/cmd/rescribe/makefile b/cmd/rescribe/makefile index aee2114..4047ff0 100644 --- a/cmd/rescribe/makefile +++ b/cmd/rescribe/makefile @@ -1,19 +1,78 @@ # 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.go embed_darwin_amd64.go embed_darwin_arm64.go embed_linux.go embed_windows.go embed_other.go +GODEPS=gui.go main.go $(EMBEDS) +VERSION=1.3.0 + +all: dist/linux/rescribe dist/linux/wayland/rescribe dist/darwin/rescribe.zip dist/windows/rescribe.exe + +dist/linux/rescribe: $(GODEPS) + go generate mkdir -p dist/linux - GOOS=linux GOARCH=amd64 go build -o $@ . + GOOS=linux GOARCH=amd64 go build -tags embed -o $@ . + +dist/linux/wayland/rescribe: $(GODEPS) + go generate + mkdir -p dist/linux + GOOS=linux GOARCH=amd64 go build -tags embed,wayland -o $@ . + +build/darwin_amd64/rescribe: $(GODEPS) + go generate + mkdir -p build/darwin_amd64 + PATH="$(PATH):$(OSXCROSSBIN)" CC="o64-clang" CGO_ENABLED=1 GOOS=darwin GOARCH=amd64 go build -tags embed -o $@ . -dist/darwin_amd64/rescribe: - mkdir -p dist/darwin_amd64 - GOOS=darwin GOARCH=amd64 go build -o $@ . +build/darwin_arm64/rescribe: $(GODEPS) + go generate + mkdir -p build/darwin_arm64 + PATH="$(PATH):$(OSXCROSSBIN)" CC="oa64-clang" CGO_ENABLED=1 GOOS=darwin GOARCH=arm64 go build -tags embed -o $@ . -dist/darwin_arm64/rescribe: - mkdir -p dist/darwin_arm64 - GOOS=darwin GOARCH=arm64 go build -o $@ . +build/darwin/rescribe: build/darwin_amd64/rescribe build/darwin_arm64/rescribe + mkdir -p build/darwin + PATH="$(PATH):$(OSXCROSSBIN)" lipo -create build/darwin_amd64/rescribe build/darwin_arm64/rescribe -output $@ -dist/windows/rescribe.exe: +build/darwin/Rescribe.app: build/darwin/rescribe + go install fyne.io/fyne/v2/cmd/fyne@v2.1.2 + fyne package --release --certificate Rescribe --id xyz.rescribe.rescribe --tags embed --name Rescribe --exe build/darwin/rescribe --os darwin --icon icon.png --appVersion $VERSION + codesign -s Rescribe Rescribe.app + mv Rescribe.app $@ + +dist/darwin/rescribe.zip: build/darwin/Rescribe.app + mkdir -p dist/darwin + cd build/darwin; zip -r ../../dist/darwin/rescribe.zip Rescribe.app + +build/windows/rescribe-bin.exe: $(GODEPS) + go generate + mkdir -p build/windows + CC="x86_64-w64-mingw32-gcc" CGO_ENABLED=1 GOOS=windows GOARCH=amd64 go build -tags embed -o $@ . + +dist/windows/rescribe.exe: build/windows/rescribe-bin.exe mkdir -p dist/windows - GOOS=windows GOARCH=386 go build -o $@ . + CC="x86_64-w64-mingw32-gcc" fyne package --tags embed --name Rescribe --exe build/windows/rescribe-bin.exe --os windows --icon icon.png --appVersion $VERSION + mv rescribe.exe $@ + +# used for flatpak building +modules.tar.xz: ../../go.mod + go mod vendor + cd ../.. && tar c vendor | xz > cmd/rescribe/$@ + +clean: + rm -rf dist build + rm -rf ../../vendor |