aboutsummaryrefslogtreecommitdiff
path: root/deploy
diff options
context:
space:
mode:
Diffstat (limited to 'deploy')
-rw-r--r--deploy/Dockerfile.cross12
-rw-r--r--deploy/cross-build.sh13
2 files changed, 25 insertions, 0 deletions
diff --git a/deploy/Dockerfile.cross b/deploy/Dockerfile.cross
new file mode 100644
index 0000000..9a568cf
--- /dev/null
+++ b/deploy/Dockerfile.cross
@@ -0,0 +1,12 @@
+# Cross-compile the arm64 binaries on an amd64 host. The runtime image is
+# assembled later on the target host from the produced binaries.
+FROM debian:bookworm
+RUN dpkg --add-architecture arm64 \
+ && apt-get update \
+ && apt-get install -y --no-install-recommends \
+ make ca-certificates gcc-aarch64-linux-gnu \
+ libncurses-dev:arm64 libssl-dev:arm64 \
+ && rm -rf /var/lib/apt/lists/*
+COPY cross-build.sh /usr/local/bin/cross-build
+RUN chmod 0755 /usr/local/bin/cross-build
+ENTRYPOINT ["/usr/local/bin/cross-build"]
diff --git a/deploy/cross-build.sh b/deploy/cross-build.sh
new file mode 100644
index 0000000..7c90b0f
--- /dev/null
+++ b/deploy/cross-build.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+# Cross-compile bokfd/bokfctl/bokftui for aarch64. Expects the source
+# read-only at /src, writes the binaries to /out and takes the version from
+# $VERSION. Run through deploy/Dockerfile.cross.
+set -eu
+
+make -C /src -j"$(nproc)" BUILD=/tmp/build \
+ CC=aarch64-linux-gnu-gcc \
+ CFLAGS="-O2 -g -L/usr/lib/aarch64-linux-gnu" \
+ VERSION="${VERSION:-0.1.0-dev}"
+
+mkdir -p /out
+cp /tmp/build/bokfd /tmp/build/bokfctl /tmp/build/bokftui /out/