fyne-cross is a simple tool to cross compile and create distribution packages for Fyne applications using docker images that include Linux, the MinGW compiler for Windows, FreeBSD, and a macOS SDK, along with the Fyne requirements.
Supported targets are:
- darwin/amd64
- darwin/arm64
- freebsd/amd64
- freebsd/arm64
- linux/amd64
- linux/386
- linux/arm
- linux/arm64
- windows/amd64
- windows/arm64
- windows/386
- android (multiple architectures)
- android/386
- android/amd64
- android/arm
- android/arm64
- ios
Note:
- iOS compilation is supported only on darwin hosts. See fyne pre-requisites for details.
- macOS packaging for public distribution (release mode) is supported only on darwin hosts.
- windows packaging for public distribution (release mode) is supported only on windows hosts.
- starting from v1.1.0:
- cross-compile from NOT
darwin
(i.e. linux) todarwin
: requires a copy of the macOS SDK on the host. The fyne-crossdarwin-sdk-extractor
command can be used to extract the SDK from the XCode CLI Tool file, see the Extract the macOS SDK section below.- cross-compile from
darwin
todarwin
by default will use under the hood the fyne CLI tool and requires Go and the macOS SDK installed on the host.- starting from v1.4.0, Arm64 hosts are supported for all platforms except Android.
- go >= 1.14
- docker
For go >= 1.16:
go install github.com/fyne-io/fyne-cross@latest
To install a fyne-cross with kubernetes engine support:
go install -tags k8s github.com/fyne-io/fyne-cross@latest
For older go:
GO111MODULE=on go get -u 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
cross-compile from NOT darwin
(i.e. linux) to darwin
requires a copy of the macOS SDK on the host.
The fyne-cross darwin-sdk-extractor
command can be used to extract the SDK from the XCode CLI Tool file.
Please ensure you have read and understood the Xcode license terms before continuing.
To extract the SDKs:
- Download Command Line Tools for Xcode >= 12.4 (macOS SDK 11.x)
- Run:
fyne-cross darwin-sdk-extract --xcode-path /path/to/Command_Line_Tools_for_Xcode_12.5.dmg
- Once extraction has been done, you should have a SDKs directory created. This directory contains at least 2 SDKs (ex.
SDKs/MacOSX12.3.sdk/
andSDKs/MacOSX13.3.sdk/
in Command_Line_Tools_for_Xcode_14.3.1.dmg)
- Specify explicitly which SDK you want to use in your fyne-cross command with --macosx-sdk-path:
fyne-cross darwin --macosx-sdk-path /full/path/to/SDKs/MacOSX12.3.sdk -app-id your.app.id
- 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