HEIC: Improve build-libheif.sh and install-libheif.sh scripts #3852
Signed-off-by: Michael Mayer <michael@photoprism.app>
This commit is contained in:
parent
d93e4c8ccd
commit
c2de3aa0ec
2 changed files with 62 additions and 4 deletions
25
scripts/dist/build-libheif.sh
vendored
25
scripts/dist/build-libheif.sh
vendored
|
@ -2,6 +2,12 @@
|
|||
|
||||
# This builds heif-convert, heif-enc, heif-info, and heif-thumbnailer binaries from source.
|
||||
|
||||
# Show usage information if first argument is --help.
|
||||
if [[ ${1} == "--help" ]]; then
|
||||
echo "Usage: ${0##*/} [version]" 1>&2
|
||||
exit 0
|
||||
fi
|
||||
|
||||
CURRENT_DIR=$(pwd)
|
||||
|
||||
# Determine the system architecture.
|
||||
|
@ -13,6 +19,25 @@ fi
|
|||
|
||||
DESTARCH=${BUILD_ARCH:-$SYSTEM_ARCH}
|
||||
|
||||
case $DESTARCH in
|
||||
amd64 | AMD64 | x86_64 | x86-64)
|
||||
DESTARCH=amd64
|
||||
;;
|
||||
|
||||
arm64 | ARM64 | aarch64)
|
||||
DESTARCH=arm64
|
||||
;;
|
||||
|
||||
arm | ARM | aarch | armv7l | armhf)
|
||||
DESTARCH=arm
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Unsupported Machine Architecture: \"$DESTARCH\"" 1>&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
. /etc/os-release
|
||||
|
||||
LATEST=$(curl --silent "https://api.github.com/repos/strukturag/libheif/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
|
||||
|
|
41
scripts/dist/install-libheif.sh
vendored
41
scripts/dist/install-libheif.sh
vendored
|
@ -5,10 +5,45 @@
|
|||
|
||||
set -e
|
||||
|
||||
# Show usage information if first argument is --help.
|
||||
if [[ ${1} == "--help" ]]; then
|
||||
echo "Usage: ${0##*/} [destdir] [version]" 1>&2
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# You can provide a custom installation directory as the first argument.
|
||||
DESTDIR=$(realpath "${1:-/usr/local}")
|
||||
|
||||
# In addition, you can specify a custom version to be installed as the second argument.
|
||||
LIBHEIF_VERSION=${2:-v1.17.1}
|
||||
SYSTEM_ARCH=$("$(dirname "$0")/arch.sh")
|
||||
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)
|
||||
DESTARCH=amd64
|
||||
;;
|
||||
|
||||
arm64 | ARM64 | aarch64)
|
||||
DESTARCH=arm64
|
||||
;;
|
||||
|
||||
arm | ARM | aarch | armv7l | armhf)
|
||||
DESTARCH=arm
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Unsupported Machine Architecture: \"$DESTARCH\"" 1>&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
. /etc/os-release
|
||||
|
||||
|
@ -18,8 +53,6 @@ if [[ $(id -u) != "0" ]] && [[ $DESTDIR == "/usr" || $DESTDIR == "/usr/local" ]]
|
|||
exit 1
|
||||
fi
|
||||
|
||||
. /etc/os-release
|
||||
|
||||
mkdir -p "$DESTDIR"
|
||||
|
||||
ARCHIVE="libheif-${VERSION_CODENAME}-${DESTARCH}-${LIBHEIF_VERSION}.tar.gz"
|
||||
|
|
Loading…
Add table
Reference in a new issue