fyne-cross is a simple tool to cross compile and create distribution packages for Fyne applications using docker images that include the MinGW compiler for windows, and a macOS SDK, along with the Fyne requirements.
Supported targets are:
- darwin/amd64
- darwin/arm64
- freebsd/amd64
- linux/amd64
- linux/386
- linux/arm
- linux/arm64
- windows/amd64
- windows/386
- android
- ios
Note:
- starting from v1.1.0 the image with the OSX SDK is no more available via docker hub and has to be build manually, see the Build the darwin image section below.
- iOS compilation is supported only on darwin hosts. See fyne pre-requisites for details.
- macOS packaging for public distrubution (release mode) is supported only on darwin hosts.
- windows packaging for public distrubution (release mode) is supported only on windows hosts.
- go >= 1.13
- docker
go get github.com/fyne-io/fyne-cross
fyne-cross
will be installed in GOPATH/bin, unless GOBIN is set.
To update to a newer docker image the --pull
flag can be specified.
If set, fyne-cross will attempt to pull the image required to cross compile the application for the specified target.
For example:
fyne-cross linux --pull
will pull only the fyne-cross:base-latest
image required to cross compile for linux target.
fyne-cross <command> [options]
The commands are:
darwin Build and package a fyne application for the darwin OS
linux Build and package a fyne application for the linux OS
windows Build and package a fyne application for the windows OS
android Build and package a fyne application for the android OS
ios Build and package a fyne application for the iOS OS
freebsd Build and package a fyne application for the freebsd OS
version Print the fyne-cross version information
Use "fyne-cross <command> -help" for more information about a command.
The arch
flag support wildcards in case want to compile against all supported GOARCH for a specified GOOS
Example:
fyne-cross windows -arch=*
is equivalent to
fyne-cross windows -arch=amd64,386
The example below cross compile and package the fyne examples application
git clone https://github.com/fyne-io/examples.git
cd examples
fyne-cross linux
Note: by default fyne-cross will compile the package into the current dir.
The command above is equivalent to:
fyne-cross linux .
fyne-cross linux -output bugs ./cmd/bugs
The docker image for the darwin image is not provided via docker hub and need to build manually since depends on the OSX SDK.
Please ensure you have read and understood the Xcode license terms before continuing.
To build the image:
- Clone this project
- Download Command Line Tools for Xcode >= 12.4
- Save the Command_Line_Tools_for_Xcode_*.dmg into the project root
- Run:
make darwin
The command above will:
- install the dependencies required by osxcross to package the macOS SDK and compile the macOS cross toolchain.
- package the macOS SDK
- compile the macOS cross toolchain
- create the
fyneio/fyne-cross:darwin-latest
image that will be used by fyne-cross
NOTE: the creation of the image may take several minutes and may require more than 25 GB of free disk space.
- Fork and clone the repository
- Make and test your changes
- Open a pull request against the
develop
branch
See contributors page
- osxcross for the macOS Cross toolchain for Linux
- golang-cross for the inspiration and the docker images used in the initial versions
- xgo for the inspiration