Skip to content

Commit

Permalink
Merge pull request #39 from lucor/feature/darwin-arm64
Browse files Browse the repository at this point in the history
Add darwin arm64 target
  • Loading branch information
lucor committed Apr 27, 2021
2 parents a9febd8 + ab89c09 commit a0f106d
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
5 changes: 4 additions & 1 deletion README.md
Expand Up @@ -9,6 +9,7 @@ requirements.

Supported targets are:
- darwin/amd64
- darwin/arm64
- freebsd/amd64
- freebsd/arm64
- linux/amd64
Expand All @@ -21,10 +22,12 @@ Supported targets are:
- 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](#build_darwin_image) section below.
> - iOS compilation is supported only on darwin hosts. See [fyne pre-requisites](https://developer.fyne.io/started/#prerequisites) 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 OSX SDK is no more available via docker hub and has to be built manually, see the [Build the darwin image](#build_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

Expand Down
2 changes: 1 addition & 1 deletion internal/command/command.go
Expand Up @@ -109,7 +109,7 @@ func printUsage(template string, data interface{}) {
func checkFyneBinHost(ctx Context) (string, error) {
fyne, err := exec.LookPath("fyne")
if err != nil {
return "", fmt.Errorf("missed requirement: fyne. To install: `go get fyne.io/fyne/cmd/fyne` and add $GOPATH/bin to $PATH")
return "", fmt.Errorf("missed requirement: fyne. To install: `go get fyne.io/fyne/v2/cmd/fyne` and add $GOPATH/bin to $PATH")
}

if ctx.Debug {
Expand Down
4 changes: 2 additions & 2 deletions internal/command/darwin.go
Expand Up @@ -18,7 +18,7 @@ const (

var (
// darwinArchSupported defines the supported target architectures on darwin
darwinArchSupported = []Architecture{ArchAmd64}
darwinArchSupported = []Architecture{ArchAmd64, ArchArm64}
// darwinImage is the fyne-cross image for the Darwin OS
darwinImage = "fyneio/fyne-cross:1.1-darwin"
)
Expand Down Expand Up @@ -54,7 +54,7 @@ func (cmd *Darwin) Parse(args []string) error {

// Add flags to use only on darwin host
if runtime.GOOS == darwinOS {
flagSet.BoolVar(&cmd.localBuild, "local", false, "If set uses the fyne CLI tool installed on the host in place of the docker images")
flagSet.BoolVar(&cmd.localBuild, "local", true, "If set uses the fyne CLI tool installed on the host in place of the docker images")
}

// flags used only in release mode
Expand Down
6 changes: 3 additions & 3 deletions internal/command/darwin_image.go
Expand Up @@ -13,7 +13,7 @@ import (
"github.com/fyne-io/fyne-cross/internal/volume"
)

// DarwinImage build and package the fyne app for the freebsd OS
// DarwinImage builds the darwin docker image
type DarwinImage struct {
sdkPath string
}
Expand Down Expand Up @@ -85,14 +85,14 @@ func (cmd *DarwinImage) Run() error {
log.Info("[i] Building docker image...")

// run the command from the host
dockerCmd := exec.Command("docker", "build", "-t", darwinImage, ".")
dockerCmd := exec.Command("docker", "build", "--pull", "-t", darwinImage, ".")
dockerCmd.Dir = workDir
dockerCmd.Stdout = os.Stdout
dockerCmd.Stderr = os.Stderr

err = dockerCmd.Run()
if err != nil {
return fmt.Errorf("could not package the Fyne app: %v", err)
return fmt.Errorf("could not create the docker darwin image: %v", err)
}
log.Infof("[✓] Docker image created: %s", darwinImage)
return nil
Expand Down

0 comments on commit a0f106d

Please sign in to comment.