Browse Source

tool: Add scripts and dockerfiles for cross-compiling linux arm64

pull/52/head
jld3103 3 years ago
parent
commit
d256d3e4d8
No known key found for this signature in database
GPG Key ID: 9062417B9E8EB7B3
  1. 19
      tool/Dockerfile.build
  2. 31
      tool/build-neon.sh
  3. 12
      tool/docker/build.sh

19
tool/Dockerfile.build

@ -0,0 +1,19 @@
FROM debian:stable-slim
RUN apt-get update && \
apt-get install -y --no-install-recommends \
# dependencies to install flutter
git curl unzip ca-certificates \
# dependencies to build for linux
clang cmake ninja-build pkg-config libgtk-3-dev \
# dependencies for the app
libayatana-appindicator3-dev
ARG FLUTTER_VERSION
RUN git clone -b $FLUTTER_VERSION https://github.com/flutter/flutter /flutter
ENV PATH=$PATH:/flutter/bin
RUN flutter doctor -v
RUN flutter precache --linux
ADD docker/build.sh /build.sh
CMD /build.sh

31
tool/build-neon.sh

@ -0,0 +1,31 @@
#!/bin/bash
set -euxo pipefail
cd "$(dirname "$0")/.."
arches=("amd64" "arm64")
flutter_version="$(jq ".flutterSdkVersion" -r < .fvm/fvm_config.json | cut -d "@" -f 1)"
function cleanup() {
cd packages/neon
rm -rf .packages .dart_tool
fvm flutter pub get
}
trap cleanup EXIT
for arch in "${arches[@]}"; do
docker buildx build \
--platform "linux/$arch" \
--progress plain \
-t "nextcloud-neon-build:$arch" \
--build-arg="FLUTTER_VERSION=$flutter_version" \
-f tool/Dockerfile.build \
./tool
docker run \
--platform "linux/$arch" \
--rm -it \
-e "ORIGINAL_USER=$(id -u)" \
-e "ORIGINAL_GROUP=$(id -g)" \
-v "$(pwd):/src" \
"nextcloud-neon-build:$arch"
done

12
tool/docker/build.sh

@ -0,0 +1,12 @@
#!/bin/bash
set -euxo pipefail
function cleanup() {
chown -R "$ORIGINAL_USER:$ORIGINAL_GROUP" .
}
trap cleanup EXIT
cd /src/packages/neon
rm -rf .packages .dart_tool
flutter build linux
Loading…
Cancel
Save