Back to bookworm. (#1040)

This commit is contained in:
Googol Lee
2024-09-06 13:32:22 +02:00
committed by GitHub
parent 6e1e1d12ce
commit a6cbfc76f3
13 changed files with 204 additions and 140 deletions

View File

@@ -1,11 +1,42 @@
#!/bin/sh
set -euo pipefail
#!/bin/bash
set -e
apk update
if [ "$TARGETPLATFORM" == "linux/arm64" ]; then
dpkg --add-architecture arm64
DEBIAN_ARCH='arm64'
elif [ "$TARGETPLATFORM" == "linux/arm/v6" ] || [ "$TARGETPLATFORM" == "linux/arm/v7" ]; then
dpkg --add-architecture armhf
DEBIAN_ARCH='armhf'
else
dpkg --add-architecture amd64
DEBIAN_ARCH='amd64'
fi
apk add go g++ blas-dev cblas lapack-dev jpeg-dev libheif-dev
apk add dlib-dev --repository=https://dl-cdn.alpinelinux.org/alpine/edge/testing
apt-get update
# Install G++/GCC cross compilers
if [ "$DEBIAN_ARCH" == "arm64" ]; then
apt-get install -y \
g++-aarch64-linux-gnu \
libc6-dev-arm64-cross
elif [ "$DEBIAN_ARCH" == "armhf" ]; then
apt-get install -y \
g++-arm-linux-gnueabihf \
libc6-dev-armhf-cross
else
apt-get install -y \
g++-x86-64-linux-gnu \
libc6-dev-amd64-cross
fi
# Install go-face dependencies and libheif for HEIF media decoding
apt-get install -y \
libdlib-dev:${DEBIAN_ARCH} \
libblas-dev:${DEBIAN_ARCH} \
libatlas-base-dev:${DEBIAN_ARCH} \
liblapack-dev:${DEBIAN_ARCH} \
libjpeg-dev:${DEBIAN_ARCH} \
libheif-dev:${DEBIAN_ARCH}
# Install tools for development
apk add sqlite
go install github.com/cespare/reflex@latest
apt-get install -y reflex sqlite3

View File

@@ -1,9 +1,22 @@
#!/bin/sh
set -euo pipefail
#!/bin/bash
apk update
apt-get update
apt-get install -y curl libdlib19.1 ffmpeg exiftool libheif1
apk add curl libheif lapack cblas exiftool
apk add ffmpeg ffmpeg-libs ffmpeg-libavcodec ffmpeg-libavformat
apk add imagemagick imagemagick-libs imagemagick-heic imagemagick-jpeg imagemagick-raw imagemagick-tiff imagemagick-webp imagemagick-svg imagemagick-jxl
apk add dlib --repository=https://dl-cdn.alpinelinux.org/alpine/edge/testing
# Install Darktable if building for a supported architecture
if [ "${TARGETPLATFORM}" = "linux/amd64" ] || [ "${TARGETPLATFORM}" = "linux/arm64" ]; then
echo 'deb [trusted=true] https://download.opensuse.org/repositories/graphics:/darktable/Debian_12/ /' > /etc/apt/sources.list.d/darktable.list
# Release key is invalid, just trust the repo
curl -fsSL https://download.opensuse.org/repositories/graphics:/darktable/Debian_12/Release.key \
| gpg --dearmor -o /etc/apt/trusted.gpg.d/darktable.gpg
gpg --show-keys --with-fingerprint --dry-run /etc/apt/trusted.gpg.d/darktable.gpg
apt-get update
apt-get install -y darktable
fi
# Remove build dependencies and cleanup
apt-get purge -y ${BUILD_DEPENDS[@]}
apt-get autoremove -y
apt-get clean
rm -rf /var/lib/apt/lists/*

84
scripts/set_compiler_env.sh Executable file
View File

@@ -0,0 +1,84 @@
#!/bin/sh
# Script to configure environment variables for Go compiler
# to allow cross compilation
: ${TARGETPLATFORM=}
: ${TARGETOS=}
: ${TARGETARCH=}
: ${TARGETVARIANT=}
CGO_ENABLED="$(go env CGO_ENABLED)"
GOARCH="$(go env GOARCH)"
GOOS="$(go env GOOS)"
GOARM="$(go env GOARM)"
GOBIN="$(go env GOBIN)"
set -eu
if [ ! -z "$TARGETPLATFORM" ]; then
TARGETOS="$(echo $TARGETPLATFORM | cut -d"/" -f1)"
TARGETARCH="$(echo $TARGETPLATFORM | cut -d"/" -f2)"
TARGETVARIANT="$(echo $TARGETPLATFORM | cut -d"/" -f3)"
fi
if [ ! -z "$TARGETOS" ]; then
export GOOS="$TARGETOS"
fi
if [ ! -z "$TARGETARCH" ]; then
export GOARCH="$TARGETARCH"
fi
if [ "$TARGETARCH" = "arm" ]; then
if [ ! -z "$TARGETVARIANT" ]; then
case "$TARGETVARIANT" in
"v5")
export GOARM="5"
;;
"v6")
export GOARM="6"
;;
*)
export GOARM="7"
;;
esac
else
export GOARM="7"
fi
fi
if [ "$CGO_ENABLED" = "1" ]; then
case "$GOARCH" in
"amd64")
export COMPILER_ARCH="x86_64-linux-gnu"
;;
"ppc64le")
export COMPILER_ARCH="powerpc64le-linux-gnu"
;;
"s390x")
export COMPILER_ARCH="s390x-linux-gnu"
;;
"arm64")
export COMPILER_ARCH="aarch64-linux-gnu"
;;
"arm")
case "$GOARM" in
"5")
export COMPILER_ARCH="arm-linux-gnueabi"
;;
*)
export COMPILER_ARCH="arm-linux-gnueabihf"
;;
esac
;;
esac
fi
export CC="${COMPILER_ARCH}-gcc"
export CXX="${COMPILER_ARCH}-g++"
export PKG_CONFIG_PATH="/usr/lib/${COMPILER_ARCH}/pkgconfig/"
if [ -z "$GOBIN" ] && [ -n "$GOPATH" ] && [ -n "$GOARCH" ] && [ -n "$GOOS" ]; then
export PATH=${GOPATH}/bin/${GOOS}_${GOARCH}:${PATH}
fi