From f3557f502029a7002a50da178e4b0c06841e2cb1 Mon Sep 17 00:00:00 2001 From: lucor Date: Sun, 7 Mar 2021 19:08:26 +0100 Subject: [PATCH 01/15] Add darwin arm64 target This commit add support for the darwin arm64 target. Additionally provides: - Update Go to v1.16.0 - Update fyne cli to v2.0.1 - Add darwin arm64 target - Remove darwin 386 target Fixes #33 --- .gitignore | 1 + CHANGELOG.md | 4 +++ Makefile | 7 ++++- README.md | 35 +++++++++++++++++------ docker/README.md | 13 +++++---- docker/base/Dockerfile | 32 +++++++++------------ docker/darwin/Dockerfile | 57 +++++++++++++++++++++++++++++++++++++ internal/command/context.go | 4 +++ internal/command/darwin.go | 10 +++---- 9 files changed, 125 insertions(+), 38 deletions(-) create mode 100644 docker/darwin/Dockerfile diff --git a/.gitignore b/.gitignore index bc15cacb..7ca46b6e 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ /fyne-cross +/*.xip diff --git a/CHANGELOG.md b/CHANGELOG.md index 883c96e4..68336a04 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,10 @@ # Changelog - Fyne.io fyne-cross ## Unreleased +- Update Go to v1.16.0 +- Update fyne cli to v2.0.1 +- Add darwin arm64 target #33 +- Remove darwin 386 target - Fix android keystore path is not resolved correctly - Fix some release flags are always set even if empty - Fix appID flag should not have a default #25 diff --git a/Makefile b/Makefile index 764581dc..9420a274 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,12 @@ tag := $(shell date +"%y.%m.%d") -build-images: +base: @docker build -f ${CURDIR}/docker/base/Dockerfile -t fyneio/fyne-cross:base-latest . + +darwin: + @docker build -f ${CURDIR}/docker/darwin/Dockerfile -t fyneio/fyne-cross:darwin-latest . + +build-images: base @docker tag fyneio/fyne-cross:base-latest fyneio/fyne-cross:base-$(tag) @docker build -f ${CURDIR}/docker/linux-386/Dockerfile -t fyneio/fyne-cross:linux-386-latest . @docker tag fyneio/fyne-cross:linux-386-latest fyneio/fyne-cross:linux-386-$(tag) diff --git a/README.md b/README.md index 377501e0..bf56f0a1 100644 --- a/README.md +++ b/README.md @@ -2,13 +2,11 @@ [![CI](https://github.com/fyne-io/fyne-cross/workflows/CI/badge.svg)](https://github.com/fyne-io/fyne-cross/actions?query=workflow%3ACI) [![Go Report Card](https://goreportcard.com/badge/github.com/fyne-io/fyne-cross)](https://goreportcard.com/report/github.com/fyne-io/fyne-cross) [![GoDoc](https://godoc.org/github.com/fyne-io/fyne-cross?status.svg)](http://godoc.org/github.com/fyne-io/fyne-cross) [![version](https://img.shields.io/github/v/tag/fyne-io/fyne-cross?label=version)]() -fyne-cross is a simple tool to cross compile and create distribution packages for [Fyne](https://fyne.io) applications. - -It has been inspired by [xgo](https://github.com/karalabe/xgo) and uses a [docker image](https://hub.docker.com/r/fyneio/fyne-cross) built on top of the [golang-cross](https://github.com/docker/golang-cross) image, that includes the MinGW compiler for windows, and an OSX SDK, along with the Fyne requirements. +fyne-cross is a simple tool to cross compile and create distribution packages for [Fyne](https://fyne.io) 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/386 + - darwin/arm64 - freebsd/amd64 - linux/amd64 - linux/386 @@ -20,6 +18,7 @@ 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. @@ -109,6 +108,26 @@ fyne-cross linux fyne-cross linux -output bugs ./cmd/bugs ``` +## Build the docker image for OSX/Darwin/Apple builds +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.](https://www.apple.com/legal/sla/docs/xcode.pdf)** + +To build the image: +1. Clone this project +2. [Download Xcode](https://developer.apple.com/download/more) >= 12.4 +3. Save the XCode*.xip into the project root +4. Run: `make darwin` + +The command above will: +- install the dependencies required by [osxcross](https://github.com/tpoechtrager/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. + ## Contribute - Fork and clone the repository @@ -119,8 +138,8 @@ fyne-cross linux -output bugs ./cmd/bugs See [contributors](https://github.com/fyne-io/fyne-cross/graphs/contributors) page -## Legal note +## Credits -OSX/Darwin/Apple builds: -**[Please ensure you have read and understood the Xcode license - terms before continuing.](https://www.apple.com/legal/sla/docs/xcode.pdf)** +- [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 diff --git a/docker/README.md b/docker/README.md index 8a54d581..108498ba 100644 --- a/docker/README.md +++ b/docker/README.md @@ -4,9 +4,10 @@ This folder contains the docker images used by fyne-cross to build the Fyne appl It provides the following images: -- fyneio/fyne-cross:base -- fyneio/fyne-cross:linux-386 -- fyneio/fyne-cross:linux-arm64 -- fyneio/fyne-cross:linux-arm -- fyneio/fyne-cross:android -- fyneio/fyne-cross:freebsd +- fyneio/fyne-cross:base-latest +- fyneio/fyne-cross:darwin-latest +- fyneio/fyne-cross:linux-386-latest +- fyneio/fyne-cross:linux-arm64-latest +- fyneio/fyne-cross:linux-arm-latest +- fyneio/fyne-cross:android-latest +- fyneio/fyne-cross:freebsd-latest diff --git a/docker/base/Dockerfile b/docker/base/Dockerfile index 3344a761..c5c6f345 100644 --- a/docker/base/Dockerfile +++ b/docker/base/Dockerfile @@ -1,38 +1,34 @@ -# docker cross 1.13.15 -ARG DOCKER_CROSS_VERSION=sha256:11a04661d910f74c419623ef7880024694f9151c17578af15e86c45cdf6c8588 +ARG GO_VERSION=1.16.0 # fyne stable branch -ARG FYNE_VERSION=v2.0.0 +ARG FYNE_VERSION=v2.0.1 -# Build the fyne command utility -FROM dockercore/golang-cross@${DOCKER_CROSS_VERSION} AS fyne +FROM golang:${GO_VERSION}-buster AS tools ARG FYNE_VERSION -RUN GO111MODULE=on go get -ldflags="-w -s" -v "fyne.io/fyne/v2/cmd/fyne@${FYNE_VERSION}" -# Build the gowindres command utility -FROM dockercore/golang-cross@${DOCKER_CROSS_VERSION} AS gowindres WORKDIR /app COPY . . -RUN GO111MODULE=on go build -o /go/bin/gowindres -ldflags="-w -s" ./internal/cmd/gowindres -FROM golang:1.14.15-buster AS golang +# Install the fyne CLI tool +RUN go get -ldflags="-w -s" -v "fyne.io/fyne/v2/cmd/fyne@${FYNE_VERSION}" +# Build the gowindres CLI tool +RUN go build -o /go/bin/gowindres -ldflags="-w -s" ./internal/cmd/gowindres # Build the fyne-cross base image -FROM dockercore/golang-cross@${DOCKER_CROSS_VERSION} +FROM golang:${GO_VERSION}-buster AS base -COPY --from=fyne /go/bin/fyne /usr/local/bin -COPY --from=gowindres /go/bin/gowindres /usr/local/bin -RUN rm -rf /usr/local/go -COPY --from=golang /usr/local/go /usr/local/go +COPY --from=tools /go/bin/fyne /usr/local/bin +COPY --from=tools /go/bin/gowindres /usr/local/bin RUN apt-get update -qq \ && apt-get install -y -q --no-install-recommends \ + gosu \ + zip \ + unzip \ + # fyne deps libgl1-mesa-dev \ libegl1-mesa-dev \ libgles2-mesa-dev \ xorg-dev \ - gosu \ - zip \ - unzip \ # headers needed by xorg-dev x11proto-dev \ # deps to support wayland diff --git a/docker/darwin/Dockerfile b/docker/darwin/Dockerfile new file mode 100644 index 00000000..47af9c42 --- /dev/null +++ b/docker/darwin/Dockerfile @@ -0,0 +1,57 @@ +ARG LLVM_VERSION=12 +ARG OSX_VERSION_MIN=10.12 +ARG OSX_CROSS_COMMIT="035cc170338b7b252e3f13b0e3ccbf4411bffc41" + +## Install latest version of llvm and clang +FROM fyneio/fyne-cross:base-latest AS builder +ARG LLVM_VERSION + +RUN wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - \ + && echo "deb http://apt.llvm.org/buster/ llvm-toolchain-buster-${LLVM_VERSION} main" | tee /etc/apt/sources.list.d/llvm.list > /dev/null \ + && apt-get update \ + && apt-get install -y -q --no-install-recommends \ + clang-${LLVM_VERSION} \ + llvm-${LLVM_VERSION} \ + && apt-get -qy autoremove \ + && apt-get clean \ + && rm -r /var/lib/apt/lists/*; + +ENV PATH=/usr/lib/llvm-${LLVM_VERSION}/bin:${PATH} + +## Build osxcross toolchain +FROM builder as osxcross +ARG OSX_CROSS_COMMIT +ARG OSX_VERSION_MIN + +RUN apt-get update -qq && apt-get install -y -q --no-install-recommends \ + bzip2 \ + cmake \ + cpio \ + patch \ + libbz2-dev \ + libssl-dev \ + zlib1g-dev \ + liblzma-dev \ + libxml2-dev \ + && rm -rf /var/lib/apt/lists/* + +COPY *.xip /tmp/xcode.xip + +WORKDIR "/osxcross" + +RUN git clone https://github.com/tpoechtrager/osxcross.git . \ + && git checkout -q "${OSX_CROSS_COMMIT}" \ + && rm -rf ./.git + +RUN ./tools/gen_sdk_package_pbzx.sh /tmp/xcode.xip + +RUN mv MacOSX*.tar.bz2 tarballs + +RUN UNATTENDED=yes OSX_VERSION_MIN=${OSX_VERSION_MIN} ./build.sh + + +## Build darwin-latest image +FROM fyneio/fyne-cross:base-latest + +COPY --from=osxcross /osxcross/target /osxcross/target +ENV PATH=/osxcross/target/bin:$PATH diff --git a/internal/command/context.go b/internal/command/context.go index d7a68b6e..dedc7ed4 100644 --- a/internal/command/context.go +++ b/internal/command/context.go @@ -109,6 +109,10 @@ func makeDefaultContext(flags *CommonFlags, args []string) (Context, error) { return ctx, errors.New("build number should be greater than 0") } + if flags.AppID == "" { + return ctx, errors.New("app ID is required") + } + // the flag name that replace the deprecated output should not be used // as path. Returns error if contains \ or / // Fixes: #9 diff --git a/internal/command/darwin.go b/internal/command/darwin.go index 5979cb0e..076d4f98 100644 --- a/internal/command/darwin.go +++ b/internal/command/darwin.go @@ -17,9 +17,9 @@ const ( var ( // darwinArchSupported defines the supported target architectures on darwin - darwinArchSupported = []Architecture{ArchAmd64, Arch386} + darwinArchSupported = []Architecture{ArchAmd64, ArchArm64} // darwinImage is the fyne-cross image for the Darwin OS - darwinImage = "fyneio/fyne-cross:base-latest" + darwinImage = "fyneio/fyne-cross:darwin-latest" ) // Darwin build and package the fyne app for the darwin OS @@ -209,9 +209,9 @@ func darwinContext(flags *darwinFlags, args []string) ([]Context, error) { switch arch { case ArchAmd64: - ctx.Env = append(ctx.Env, "GOOS=darwin", "GOARCH=amd64", "CC=o32-clang") - case Arch386: - ctx.Env = append(ctx.Env, "GOOS=darwin", "GOARCH=386", "CC=o32-clang") + ctx.Env = append(ctx.Env, "CGO_CFLAGS=-mmacosx-version-min=10.12", "CGO_LDFLAGS=-mmacosx-version-min=10.12", "GOOS=darwin", "GOARCH=amd64", "CC=o64-clang") + case ArchArm64: + ctx.Env = append(ctx.Env, "GOOS=darwin", "CGO_CFLAGS=-mmacosx-version-min=10.12", "CGO_LDFLAGS=-mmacosx-version-min=10.12", "GOARCH=arm64", "CC=o64-clang") } // set context based on command-line flags From b523710adb487e7f14972c37b5f2e4968839da58 Mon Sep 17 00:00:00 2001 From: lucor Date: Sun, 7 Mar 2021 19:37:36 +0100 Subject: [PATCH 02/15] Update multistage labels --- docker/darwin/Dockerfile | 6 +++--- internal/command/darwin.go | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docker/darwin/Dockerfile b/docker/darwin/Dockerfile index 47af9c42..0547f919 100644 --- a/docker/darwin/Dockerfile +++ b/docker/darwin/Dockerfile @@ -3,7 +3,7 @@ ARG OSX_VERSION_MIN=10.12 ARG OSX_CROSS_COMMIT="035cc170338b7b252e3f13b0e3ccbf4411bffc41" ## Install latest version of llvm and clang -FROM fyneio/fyne-cross:base-latest AS builder +FROM fyneio/fyne-cross:base-latest AS darwin-base ARG LLVM_VERSION RUN wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - \ @@ -19,7 +19,7 @@ RUN wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - \ ENV PATH=/usr/lib/llvm-${LLVM_VERSION}/bin:${PATH} ## Build osxcross toolchain -FROM builder as osxcross +FROM darwin-base as osxcross ARG OSX_CROSS_COMMIT ARG OSX_VERSION_MIN @@ -51,7 +51,7 @@ RUN UNATTENDED=yes OSX_VERSION_MIN=${OSX_VERSION_MIN} ./build.sh ## Build darwin-latest image -FROM fyneio/fyne-cross:base-latest +FROM darwin-base COPY --from=osxcross /osxcross/target /osxcross/target ENV PATH=/osxcross/target/bin:$PATH diff --git a/internal/command/darwin.go b/internal/command/darwin.go index 076d4f98..66f90bf2 100644 --- a/internal/command/darwin.go +++ b/internal/command/darwin.go @@ -209,7 +209,7 @@ func darwinContext(flags *darwinFlags, args []string) ([]Context, error) { switch arch { case ArchAmd64: - ctx.Env = append(ctx.Env, "CGO_CFLAGS=-mmacosx-version-min=10.12", "CGO_LDFLAGS=-mmacosx-version-min=10.12", "GOOS=darwin", "GOARCH=amd64", "CC=o64-clang") + ctx.Env = append(ctx.Env, "GOOS=darwin", "CGO_CFLAGS=-mmacosx-version-min=10.12", "CGO_LDFLAGS=-mmacosx-version-min=10.12", "GOARCH=amd64", "CC=o64-clang") case ArchArm64: ctx.Env = append(ctx.Env, "GOOS=darwin", "CGO_CFLAGS=-mmacosx-version-min=10.12", "CGO_LDFLAGS=-mmacosx-version-min=10.12", "GOARCH=arm64", "CC=o64-clang") } From 2beff8c67194d98024967017507ef4a6996df739 Mon Sep 17 00:00:00 2001 From: lucor Date: Sun, 7 Mar 2021 19:43:14 +0100 Subject: [PATCH 03/15] Update appID check --- internal/command/context.go | 4 ---- internal/command/darwin.go | 4 ++++ 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/command/context.go b/internal/command/context.go index dedc7ed4..d7a68b6e 100644 --- a/internal/command/context.go +++ b/internal/command/context.go @@ -109,10 +109,6 @@ func makeDefaultContext(flags *CommonFlags, args []string) (Context, error) { return ctx, errors.New("build number should be greater than 0") } - if flags.AppID == "" { - return ctx, errors.New("app ID is required") - } - // the flag name that replace the deprecated output should not be used // as path. Returns error if contains \ or / // Fixes: #9 diff --git a/internal/command/darwin.go b/internal/command/darwin.go index 66f90bf2..6492045e 100644 --- a/internal/command/darwin.go +++ b/internal/command/darwin.go @@ -1,6 +1,7 @@ package command import ( + "errors" "fmt" "os" "path/filepath" @@ -201,6 +202,9 @@ func darwinContext(flags *darwinFlags, args []string) ([]Context, error) { if err != nil { return ctxs, err } + if ctx.AppID == "" { + return ctxs, errors.New("appID is mandatory") + } ctx.Architecture = arch ctx.OS = darwinOS From e072d7305d4494b4f5b29bd2bd72bf0dcd75cbb0 Mon Sep 17 00:00:00 2001 From: lucor Date: Mon, 8 Mar 2021 18:52:54 +0100 Subject: [PATCH 04/15] Update darwin image to use the Command Line Tools for Xcode --- .gitignore | 1 + README.md | 4 ++-- docker/darwin/Dockerfile | 6 +++--- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 7ca46b6e..79671ce0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /fyne-cross +/*.dmg /*.xip diff --git a/README.md b/README.md index bf56f0a1..2c8029c9 100644 --- a/README.md +++ b/README.md @@ -116,8 +116,8 @@ The docker image for the darwin image is not provided via docker hub and need to To build the image: 1. Clone this project -2. [Download Xcode](https://developer.apple.com/download/more) >= 12.4 -3. Save the XCode*.xip into the project root +2. [Download Command Line Tools for Xcode](https://developer.apple.com/download/more) >= 12.4 +3. Save the Command_Line_Tools_for_Xcode_*.dmg into the project root 4. Run: `make darwin` The command above will: diff --git a/docker/darwin/Dockerfile b/docker/darwin/Dockerfile index 0547f919..2f474adf 100644 --- a/docker/darwin/Dockerfile +++ b/docker/darwin/Dockerfile @@ -35,7 +35,7 @@ RUN apt-get update -qq && apt-get install -y -q --no-install-recommends \ libxml2-dev \ && rm -rf /var/lib/apt/lists/* -COPY *.xip /tmp/xcode.xip +COPY *.dmg /tmp/command_line_tools_for_xcode.dmg WORKDIR "/osxcross" @@ -43,9 +43,9 @@ RUN git clone https://github.com/tpoechtrager/osxcross.git . \ && git checkout -q "${OSX_CROSS_COMMIT}" \ && rm -rf ./.git -RUN ./tools/gen_sdk_package_pbzx.sh /tmp/xcode.xip +RUN ./tools/gen_sdk_package_tools_dmg.sh /tmp/command_line_tools_for_xcode.dmg -RUN mv MacOSX*.tar.bz2 tarballs +RUN mv MacOSX11*.tar.bz2 tarballs RUN UNATTENDED=yes OSX_VERSION_MIN=${OSX_VERSION_MIN} ./build.sh From 1d0ae5dd56ef48ba8f8bc9c5e91d30aaebe5d595 Mon Sep 17 00:00:00 2001 From: lucor Date: Mon, 8 Mar 2021 19:25:29 +0100 Subject: [PATCH 05/15] Add dedicated docker image for windows --- CHANGELOG.md | 1 + Makefile | 36 ++++++++++++++++++++++---------- docker/base/Dockerfile | 6 ------ docker/windows/Dockerfile | 20 ++++++++++++++++++ internal/command/windows.go | 2 +- internal/command/windows_test.go | 6 +++--- 6 files changed, 50 insertions(+), 21 deletions(-) create mode 100644 docker/windows/Dockerfile diff --git a/CHANGELOG.md b/CHANGELOG.md index 68336a04..a152b2ab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ - Update fyne cli to v2.0.1 - Add darwin arm64 target #33 - Remove darwin 386 target +- Add dedicated docker image for windows - Fix android keystore path is not resolved correctly - Fix some release flags are always set even if empty - Fix appID flag should not have a default #25 diff --git a/Makefile b/Makefile index 9420a274..51425ac6 100644 --- a/Makefile +++ b/Makefile @@ -3,33 +3,47 @@ tag := $(shell date +"%y.%m.%d") base: @docker build -f ${CURDIR}/docker/base/Dockerfile -t fyneio/fyne-cross:base-latest . -darwin: +android: base + @docker build -f ${CURDIR}/docker/android/Dockerfile -t fyneio/fyne-cross:android-latest . + +darwin: base @docker build -f ${CURDIR}/docker/darwin/Dockerfile -t fyneio/fyne-cross:darwin-latest . -build-images: base - @docker tag fyneio/fyne-cross:base-latest fyneio/fyne-cross:base-$(tag) +freebsd: base + @docker build -f ${CURDIR}/docker/freebsd/Dockerfile -t fyneio/fyne-cross:freebsd-latest . + +linux: base @docker build -f ${CURDIR}/docker/linux-386/Dockerfile -t fyneio/fyne-cross:linux-386-latest . - @docker tag fyneio/fyne-cross:linux-386-latest fyneio/fyne-cross:linux-386-$(tag) @docker build -f ${CURDIR}/docker/linux-arm/Dockerfile -t fyneio/fyne-cross:linux-arm-latest . - @docker tag fyneio/fyne-cross:linux-arm-latest fyneio/fyne-cross:linux-arm-$(tag) @docker build -f ${CURDIR}/docker/linux-arm64/Dockerfile -t fyneio/fyne-cross:linux-arm64-latest . - @docker tag fyneio/fyne-cross:linux-arm64-latest fyneio/fyne-cross:linux-arm64-$(tag) - @docker build -f ${CURDIR}/docker/android/Dockerfile -t fyneio/fyne-cross:android-latest . - @docker tag fyneio/fyne-cross:android-latest fyneio/fyne-cross:android-$(tag) - @docker build -f ${CURDIR}/docker/freebsd/Dockerfile -t fyneio/fyne-cross:freebsd-latest . + +windows: base + @docker build -f ${CURDIR}/docker/windows/Dockerfile -t fyneio/fyne-cross:windows-latest . + +# build all images for release. Note do not build darwin +build-images: base android freebsd linux windows @docker tag fyneio/fyne-cross:freebsd-latest fyneio/fyne-cross:freebsd-$(tag) push-images: $(eval TAG := $(date +"%y.%m.%d")) @docker push fyneio/fyne-cross:base-latest + @docker tag fyneio/fyne-cross:base-latest fyneio/fyne-cross:base-$(tag) @docker push fyneio/fyne-cross:base-$(tag) + @docker push fyneio/fyne-cross:android-latest + @docker tag fyneio/fyne-cross:android-latest fyneio/fyne-cross:android-$(tag) + @docker push fyneio/fyne-cross:android-$(tag) @docker push fyneio/fyne-cross:linux-386-latest + @docker tag fyneio/fyne-cross:linux-386-latest fyneio/fyne-cross:linux-386-$(tag) @docker push fyneio/fyne-cross:linux-386-$(tag) @docker push fyneio/fyne-cross:linux-arm-latest + @docker tag fyneio/fyne-cross:linux-arm-latest fyneio/fyne-cross:linux-arm-$(tag) @docker push fyneio/fyne-cross:linux-arm-$(tag) @docker push fyneio/fyne-cross:linux-arm64-latest + @docker tag fyneio/fyne-cross:linux-arm64-latest fyneio/fyne-cross:linux-arm64-$(tag) @docker push fyneio/fyne-cross:linux-arm64-$(tag) - @docker push fyneio/fyne-cross:android-latest - @docker push fyneio/fyne-cross:android-$(tag) @docker push fyneio/fyne-cross:freebsd-latest + @docker tag fyneio/fyne-cross:freebsd-latest fyneio/fyne-cross:freebsd-$(tag) @docker push fyneio/fyne-cross:freebsd-$(tag) + @docker push fyneio/fyne-cross:windows-latest + @docker tag fyneio/fyne-cross:windows-latest fyneio/fyne-cross:windows-$(tag) + @docker push fyneio/fyne-cross:windows-$(tag) diff --git a/docker/base/Dockerfile b/docker/base/Dockerfile index c5c6f345..7e8af4f9 100644 --- a/docker/base/Dockerfile +++ b/docker/base/Dockerfile @@ -5,19 +5,13 @@ ARG FYNE_VERSION=v2.0.1 FROM golang:${GO_VERSION}-buster AS tools ARG FYNE_VERSION -WORKDIR /app -COPY . . - # Install the fyne CLI tool RUN go get -ldflags="-w -s" -v "fyne.io/fyne/v2/cmd/fyne@${FYNE_VERSION}" -# Build the gowindres CLI tool -RUN go build -o /go/bin/gowindres -ldflags="-w -s" ./internal/cmd/gowindres # Build the fyne-cross base image FROM golang:${GO_VERSION}-buster AS base COPY --from=tools /go/bin/fyne /usr/local/bin -COPY --from=tools /go/bin/gowindres /usr/local/bin RUN apt-get update -qq \ && apt-get install -y -q --no-install-recommends \ diff --git a/docker/windows/Dockerfile b/docker/windows/Dockerfile new file mode 100644 index 00000000..f7f75ba0 --- /dev/null +++ b/docker/windows/Dockerfile @@ -0,0 +1,20 @@ +## Build the gowindres CLI tool +FROM fyneio/fyne-cross:base-latest AS builder + +WORKDIR /app +COPY . . + +RUN go build -o /go/bin/gowindres -ldflags="-w -s" ./internal/cmd/gowindres + +# Build the windows-base image +FROM fyneio/fyne-cross:base-latest AS windows-base + +COPY --from=builder /go/bin/gowindres /usr/local/bin + +RUN apt-get update \ + && apt-get install -y -q --no-install-recommends \ + gcc-mingw-w64 \ + parallel \ + && apt-get -qy autoremove \ + && apt-get clean \ + && rm -r /var/lib/apt/lists/*; diff --git a/internal/command/windows.go b/internal/command/windows.go index c48aea35..c09c203d 100644 --- a/internal/command/windows.go +++ b/internal/command/windows.go @@ -15,7 +15,7 @@ const ( // windowsOS it the windows OS name windowsOS = "windows" // windowsImage is the fyne-cross image for the Windows OS - windowsImage = "fyneio/fyne-cross:base-latest" + windowsImage = "fyneio/fyne-cross:windows-latest" ) var ( diff --git a/internal/command/windows_test.go b/internal/command/windows_test.go index 11314405..d27955be 100644 --- a/internal/command/windows_test.go +++ b/internal/command/windows_test.go @@ -43,7 +43,7 @@ func Test_makeWindowsContext(t *testing.T) { Architecture: "amd64", Env: []string{"GOOS=windows", "GOARCH=amd64", "CC=x86_64-w64-mingw32-gcc"}, LdFlags: []string{"-H windowsgui"}, - DockerImage: "fyneio/fyne-cross:base-latest", + DockerImage: "fyneio/fyne-cross:windows-latest", }, }, }, @@ -69,7 +69,7 @@ func Test_makeWindowsContext(t *testing.T) { OS: "windows", Architecture: "386", Env: []string{"GOOS=windows", "GOARCH=386", "CC=i686-w64-mingw32-gcc"}, - DockerImage: "fyneio/fyne-cross:base-latest", + DockerImage: "fyneio/fyne-cross:windows-latest", }, }, }, @@ -96,7 +96,7 @@ func Test_makeWindowsContext(t *testing.T) { Architecture: "amd64", Env: []string{"GOOS=windows", "GOARCH=amd64", "CC=x86_64-w64-mingw32-gcc"}, LdFlags: []string{"-X main.version=1.2.3", "-H windowsgui"}, - DockerImage: "fyneio/fyne-cross:base-latest", + DockerImage: "fyneio/fyne-cross:windows-latest", }, }, }, From 705254e7f929e52ad16a9c605eb19b4970d4b882 Mon Sep 17 00:00:00 2001 From: lucor Date: Tue, 9 Mar 2021 09:43:58 +0100 Subject: [PATCH 06/15] Fix typo in CC flag for the darwin arm64 build --- internal/command/darwin.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/command/darwin.go b/internal/command/darwin.go index 6492045e..4ed6c2e2 100644 --- a/internal/command/darwin.go +++ b/internal/command/darwin.go @@ -213,9 +213,9 @@ func darwinContext(flags *darwinFlags, args []string) ([]Context, error) { switch arch { case ArchAmd64: - ctx.Env = append(ctx.Env, "GOOS=darwin", "CGO_CFLAGS=-mmacosx-version-min=10.12", "CGO_LDFLAGS=-mmacosx-version-min=10.12", "GOARCH=amd64", "CC=o64-clang") + ctx.Env = append(ctx.Env, "GOOS=darwin", "GOARCH=amd64", "CC=o64-clang", "CGO_CFLAGS=-mmacosx-version-min=10.12", "CGO_LDFLAGS=-mmacosx-version-min=10.12") case ArchArm64: - ctx.Env = append(ctx.Env, "GOOS=darwin", "CGO_CFLAGS=-mmacosx-version-min=10.12", "CGO_LDFLAGS=-mmacosx-version-min=10.12", "GOARCH=arm64", "CC=o64-clang") + ctx.Env = append(ctx.Env, "GOOS=darwin", "GOARCH=arm64", "CC=oa64-clang", "CGO_CFLAGS=-mmacosx-version-min=10.12", "CGO_LDFLAGS=-mmacosx-version-min=10.12") } // set context based on command-line flags From f9ae7eb7f1b5b13cd04e32d15d2e92369c5cedda Mon Sep 17 00:00:00 2001 From: lucor Date: Tue, 9 Mar 2021 20:30:06 +0100 Subject: [PATCH 07/15] Fake sign darwin arm64 binaries using ldid --- internal/command/darwin.go | 8 ++++++++ internal/command/docker.go | 30 ++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/internal/command/darwin.go b/internal/command/darwin.go index 4ed6c2e2..8495ca23 100644 --- a/internal/command/darwin.go +++ b/internal/command/darwin.go @@ -127,6 +127,14 @@ func (cmd *Darwin) Run() error { return err } + if ctx.Architecture == ArchArm64 { + // arm64 arch requires that executables are signed (using any signature). + err = darwinSignBinary(ctx) + if err != nil { + return err + } + } + packageName = fmt.Sprintf("%s.app", ctx.Name) srcFile = volume.JoinPathHost(ctx.TmpDirHost(), ctx.ID, packageName) diff --git a/internal/command/docker.go b/internal/command/docker.go index fc0d0028..c46e3e4d 100644 --- a/internal/command/docker.go +++ b/internal/command/docker.go @@ -373,3 +373,33 @@ func pullImage(ctx Context) error { log.Infof("[✓] Image is up to date") return nil } + +// darwinSignBinary fake signs ARM binaries +// with ldid tool provided by osxcross +func darwinSignBinary(ctx Context) error { + log.Infof("[i] Signing arm64 binary using a fake certificate...") + + if ctx.OS != darwinOS || ctx.Architecture != ArchArm64 { + return fmt.Errorf("binary signing is supported only for darwin arm64") + } + + bin := volume.JoinPathContainer(ctx.BinDirContainer(), ctx.ID, ctx.Name) + args := []string{"ldid", "-S", bin} + + // workDir default value + workDir := ctx.WorkDirContainer() + + runOpts := Options{ + CacheEnabled: ctx.CacheEnabled, + WorkDir: workDir, + Debug: ctx.Debug, + Env: ctx.Env, + } + + err := Run(ctx.DockerImage, ctx.Volume, runOpts, args) + if err != nil { + return fmt.Errorf("could not sign the binary %s, %v", bin, err) + } + log.Infof("[✓] Signed binary: %s", bin) + return nil +} From a2003c367b4cb5e6905620716e88498811010f96 Mon Sep 17 00:00:00 2001 From: lucor Date: Tue, 9 Mar 2021 20:30:06 +0100 Subject: [PATCH 08/15] Revert "Fake sign darwin arm64 binaries using ldid" This reverts commit f9ae7eb7f1b5b13cd04e32d15d2e92369c5cedda. --- internal/command/darwin.go | 8 -------- internal/command/docker.go | 30 ------------------------------ 2 files changed, 38 deletions(-) diff --git a/internal/command/darwin.go b/internal/command/darwin.go index 8495ca23..4ed6c2e2 100644 --- a/internal/command/darwin.go +++ b/internal/command/darwin.go @@ -127,14 +127,6 @@ func (cmd *Darwin) Run() error { return err } - if ctx.Architecture == ArchArm64 { - // arm64 arch requires that executables are signed (using any signature). - err = darwinSignBinary(ctx) - if err != nil { - return err - } - } - packageName = fmt.Sprintf("%s.app", ctx.Name) srcFile = volume.JoinPathHost(ctx.TmpDirHost(), ctx.ID, packageName) diff --git a/internal/command/docker.go b/internal/command/docker.go index c46e3e4d..fc0d0028 100644 --- a/internal/command/docker.go +++ b/internal/command/docker.go @@ -373,33 +373,3 @@ func pullImage(ctx Context) error { log.Infof("[✓] Image is up to date") return nil } - -// darwinSignBinary fake signs ARM binaries -// with ldid tool provided by osxcross -func darwinSignBinary(ctx Context) error { - log.Infof("[i] Signing arm64 binary using a fake certificate...") - - if ctx.OS != darwinOS || ctx.Architecture != ArchArm64 { - return fmt.Errorf("binary signing is supported only for darwin arm64") - } - - bin := volume.JoinPathContainer(ctx.BinDirContainer(), ctx.ID, ctx.Name) - args := []string{"ldid", "-S", bin} - - // workDir default value - workDir := ctx.WorkDirContainer() - - runOpts := Options{ - CacheEnabled: ctx.CacheEnabled, - WorkDir: workDir, - Debug: ctx.Debug, - Env: ctx.Env, - } - - err := Run(ctx.DockerImage, ctx.Volume, runOpts, args) - if err != nil { - return fmt.Errorf("could not sign the binary %s, %v", bin, err) - } - log.Infof("[✓] Signed binary: %s", bin) - return nil -} From 27c55af892efebf5efae5e9fc2656a2823433452 Mon Sep 17 00:00:00 2001 From: lucor Date: Thu, 11 Mar 2021 19:24:14 +0100 Subject: [PATCH 09/15] Update Go to v1.16.1 --- docker/base/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/base/Dockerfile b/docker/base/Dockerfile index 7e8af4f9..4aa20901 100644 --- a/docker/base/Dockerfile +++ b/docker/base/Dockerfile @@ -1,4 +1,4 @@ -ARG GO_VERSION=1.16.0 +ARG GO_VERSION=1.16.1 # fyne stable branch ARG FYNE_VERSION=v2.0.1 From c95deca5377bf2366a26df195149091514b0f38a Mon Sep 17 00:00:00 2001 From: lucor Date: Fri, 12 Mar 2021 09:10:41 +0100 Subject: [PATCH 10/15] Update Go to v1.16.2 --- docker/base/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/base/Dockerfile b/docker/base/Dockerfile index 4aa20901..4cd66b8b 100644 --- a/docker/base/Dockerfile +++ b/docker/base/Dockerfile @@ -1,4 +1,4 @@ -ARG GO_VERSION=1.16.1 +ARG GO_VERSION=1.16.2 # fyne stable branch ARG FYNE_VERSION=v2.0.1 From 0d36b99709b035caef0ccf2948533be50cdfe1e7 Mon Sep 17 00:00:00 2001 From: lucor Date: Fri, 12 Mar 2021 23:35:57 +0100 Subject: [PATCH 11/15] Fix macos min verstion target for darwin arm64 --- docker/darwin/Dockerfile | 1 + internal/command/darwin.go | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/docker/darwin/Dockerfile b/docker/darwin/Dockerfile index 2f474adf..25d7090b 100644 --- a/docker/darwin/Dockerfile +++ b/docker/darwin/Dockerfile @@ -33,6 +33,7 @@ RUN apt-get update -qq && apt-get install -y -q --no-install-recommends \ zlib1g-dev \ liblzma-dev \ libxml2-dev \ + uuid-dev \ && rm -rf /var/lib/apt/lists/* COPY *.dmg /tmp/command_line_tools_for_xcode.dmg diff --git a/internal/command/darwin.go b/internal/command/darwin.go index 4ed6c2e2..e9905ca4 100644 --- a/internal/command/darwin.go +++ b/internal/command/darwin.go @@ -215,7 +215,7 @@ func darwinContext(flags *darwinFlags, args []string) ([]Context, error) { case ArchAmd64: ctx.Env = append(ctx.Env, "GOOS=darwin", "GOARCH=amd64", "CC=o64-clang", "CGO_CFLAGS=-mmacosx-version-min=10.12", "CGO_LDFLAGS=-mmacosx-version-min=10.12") case ArchArm64: - ctx.Env = append(ctx.Env, "GOOS=darwin", "GOARCH=arm64", "CC=oa64-clang", "CGO_CFLAGS=-mmacosx-version-min=10.12", "CGO_LDFLAGS=-mmacosx-version-min=10.12") + ctx.Env = append(ctx.Env, "GOOS=darwin", "GOARCH=arm64", "CC=oa64-clang", "CGO_CFLAGS=-mmacosx-version-min=11.1", "CGO_LDFLAGS=-mmacosx-version-min=11.1") } // set context based on command-line flags From 4707fa363a1c9c9efc78a48fd4768081dd25391f Mon Sep 17 00:00:00 2001 From: lucor Date: Sat, 13 Mar 2021 15:47:26 +0100 Subject: [PATCH 12/15] Add the darwin-image command --- CHANGELOG.md | 2 +- Makefile | 3 + README.md | 6 +- internal/cmd/embed/main.go | 34 +++++++ internal/command/darwin_image.go | 121 +++++++++++++++++++++++++ internal/resource/darwin_dockerfile.go | 64 +++++++++++++ main.go | 1 + 7 files changed, 226 insertions(+), 5 deletions(-) create mode 100644 internal/cmd/embed/main.go create mode 100644 internal/command/darwin_image.go create mode 100644 internal/resource/darwin_dockerfile.go diff --git a/CHANGELOG.md b/CHANGELOG.md index a152b2ab..5d1e9d6b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,7 @@ # Changelog - Fyne.io fyne-cross ## Unreleased -- Update Go to v1.16.0 +- Update Go to v1.16.2 - Update fyne cli to v2.0.1 - Add darwin arm64 target #33 - Remove darwin 386 target diff --git a/Makefile b/Makefile index 51425ac6..365cdda9 100644 --- a/Makefile +++ b/Makefile @@ -47,3 +47,6 @@ push-images: @docker push fyneio/fyne-cross:windows-latest @docker tag fyneio/fyne-cross:windows-latest fyneio/fyne-cross:windows-$(tag) @docker push fyneio/fyne-cross:windows-$(tag) + +embed: + go run internal/cmd/embed/main.go diff --git a/README.md b/README.md index 2c8029c9..24affdbe 100644 --- a/README.md +++ b/README.md @@ -115,10 +115,8 @@ The docker image for the darwin image is not provided via docker hub and need to terms before continuing.](https://www.apple.com/legal/sla/docs/xcode.pdf)** To build the image: -1. Clone this project -2. [Download Command Line Tools for Xcode](https://developer.apple.com/download/more) >= 12.4 -3. Save the Command_Line_Tools_for_Xcode_*.dmg into the project root -4. Run: `make darwin` +1. [Download Command Line Tools for Xcode](https://developer.apple.com/download/more) >= 12.4 +2. Run: `fyne-cross darwin-image --xcode-path /path/to/Command_Line_Tools_for_Xcode_.dmg` The command above will: - install the dependencies required by [osxcross](https://github.com/tpoechtrager/osxcross) to package the macOS SDK and compile the macOS cross toolchain. diff --git a/internal/cmd/embed/main.go b/internal/cmd/embed/main.go new file mode 100644 index 00000000..2fe4c9dc --- /dev/null +++ b/internal/cmd/embed/main.go @@ -0,0 +1,34 @@ +// 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 +package main + +import ( + "fmt" + "io/ioutil" + "os" + "text/template" +) + +func main() { + b, err := ioutil.ReadFile("docker/darwin/Dockerfile") + if err != nil { + fmt.Printf("could not read darwin Dockerfile, please run from the project root: %s", err) + os.Exit(1) + } + + f, err := os.Create("internal/resource/darwin_dockerfile.go") + if err != nil { + fmt.Printf("could not write embedded darwin Dockerfile, please run from the project root: %s", err) + os.Exit(1) + } + t := template.Must(template.New("dockerfile").Parse(tpl)) + t.Execute(f, fmt.Sprintf("`%s`", b)) +} + +var tpl = `// auto-generated by cmd/internal/main.go DO NOT EDIT. + +package resource + +const DockerfileDarwin = {{.}} + +` diff --git a/internal/command/darwin_image.go b/internal/command/darwin_image.go new file mode 100644 index 00000000..946b9169 --- /dev/null +++ b/internal/command/darwin_image.go @@ -0,0 +1,121 @@ +package command + +import ( + "errors" + "fmt" + "io/ioutil" + "os" + "os/exec" + "strings" + + "github.com/fyne-io/fyne-cross/internal/log" + "github.com/fyne-io/fyne-cross/internal/resource" + "github.com/fyne-io/fyne-cross/internal/volume" +) + +// DarwinImage build and package the fyne app for the freebsd OS +type DarwinImage struct { + sdkPath string +} + +// Name returns the one word command name +func (cmd *DarwinImage) Name() string { + return "darwin-image" +} + +// Description returns the command description +func (cmd *DarwinImage) Description() string { + return "Build the docker image for darwin" +} + +// Parse parses the arguments and set the usage for the command +func (cmd *DarwinImage) Parse(args []string) error { + flagSet.StringVar(&cmd.sdkPath, "xcode-path", "", "Path to the Command Line Tools for Xcode (i.e. /tmp/Command_Line_Tools_for_Xcode_12.4.dmg") + + flagSet.Usage = cmd.Usage + flagSet.Parse(args) + + if cmd.sdkPath == "" { + return errors.New("path to the Command Line Tools for Xcode using the 'xcode-path' is required.\nRun 'fyne-cross darwin-image --help' for details") + } + + i, err := os.Stat(cmd.sdkPath) + if os.IsNotExist(err) { + return fmt.Errorf("Command Line Tools for Xcode file %q does not exists", cmd.sdkPath) + } + if err != nil { + return fmt.Errorf("Command Line Tools for Xcode file %q error: %s", cmd.sdkPath, err) + } + if i.IsDir() { + return fmt.Errorf("Command Line Tools for Xcode file %q is a directory", cmd.sdkPath) + } + if !strings.HasSuffix(cmd.sdkPath, ".dmg") { + return fmt.Errorf("Command Line Tools for Xcode file must be in dmg format") + } + + return nil +} + +// Run runs the command +func (cmd *DarwinImage) Run() error { + + workDir, err := ioutil.TempDir(os.TempDir(), "fyne-cross-darwin-build") + if err != nil { + return fmt.Errorf("could not create temporary dir: %s", err) + } + defer os.RemoveAll(workDir) + + log.Info("[i] Building docker darwin image...") + log.Infof("[i] Work dir: %s", workDir) + + xcodeFile := volume.JoinPathHost(workDir, "command_line_tools_for_xcode.dmg") + log.Infof("[i] Copying the Command Line Tools for Xcode from %s to %s...", cmd.sdkPath, xcodeFile) + err = volume.Copy(cmd.sdkPath, xcodeFile) + if err != nil { + return fmt.Errorf("could not copy the Command Line Tools for Xcode file into the work dir: %s", err) + } + log.Infof("[✓] Command Line Tools for Xcode copied") + + err = ioutil.WriteFile(volume.JoinPathHost(workDir, "Dockerfile"), []byte(resource.DockerfileDarwin), 0644) + if err != nil { + return fmt.Errorf("could not create the Dockerfile into the work dir: %s", err) + } + log.Infof("[✓] Dockerfile created") + + log.Info("[i] Building docker image...") + + // run the command from the host + dockerCmd := exec.Command("docker", "build", "-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) + } + log.Infof("[✓] Docker image created: %s", darwinImage) + return nil +} + +// Usage displays the command usage +func (cmd *DarwinImage) Usage() { + data := struct { + Name string + Description string + }{ + Name: cmd.Name(), + Description: cmd.Description(), + } + + template := ` +Usage: fyne-cross {{ .Name }} [options] + +{{ .Description }} + +Options: +` + + printUsage(template, data) + flagSet.PrintDefaults() +} diff --git a/internal/resource/darwin_dockerfile.go b/internal/resource/darwin_dockerfile.go new file mode 100644 index 00000000..0b93e695 --- /dev/null +++ b/internal/resource/darwin_dockerfile.go @@ -0,0 +1,64 @@ +// auto-generated by cmd/internal/main.go DO NOT EDIT. + +package resource + +const DockerfileDarwin = `ARG LLVM_VERSION=12 +ARG OSX_VERSION_MIN=10.12 +ARG OSX_CROSS_COMMIT="035cc170338b7b252e3f13b0e3ccbf4411bffc41" + +## Install latest version of llvm and clang +FROM fyneio/fyne-cross:base-latest AS darwin-base +ARG LLVM_VERSION + +RUN wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - \ + && echo "deb http://apt.llvm.org/buster/ llvm-toolchain-buster-${LLVM_VERSION} main" | tee /etc/apt/sources.list.d/llvm.list > /dev/null \ + && apt-get update \ + && apt-get install -y -q --no-install-recommends \ + clang-${LLVM_VERSION} \ + llvm-${LLVM_VERSION} \ + && apt-get -qy autoremove \ + && apt-get clean \ + && rm -r /var/lib/apt/lists/*; + +ENV PATH=/usr/lib/llvm-${LLVM_VERSION}/bin:${PATH} + +## Build osxcross toolchain +FROM darwin-base as osxcross +ARG OSX_CROSS_COMMIT +ARG OSX_VERSION_MIN + +RUN apt-get update -qq && apt-get install -y -q --no-install-recommends \ + bzip2 \ + cmake \ + cpio \ + patch \ + libbz2-dev \ + libssl-dev \ + zlib1g-dev \ + liblzma-dev \ + libxml2-dev \ + uuid-dev \ + && rm -rf /var/lib/apt/lists/* + +COPY *.dmg /tmp/command_line_tools_for_xcode.dmg + +WORKDIR "/osxcross" + +RUN git clone https://github.com/tpoechtrager/osxcross.git . \ + && git checkout -q "${OSX_CROSS_COMMIT}" \ + && rm -rf ./.git + +RUN ./tools/gen_sdk_package_tools_dmg.sh /tmp/command_line_tools_for_xcode.dmg + +RUN mv MacOSX11*.tar.bz2 tarballs + +RUN UNATTENDED=yes OSX_VERSION_MIN=${OSX_VERSION_MIN} ./build.sh + + +## Build darwin-latest image +FROM darwin-base + +COPY --from=osxcross /osxcross/target /osxcross/target +ENV PATH=/osxcross/target/bin:$PATH +` + diff --git a/main.go b/main.go index ecd3869a..cae8faf3 100644 --- a/main.go +++ b/main.go @@ -11,6 +11,7 @@ func main() { // Define the command to use commands := []command.Command{ + &command.DarwinImage{}, &command.Darwin{}, &command.Linux{}, &command.Windows{}, From 372df38a15a3423b5f48d133cde686d593070a16 Mon Sep 17 00:00:00 2001 From: lucor Date: Sat, 13 Mar 2021 15:59:47 +0100 Subject: [PATCH 13/15] Update CHANGELOG --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5d1e9d6b..5cf9d4ee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ - Update Go to v1.16.2 - Update fyne cli to v2.0.1 - Add darwin arm64 target #33 +- Add the `darwin-image` command to build the darwin docker image - Remove darwin 386 target - Add dedicated docker image for windows - Fix android keystore path is not resolved correctly From 3aab2eccbc7048972036117f413136d09ea49087 Mon Sep 17 00:00:00 2001 From: lucor Date: Sat, 13 Mar 2021 16:01:13 +0100 Subject: [PATCH 14/15] Makes CI test for goimports happy --- internal/cmd/embed/main.go | 1 - internal/resource/darwin_dockerfile.go | 1 - 2 files changed, 2 deletions(-) diff --git a/internal/cmd/embed/main.go b/internal/cmd/embed/main.go index 2fe4c9dc..ddfb707e 100644 --- a/internal/cmd/embed/main.go +++ b/internal/cmd/embed/main.go @@ -30,5 +30,4 @@ var tpl = `// auto-generated by cmd/internal/main.go DO NOT EDIT. package resource const DockerfileDarwin = {{.}} - ` diff --git a/internal/resource/darwin_dockerfile.go b/internal/resource/darwin_dockerfile.go index 0b93e695..2f3c9fdd 100644 --- a/internal/resource/darwin_dockerfile.go +++ b/internal/resource/darwin_dockerfile.go @@ -61,4 +61,3 @@ FROM darwin-base COPY --from=osxcross /osxcross/target /osxcross/target ENV PATH=/osxcross/target/bin:$PATH ` - From 5e2241a15190731ce40a9f965d32430c873bd443 Mon Sep 17 00:00:00 2001 From: lucor Date: Mon, 15 Mar 2021 09:19:34 +0100 Subject: [PATCH 15/15] Fix clang missed in freebsd image --- docker/freebsd/Dockerfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docker/freebsd/Dockerfile b/docker/freebsd/Dockerfile index 072f780a..659cc8db 100644 --- a/docker/freebsd/Dockerfile +++ b/docker/freebsd/Dockerfile @@ -25,6 +25,8 @@ RUN apt-get update -qq \ libxml2-dev \ libzstd-dev \ bsdtar \ + clang \ + llvm \ && mkdir /pkg \ && curl -L https://github.com/freebsd/pkg/archive/1.12.0.tar.gz | bsdtar -xf - -C /pkg \ && cd /pkg/pkg-* \