Home > OS >  Is it possible to package a Fyne app and cross-compile said app in one step?
Is it possible to package a Fyne app and cross-compile said app in one step?

Time:02-20

Fyne (https://developer.fyne.io/started/packaging) proposes a solution for packaging apps:

fyne package -os darwin -icon myapp.png

And another method for cross-compiling: https://developer.fyne.io/started/cross-compiling

I was wondering if there is a way to combine both, for instance to cross-compile and package a Fyne app on a Mac M1 for a Mac AMD.

CodePudding user response:

According to the Fyne team:

You set GOOS and CC. suggested values at developer.fyne.io/started/cross-…

With the correct environment variables set it should compile the desired architecture (GOARCH would be needed as well in that instance). However you could also compile a binary and package it by passing “fyne package … -executable ” to use a pre-built file.

CodePudding user response:

Alternative way to package a Fyne app (manually):

  1. Compile the executable for the choosen target, e.g.:
GOOS=darwin GOARCH=amd64 CGO_ENABLED=1 go build
  1. package the app manually using, for instance the following template:

github.com/codazoda/mac-app-shell

CodePudding user response:

Another alternative is to use fyne-cross which automates most of the work using docker containers. https://github.com/fyne-io/fyne-cross

  • Related