https://github.com/fyne-io/fyne-cross
Cross compiler tool for Fyne apps
https://github.com/fyne-io/fyne-cross
cross-platform docker fyne go golang hacktoberfest
Last synced: 15 days ago
JSON representation
Cross compiler tool for Fyne apps
- Host: GitHub
- URL: https://github.com/fyne-io/fyne-cross
- Owner: fyne-io
- License: bsd-3-clause
- Created: 2020-10-15T13:44:57.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2025-03-24T02:47:12.000Z (about 1 month ago)
- Last Synced: 2025-04-01T00:33:48.957Z (22 days ago)
- Topics: cross-platform, docker, fyne, go, golang, hacktoberfest
- Language: Go
- Homepage:
- Size: 1000 KB
- Stars: 263
- Watchers: 11
- Forks: 54
- Open Issues: 61
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# Fyne Cross
[](https://github.com/fyne-io/fyne-cross/actions?query=workflow%3ACI) [](https://goreportcard.com/report/github.com/fyne-io/fyne-cross) [](http://godoc.org/github.com/fyne-io/fyne-cross) []()
fyne-cross is a simple tool to cross compile and create distribution packages
for [Fyne](https://fyne.io) 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](https://developer.android.com/ndk/guides/abis))
- android/386
- android/amd64
- android/arm
- android/arm64
- ios> Note:
>
> - iOS compilation is supported only on darwin hosts. See [fyne pre-requisites](https://developer.fyne.io/started/#prerequisites) 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) 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, see the [Extract the macOS SDK](#extract_macos_sdk) section below.
> - cross-compile from `darwin` to `darwin` 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.## Requirements
- go >= 1.19
- docker### Installation
```sh
go install github.com/fyne-io/fyne-cross@latest
```To install a fyne-cross with kubernetes engine support:
```sh
go install -tags k8s github.com/fyne-io/fyne-cross@latest
```> `fyne-cross` will be installed in GOPATH/bin, unless GOBIN is set.
### Updating docker images
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:
```sh
fyne-cross linux --pull
```will pull only the `fyne-cross:base-latest` image required to cross compile for linux target.
## Usage
```sh
fyne-cross [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 informationUse "fyne-cross -help" for more information about a command.
```### Wildcards
The `arch` flag support wildcards in case want to compile against all supported GOARCH for a specified GOOS
Example:
```sh
fyne-cross windows -arch=*
```is equivalent to
```sh
fyne-cross windows -arch=amd64,386
```## Example
The example below cross compile and package the [fyne examples application](https://github.com/fyne-io/examples)
```
git clone https://github.com/fyne-io/examples.git
cd examples
```### Compile and package the main example app
```sh
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 .`### Compile and package a particular example app
```sh
fyne-cross linux -output bugs ./cmd/bugs
```## Extract the macOS SDK for OSX/Darwin/Apple cross-compiling
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.](https://www.apple.com/legal/sla/docs/xcode.pdf)**
To extract the SDKs:
1. [Download Command Line Tools for Xcode](https://developer.apple.com/download/all/?q=Command%20Line%20Tools) 12.5.1 (macOS SDK 11.3)
2. Run: `fyne-cross darwin-sdk-extract --xcode-path /path/to/Command_Line_Tools_for_Xcode_12.5.1.dmg`- Once extraction has been done, you should have a SDKs directory created.
This directory should contains at least 2 SDKs (ex. `SDKs/MacOSX11.3.sdk/` and `SDKs/MacOSX10.15.sdk/`)3. 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/MacOSX11.3.sdk -app-id your.app.id`> Note: current version supports only MacOS SDK 11.3
## Contribute
- Fork and clone the repository
- Make and test your changes
- Open a pull request against the `develop` branch### Contributors
See [contributors](https://github.com/fyne-io/fyne-cross/graphs/contributors) page
## Credits
- [osxcross](https://github.com/tpoechtrager/osxcross) for the macOS Cross toolchain for Linux
- [golang-cross](https://github.com/docker/golang-cross) for the inspiration and the docker images used in the initial versions
- [xgo](https://github.com/karalabe/xgo) for the inspiration