From 48df4ccc79b45318844d3a7f72592c7d008bded0 Mon Sep 17 00:00:00 2001 From: Glenn Date: Thu, 2 Nov 2023 12:41:59 +0100 Subject: [PATCH] feat: improve crossbuild scripts --- scripts/ci.crossbuild-debian.sh | 11 ++++ scripts/compiler.crossbuild-debian.sh | 86 +++++++++++++++++++++++++++ 2 files changed, 97 insertions(+) create mode 100755 scripts/compiler.crossbuild-debian.sh diff --git a/scripts/ci.crossbuild-debian.sh b/scripts/ci.crossbuild-debian.sh index 379052c..cfa6189 100755 --- a/scripts/ci.crossbuild-debian.sh +++ b/scripts/ci.crossbuild-debian.sh @@ -59,6 +59,17 @@ docker run \ multiarch/qemu-user-static \ --reset -p yes +set -x +docker run \ + -it \ + -v "$LOCAL_PROJECT_PATH:/app" \ + -w /app \ + --rm \ + --platform linux/arm64 \ + "$DOCKER_IMAGE" + +exit 0 + set -x docker run \ -it \ diff --git a/scripts/compiler.crossbuild-debian.sh b/scripts/compiler.crossbuild-debian.sh new file mode 100755 index 0000000..54d8a6e --- /dev/null +++ b/scripts/compiler.crossbuild-debian.sh @@ -0,0 +1,86 @@ +#!/bin/sh -eu +# vim: set ts=2 sw=2 et: + +LOCAL_PROJECT_PATH="${1-$PWD}" + +TARGET_ARCH="${2-arm64}" + +DOCKER_IMAGE="" + +BUILD_COMMAND=" \ + shards build --static --release \ + && chown 1000:1000 -R bin \ + && find bin -type f -maxdepth 1 -exec mv {} {}_${TARGET_ARCH} \; \ +" + +# crystal +INSTALL_CRYSTAL=" \ + sed -i -e '/^deb/d' /etc/apt/sources.list \ + && sed -i -e '/jessie.updates/d' /etc/apt/sources.list \ + && sed -i -e 's/^# deb/deb/' /etc/apt/sources.list \ + && apt-get update" + +cat > /dev/null <