fyne-cross

command module
v0.0.0-...-2a6ebbc Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 27, 2022 License: BSD-3-Clause Imports: 3 Imported by: 0

README

Fyne Cross

CI Go Report Card GoDoc version

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/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 distrubution (release mode) is supported only on darwin hosts.
  • windows packaging for public distrubution (release mode) is supported only on windows hosts.
  • starting from v1.1.0:
    • cross-compile from NOT darwin (i.e. linux) to darwin: the image with the macOS SDK is no more available via docker hub and has to be built manually, see the Build the darwin image 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.

Requirements

  • go >= 1.14
  • docker
Installation

For go >= 1.16:

go install github.com/gavintan/fyne-cross@latest

For older go:

GO111MODULE=on go get -u github.com/gavintan/fyne-cross

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:

fyne-cross linux --pull

will pull only the fyne-cross:base-latest image required to cross compile for linux target.

Usage

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.
Wildcards

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

Example

The example below cross compile and package the fyne examples application

git clone https://github.com/fyne-io/examples.git
cd examples
Compile and package the main example app
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
fyne-cross linux -output bugs ./cmd/bugs

Build the docker image for OSX/Darwin/Apple cross-compiling

The docker image for darwin is not provided via docker hub and need to build manually since it depends on the macOS SDK.

Please ensure you have read and understood the Xcode license terms before continuing.

To build the image:

  1. Download Command Line Tools for Xcode >= 12.4 (macOS SDK 11.x)
  2. Run: fyne-cross darwin-image --xcode-path /path/to/Command_Line_Tools_for_Xcode_12.5.dmg

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
  • build the fyneio/fyne-cross:<ver>-darwin 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.

[EXPERIMENTAL] Build using a different SDK version

By default fyne-cross will attempt to auto-detect the latest version of SDK provided by the Xcode package. If for any reason a different SDK version is required, it can be specified using the --sdk-version flag.

Example:

fyne-cross darwin-image --sdk-version 11.1 --xcode-path /path/to/Command_Line_Tools_for_Xcode_12.4.dmg

Note: this feature is marked as EXPERIMENTAL

Contribute

  • Fork and clone the repository
  • Make and test your changes
  • Open a pull request against the develop branch
Contributors

See contributors page

Credits

  • 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

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
internal
cmd/embed
This file embeds resources like Dockerfiles to be used in fyne-cross TODO: move to go:embed once the go min version required by fyne-cross will be 1.16
This file embeds resources like Dockerfiles to be used in fyne-cross TODO: move to go:embed once the go min version required by fyne-cross will be 1.16
cmd/gowindres
gowindres is an utility used internally by fyne-cross to generate windows resource
gowindres is an utility used internally by fyne-cross to generate windows resource
log
Package log implements a simple logging package with severity level.
Package log implements a simple logging package with severity level.
volume
Package volume implements the docker host-container volume mounting
Package volume implements the docker host-container volume mounting

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL