Skip to content

Commit

Permalink
Merge pull request #55 from lucor/image-updates-2024
Browse files Browse the repository at this point in the history
Image updates - maintenance release
  • Loading branch information
lucor authored Jan 19, 2025
2 parents b5765a5 + 250d0b6 commit fe43f4c
Show file tree
Hide file tree
Showing 14 changed files with 123 additions and 138 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ jobs:
with:
repository: fyne-io/fyne-cross
path: fyne-cross
ref: develop

- name: Checkout calcultator repository
uses: actions/checkout@v3
Expand Down
9 changes: 4 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,13 @@ linux: .linux
@$(RUNNER) tag ${REPOSITORY}:${VERSION}-linux ${REPOSITORY}:linux
@touch .linux

web: .web
.web: .base web/Dockerfile
@$(RUNNER) build --build-arg FYNE_CROSS_IMAGES_VERSION=${VERSION} --build-arg FYNE_CROSS_REPOSITORY=${REPOSITORY} -f ${CURDIR}/web/Dockerfile -t ${REPOSITORY}:${VERSION}-web .
web: base
# web image is a tag to the base image
@$(RUNNER) tag ${REPOSITORY}:${VERSION}-base ${REPOSITORY}:${VERSION}-web
@$(RUNNER) tag ${REPOSITORY}:${VERSION}-web ${REPOSITORY}:web
@touch .web

windows: base
# windows image is a tag to the base image
# windows image is a tag to the base image
@$(RUNNER) tag ${REPOSITORY}:${VERSION}-base ${REPOSITORY}:${VERSION}-windows
@$(RUNNER) tag ${REPOSITORY}:${VERSION}-windows ${REPOSITORY}:windows

Expand Down
24 changes: 6 additions & 18 deletions Makefile.multi
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ RUNNER := $(shell 2>/dev/null 1>&2 docker version && echo "docker" || echo "podm

docker-base: .docker-base
.docker-base: base/Dockerfile
@docker buildx build --platform linux/amd64,linux/arm64 -f ${CURDIR}/base/Dockerfile -t ${REPOSITORY}:${VERSION}-base -t ${REPOSITORY}:${VERSION}-windows -t ${REPOSITORY}:windows --push .
@docker buildx build --platform linux/amd64,linux/arm64 -f ${CURDIR}/base/Dockerfile -t ${REPOSITORY}:${VERSION}-base -t ${REPOSITORY}:${VERSION}-windows -t ${REPOSITORY}:windows -t ${REPOSITORY}:${VERSION}-web -t ${REPOSITORY}:web --push .
@touch .docker-base

docker-darwin: .docker-darwin
Expand Down Expand Up @@ -42,20 +42,16 @@ docker-linux: .docker-linux
@docker buildx build --platform linux/amd64,linux/arm64 --build-arg FYNE_CROSS_IMAGES_VERSION=${VERSION} --build-arg FYNE_CROSS_REPOSITORY=${REPOSITORY} -f ${CURDIR}/linux/Dockerfile -t ${REPOSITORY}:${VERSION}-linux -t ${REPOSITORY}:linux --push .
@touch .docker-linux

docker-web: .docker-web
.docker-web: docker-base web/Dockerfile
@docker buildx build --platform linux/amd64,linux/arm64 --build-arg FYNE_CROSS_IMAGES_VERSION=${VERSION} --build-arg FYNE_CROSS_REPOSITORY=${REPOSITORY} -f ${CURDIR}/web/Dockerfile -t ${REPOSITORY}:${VERSION}-web -t ${REPOSITORY}:web --push .
@touch .docker-web

docker-all: docker-base docker-darwin docker-darwin-sdk-extractor docker-freebsd docker-linux docker-web
docker-all: docker-base docker-darwin docker-darwin-sdk-extractor docker-freebsd docker-linux

podman-base: .podman-base
.podman-base: base/Dockerfile
@buildah manifest create ${VERSION}-base
@buildah bud --tag ${REPOSITORY}:${VERSION}-base --tag ${REPOSITORY}:${VERSION}-windows --manifest ${VERSION}-base --arch amd64 base
@buildah bud --tag ${REPOSITORY}:${VERSION}-base --tag ${REPOSITORY}:${VERSION}-windows --manifest ${VERSION}-base --arch arm64 base
@buildah bud --tag ${REPOSITORY}:${VERSION}-base --tag ${REPOSITORY}:${VERSION}-windows --tag ${REPOSITORY}:${VERSION}-web --manifest ${VERSION}-base --arch amd64 base
@buildah bud --tag ${REPOSITORY}:${VERSION}-base --tag ${REPOSITORY}:${VERSION}-windows --tag ${REPOSITORY}:${VERSION}-web --manifest ${VERSION}-base --arch arm64 base
@buildah manifest push --all ${VERSION}-base docker://${REPOSITORY}:${VERSION}-base
@buildah manifest push --all ${VERSION}-base docker://${REPOSITORY}:${VERSION}-windows
@buildah manifest push --all ${VERSION}-base docker://${REPOSITORY}:${VERSION}-web
@touch .podman-base

podman-linux: .podman-linux
Expand Down Expand Up @@ -116,14 +112,6 @@ podman-freebsd-arm64: .podman-freebsd-arm64

podman-freebsd: podman-freebsd-arm64 podman-freebsd-amd64

podman-web: .podman-web
.podman-web: .podman-base web/Dockerfile
@buildah manifest create ${VERSION}-web
@buildah bud --build-arg FYNE_CROSS_IMAGES_VERSION=${VERSION} --build-arg FYNE_CROSS_REPOSITORY=${REPOSITORY} --tag ${REPOSITORY}:${VERSION}-web --manifest ${VERSION}-web --arch amd64 web
@buildah bud --build-arg FYNE_CROSS_IMAGES_VERSION=${VERSION} --build-arg FYNE_CROSS_REPOSITORY=${REPOSITORY} --tag ${REPOSITORY}:${VERSION}-web --manifest ${VERSION}-web --arch arm64 web
@buildah manifest push --all ${VERSION}-web docker://${REPOSITORY}:${VERSION}-web
@touch .podman-web

podman-all: podman-darwin podman-darwin-sdk-extractor podman-freebsd podman-linux podman-web
podman-all: podman-darwin podman-darwin-sdk-extractor podman-freebsd podman-linux

all: $(RUNNER)-all
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Fyne Cross Images

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
for [Fyne](https://fyne.io) applications using docker images that include Linux,
Windows, FreeBSD, and a macOS SDK, along with the Fyne
requirements.

This project provides the docker images required by fyne-cross to cross compile.
Expand Down Expand Up @@ -35,7 +35,7 @@ The supported architectures for the host are `amd64`and `arm64`.
| web | :white_check_mark: | :white_check_mark: |

> Note:
> - darwin images should work out of the box against MacOSX SDKs 11.3.
> - darwin images work against macOS SDK 11.3. Other SDKs are not supported.
> Other SDK versions could require a different min SDK version that can specified using the `--macosx-version-min` flag
> - android NDK is not available for linux/arm64, cross-compilation from arm64 hosts won't be supported in this initial release
Expand Down
2 changes: 1 addition & 1 deletion android/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ FROM ${FYNE_CROSS_REPOSITORY}:${FYNE_CROSS_IMAGES_VERSION}-base
# Install Java
RUN apt-get update && \
apt-get upgrade -qy && \
apt-get install -qy openjdk-11-jdk p7zip-full && \
apt-get install -qy openjdk-17-jdk p7zip-full && \
apt-get -qy autoremove && \
apt-get clean && \
rm -r /var/lib/apt/lists/*;
Expand Down
49 changes: 29 additions & 20 deletions base/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
FROM debian:bullseye-slim AS base
FROM debian:bookworm-slim AS base

ENV GO_VERSION=1.22.5
# dev version of Zig to support windows-386 target
# see: https://github.com/ziglang/zig/pull/13569
ENV GO_VERSION=1.23.5
ENV GO_AMD64_CHECKSUM="cbcad4a6482107c7c7926df1608106c189417163428200ce357695cc7e01d091"
ENV GO_ARM64_CHECKSUM="47c84d332123883653b70da2db7dd57d2a865921ba4724efcdf56b5da7021db0"
ENV ZIG_VERSION=0.13.0
ENV FYNE_VERSION=v2.4.4
ENV ZIG_MINISIGN_KEY="RWSGOq2NVecA2UPNdBUZykf1CCb147pkmdtYxgb3Ti+JO/wCYvhbAb/U"
ENV FYNE_VERSION=v2.5.3
ENV FIXUID_VERSION=0.5.1
ENV MINISIGN_VERSION=0.12

# Install common dependencies

Expand Down Expand Up @@ -35,11 +37,11 @@ RUN set -eux; \
case "$arch" in \
'amd64') \
url="https://go.dev/dl/go${GO_VERSION}.linux-amd64.tar.gz";\
sha256='904b924d435eaea086515bc63235b192ea441bd8c9b198c507e85009e6e4c7f0'; \
sha256=${GO_AMD64_CHECKSUM};\
;; \
'arm64') \
url="https://go.dev/dl/go${GO_VERSION}.linux-arm64.tar.gz";\
sha256='8d21325bfcf431be3660527c1a39d3d9ad71535fabdf5041c826e44e31642b5a'; \
sha256=${GO_ARM64_CHECKSUM};\
;; \
*) echo >&2 "error: unsupported architecture '$arch'"; exit 1 ;; \
esac; \
Expand All @@ -54,40 +56,47 @@ ENV PATH $GOPATH/bin:$PATH
RUN mkdir -p "$GOPATH/src" "$GOPATH/bin" && chmod -R 777 "$GOPATH"
WORKDIR $GOPATH

# don't auto-upgrade the gotoolchain
# https://github.com/docker-library/golang/issues/472
ENV GOTOOLCHAIN=local

# Install minisign
RUN set -eux; \
curl -sSL https://github.com/jedisct1/minisign/releases/download/${MINISIGN_VERSION}/minisign-${MINISIGN_VERSION}-linux.tar.gz -o minisign.tgz; \
mkdir -p /usr/local/minisign; ls -l;\
tar -C /usr/local/minisign --strip-components=1 -zxvf minisign.tgz; \
rm minisign.tgz

# Install Zig
RUN set -eux; \
arch="$(dpkg --print-architecture)"; \
url=; \
sha256=; \
public_key=${ZIG_MINISIGN_KEY}; \
case "$arch" in \
'amd64') \
arch="x86_64";\
# dev release
# url="https://ziglang.org/builds/zig-linux-x86_64-${ZIG_VERSION}.tar.xz";\
# url="https://ziglang.org/builds/zig-linux-${arch}-${ZIG_VERSION}.tar.xz";\
# stable release
url="https://ziglang.org/download/${ZIG_VERSION}/zig-linux-x86_64-${ZIG_VERSION}.tar.xz";\
sha256='d45312e61ebcc48032b77bc4cf7fd6915c11fa16e4aad116b66c9468211230ea'; \
url="https://ziglang.org/download/${ZIG_VERSION}/zig-linux-${arch}-${ZIG_VERSION}.tar.xz";\
;; \
'arm64') \
arch="aarch64";\
# dev release
#url="https://ziglang.org/builds/zig-linux-aarch64-${ZIG_VERSION}.tar.xz";\
#url="https://ziglang.org/builds/zig-linux-${arch}-${ZIG_VERSION}.tar.xz";\
# stable release
url="https://ziglang.org/download/${ZIG_VERSION}/zig-linux-aarch64-${ZIG_VERSION}.tar.xz";\
sha256='041ac42323837eb5624068acd8b00cd5777dac4cf91179e8dad7a7e90dd0c556'; \
url="https://ziglang.org/download/${ZIG_VERSION}/zig-linux-${arch}-${ZIG_VERSION}.tar.xz";\
;; \
*) echo >&2 "error: unsupported architecture '$arch'"; exit 1 ;; \
esac; \
curl -sSL ${url} -o zig.tar.xz; \
echo ${sha256} zig.tar.xz | sha256sum -c -; \
curl -sSL ${url}.minisig -o zig.tar.xz.minisig; \
/usr/local/minisign/${arch}/minisign -Vm zig.tar.xz -P ${public_key}; \
tar -C /usr/local -Jxvf zig.tar.xz; \
mv /usr/local/zig-* /usr/local/zig; \
rm zig.tar.xz; \
rm zig.tar*; \
zig version;

# Zig: add arm-features.h from glibc source to allow build on linux arm. See https://github.com/ziglang/zig/pull/12346
# TODO: remove once 0.10.1 or greater is released
RUN curl -SsL https://raw.githubusercontent.com/ziglang/zig/d9a754e5e39f6e124b9f5be093d89ba30f16f085/lib/libc/glibc/sysdeps/arm/arm-features.h > /usr/local/zig/lib/libc/glibc/sysdeps/arm/arm-features.h

##################################################################
### Tools section
### NOTE: Ensure all tools are installed under /usr/local/bin
Expand Down
6 changes: 2 additions & 4 deletions darwin-sdk-extractor/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,14 @@ ARG FYNE_CROSS_IMAGES_VERSION
ARG FYNE_CROSS_REPOSITORY

# fyne-cross image for linux
FROM ${FYNE_CROSS_REPOSITORY}:${FYNE_CROSS_IMAGES_VERSION}-base as build
FROM ${FYNE_CROSS_REPOSITORY}:${FYNE_CROSS_IMAGES_VERSION}-base AS build

RUN set -eux; \
apt-get update; \
apt-get install -y -q --no-install-recommends \
# required to complile xar and pbzx
libxml2-dev libssl-dev zlib1g-dev liblzma-dev libbz2-dev \
; \
# remove static libs to force zig to use dynamic lib
rm /usr/lib/*-linux-gnu/lib*.a; \
apt-get -qy autoremove; \
apt-get clean; \
rm -r /var/lib/apt/lists/*;
Expand All @@ -26,7 +24,7 @@ RUN set -eux; \
cd xar/xar; CC="zig cc" ./configure; \
cd /build; \
mv /tmp/build.zig . ; \
zig build
zig build -Doptimize=ReleaseSmall


# fyne-cross image for linux
Expand Down
103 changes: 55 additions & 48 deletions darwin-sdk-extractor/resources/build.zig
Original file line number Diff line number Diff line change
@@ -1,45 +1,48 @@
const std = @import("std");

pub fn build(b: *std.build.Builder) void {
pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});

const xar = b.addStaticLibrary(.{
.name = "xar",
.root_source_file = null,
.target = target,
.optimize = optimize,
});
xar.addCSourceFiles(&.{
"xar/xar/lib/archive.c",
"xar/xar/lib/arcmod.c",
"xar/xar/lib/b64.c",
"xar/xar/lib/bzxar.c",
"xar/xar/lib/darwinattr.c",
"xar/xar/lib/data.c",
"xar/xar/lib/ea.c",
"xar/xar/lib/err.c",
"xar/xar/lib/ext2.c",
"xar/xar/lib/fbsdattr.c",
"xar/xar/lib/filetree.c",
"xar/xar/lib/hash.c",
"xar/xar/lib/io.c",
"xar/xar/lib/linuxattr.c",
"xar/xar/lib/lzmaxar.c",
"xar/xar/lib/macho.c",
"xar/xar/lib/script.c",
"xar/xar/lib/signature.c",
"xar/xar/lib/stat.c",
"xar/xar/lib/subdoc.c",
"xar/xar/lib/util.c",
"xar/xar/lib/zxar.c",
}, &[_][]const u8{});
xar.addIncludePath("xar/xar/include");
xar.addIncludePath("/usr/include");
xar.addIncludePath("/usr/include/libxml2");
xar.addIncludePath("/usr/include/x86_64-linux-gnu");
xar.addCSourceFiles(.{
.files = &[_][]const u8{
"xar/xar/lib/archive.c",
"xar/xar/lib/arcmod.c",
"xar/xar/lib/b64.c",
"xar/xar/lib/bzxar.c",
"xar/xar/lib/darwinattr.c",
"xar/xar/lib/data.c",
"xar/xar/lib/ea.c",
"xar/xar/lib/err.c",
"xar/xar/lib/ext2.c",
"xar/xar/lib/fbsdattr.c",
"xar/xar/lib/filetree.c",
"xar/xar/lib/hash.c",
"xar/xar/lib/io.c",
"xar/xar/lib/linuxattr.c",
"xar/xar/lib/lzmaxar.c",
"xar/xar/lib/macho.c",
"xar/xar/lib/script.c",
"xar/xar/lib/signature.c",
"xar/xar/lib/stat.c",
"xar/xar/lib/subdoc.c",
"xar/xar/lib/util.c",
"xar/xar/lib/zxar.c",
},
.flags = &[_][]const u8{},
});
xar.addIncludePath(b.path("xar/xar/include"));
xar.addIncludePath(.{ .cwd_relative = "/usr/include" });
xar.addIncludePath(.{ .cwd_relative = "/usr/include/libxml2" });
xar.addIncludePath(.{ .cwd_relative = "/usr/include/x86_64-linux-gnu" });
xar.defineCMacro("_GNU_SOURCE", "1");

xar.addLibraryPath("/usr/lib/x86_64-linux-gnu");
xar.addLibraryPath(.{ .cwd_relative = "/usr/lib/x86_64-linux-gnu" });
xar.linkSystemLibrary("lzma");
xar.linkSystemLibrary("bz2");
xar.linkSystemLibrary("z");
Expand All @@ -48,27 +51,29 @@ pub fn build(b: *std.build.Builder) void {
xar.linkLibC();
b.installArtifact(xar);

b.installDirectory(std.build.InstallDirectoryOptions{
.source_dir = "xar/xar/include",
b.installDirectory(.{
.source_dir = b.path("xar/xar/include"),
.install_dir = .header,
.install_subdir = "xar",
});

const xarexe = b.addExecutable(.{
.name = "xar",
.root_source_file = null,
.target = target,
.optimize = optimize,
});
xarexe.addCSourceFile("xar/xar/src/xar.c", &[_][]const u8{});
xarexe.addIncludePath("xar/xar/include");
xarexe.addIncludePath("/usr/include");
xarexe.addIncludePath("/usr/include/libxml2");
xarexe.addIncludePath("/usr/include/x86_64-linux-gnu");
xarexe.addCSourceFile(.{
.file = b.path("xar/xar/src/xar.c"),
.flags = &[_][]const u8{},
});
xarexe.addIncludePath(b.path("xar/xar/include"));
xarexe.addIncludePath(.{ .cwd_relative = "/usr/include" });
xarexe.addIncludePath(.{ .cwd_relative = "/usr/include/libxml2" });
xarexe.addIncludePath(.{ .cwd_relative = "/usr/include/x86_64-linux-gnu" });
xarexe.defineCMacro("_GNU_SOURCE", "1");

xarexe.addLibraryPath("zig-out/lib");
xarexe.addLibraryPath("/usr/lib/x86_64-linux-gnu");
xarexe.linkLibrary(xar);
xarexe.addLibraryPath(.{ .cwd_relative = "/usr/lib/x86_64-linux-gnu" });
xarexe.linkSystemLibrary("xml2");
xarexe.linkSystemLibrary("z");
xarexe.linkSystemLibrary("crypto");
Expand All @@ -81,17 +86,19 @@ pub fn build(b: *std.build.Builder) void {

const exe = b.addExecutable(.{
.name = "pbxz",
.root_source_file = null,
.target = target,
.optimize = optimize,
});
exe.addCSourceFile("pbzx/pbzx.c", &[_][]const u8{});
exe.addIncludePath("zig-out/include");
exe.addIncludePath("/usr/include");
exe.addIncludePath("/usr/include/x86_64-linux-gnu");
exe.addCSourceFile(.{
.file = b.path("pbzx/pbzx.c"),
.flags = &[_][]const u8{},
});
exe.addIncludePath(b.path("zig-out/include"));
exe.addIncludePath(.{ .cwd_relative = "/usr/include" });
exe.addIncludePath(.{ .cwd_relative = "/usr/include/x86_64-linux-gnu" });

exe.addLibraryPath("/usr/lib/x86_64-linux-gnu");
exe.addLibraryPath("zig-out/lib");
exe.linkLibrary(xar);
exe.addLibraryPath(.{ .cwd_relative = "/usr/lib/x86_64-linux-gnu" });
exe.linkSystemLibrary("xml2");
exe.linkSystemLibrary("z");
exe.linkSystemLibrary("crypto");
Expand Down
Loading

0 comments on commit fe43f4c

Please sign in to comment.