CI: Improve system architecture detection in build scripts

Signed-off-by: Michael Mayer <michael@photoprism.app>
This commit is contained in:
Michael Mayer 2023-10-05 23:18:54 +02:00
parent 1e11d8986e
commit b45b20aa53
8 changed files with 29 additions and 15 deletions

View file

@ -3,18 +3,19 @@
# Build "heif-convert", "heif-enc", "heif-info", and "heif-thumbnailer" from source.
CURRENT_DIR=$(pwd)
# Query architecture.
# Determine the system architecture.
if [[ $PHOTOPRISM_ARCH ]]; then
SYSTEM_ARCH=$PHOTOPRISM_ARCH
else
SYSTEM_ARCH=$(uname -m)
fi
DESTARCH=${BUILD_ARCH:-$SYSTEM_ARCH}
. /etc/os-release
LATEST=$(curl --silent "https://api.github.com/repos/strukturag/libheif/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
LIBHEIF_VERSION=${1:-$LATEST}
DESTARCH=${2:-$SYSTEM_ARCH}
BUILD="libheif-$VERSION_CODENAME-$DESTARCH-$LIBHEIF_VERSION"

View file

@ -11,13 +11,14 @@ if [[ $(id -u) != "0" ]]; then
exit 1
fi
# Determine the system architecture.
if [[ $PHOTOPRISM_ARCH ]]; then
SYSTEM_ARCH=$PHOTOPRISM_ARCH
else
SYSTEM_ARCH=$(uname -m)
fi
DESTARCH=${2:-$SYSTEM_ARCH}
DESTARCH=${BUILD_ARCH:-$SYSTEM_ARCH}
. /etc/os-release
@ -32,7 +33,7 @@ case $DESTARCH in
;;
*)
echo "Unsupported Machine Architecture: \"$BUILD_ARCH\"" 1>&2
echo "Unsupported Machine Architecture: \"$DESTARCH\"" 1>&2
exit 0
;;
esac

View file

@ -11,13 +11,14 @@ if [[ $(id -u) != "0" ]]; then
exit 1
fi
# Determine the system architecture.
if [[ $PHOTOPRISM_ARCH ]]; then
SYSTEM_ARCH=$PHOTOPRISM_ARCH
else
SYSTEM_ARCH=$(uname -m)
fi
DESTARCH=${2:-$SYSTEM_ARCH}
DESTARCH=${BUILD_ARCH:-$SYSTEM_ARCH}
set -e
@ -56,7 +57,7 @@ case $DESTARCH in
;;
*)
echo "Unsupported Machine Architecture: \"$BUILD_ARCH\"" 1>&2
echo "Unsupported Machine Architecture: \"$DESTARCH\"" 1>&2
exit 0
;;
esac

View file

@ -17,13 +17,14 @@ then
exit 1
fi
# Determine the system architecture.
if [[ $PHOTOPRISM_ARCH ]]; then
SYSTEM_ARCH=$PHOTOPRISM_ARCH
else
SYSTEM_ARCH=$(uname -m)
fi
DESTARCH=${2:-$SYSTEM_ARCH}
DESTARCH=${BUILD_ARCH:-$SYSTEM_ARCH}
if [ -d "/go" ]; then
GOPATH="/go"

View file

@ -22,14 +22,14 @@ echo "Installing ${GOLANG_VERSION} in \"${DESTDIR}\"..."
set -e
# Query architecture.
# Determine the system architecture.
if [[ $PHOTOPRISM_ARCH ]]; then
SYSTEM_ARCH=$PHOTOPRISM_ARCH
else
SYSTEM_ARCH=$(uname -m)
fi
DESTARCH=${2:-$SYSTEM_ARCH}
DESTARCH=${BUILD_ARCH:-$SYSTEM_ARCH}
mkdir -p "$DESTDIR"
@ -49,7 +49,7 @@ case $DESTARCH in
;;
*)
echo "Unsupported Machine Architecture: \"$BUILD_ARCH\"" 1>&2
echo "Unsupported Machine Architecture: \"$DESTARCH\"" 1>&2
exit 1
;;
esac

View file

@ -13,13 +13,15 @@ fi
set -e
# Determine the system architecture.
if [[ $PHOTOPRISM_ARCH ]]; then
SYSTEM_ARCH=$PHOTOPRISM_ARCH
else
SYSTEM_ARCH=$(uname -m)
fi
DESTARCH=${DESTARCH:-$SYSTEM_ARCH}
DESTARCH=${BUILD_ARCH:-$SYSTEM_ARCH}
TMPDIR=${TMPDIR:-/tmp}
. /etc/os-release

View file

@ -11,15 +11,17 @@ if [[ $(id -u) != "0" ]]; then
exit 1
fi
# Determine the system architecture.
if [[ $PHOTOPRISM_ARCH ]]; then
SYSTEM_ARCH=$PHOTOPRISM_ARCH
else
SYSTEM_ARCH=$(uname -m)
fi
DESTARCH=${BUILD_ARCH:-$SYSTEM_ARCH}
LIB_VERSION=${2:-v0.8.1}
SYSTEM_ARCH=$("$(dirname "$0")/arch.sh")
DESTARCH=${DESTARCH:-$SYSTEM_ARCH}
set -e
@ -66,7 +68,7 @@ case $DESTARCH in
;;
*)
echo "Unsupported Machine Architecture: \"$BUILD_ARCH\"" 1>&2
echo "Unsupported Machine Architecture: \"$DESTARCH\"" 1>&2
exit 0
;;
esac

View file

@ -9,8 +9,14 @@ set -e
TF_VERSION=${TF_VERSION:-1.15.2}
SYSTEM_ARCH=$(uname -m)
DESTARCH=${DESTARCH:-$SYSTEM_ARCH}
# Determine the system architecture.
if [[ $PHOTOPRISM_ARCH ]]; then
SYSTEM_ARCH=$PHOTOPRISM_ARCH
else
SYSTEM_ARCH=$(uname -m)
fi
DESTARCH=${BUILD_ARCH:-$SYSTEM_ARCH}
case $DESTARCH in
amd64 | AMD64 | x86_64 | x86-64)