2023-01-18 08:01:19 +01:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
set -euo pipefail
|
|
|
|
|
|
|
|
build_and_install() {
|
|
|
|
export MAKEFLAGS=-j`nproc`
|
2023-01-24 09:29:05 +01:00
|
|
|
export CFLAGS="-fpic"
|
2023-01-18 08:01:19 +01:00
|
|
|
cmake -DCMAKE_INSTALL_PREFIX=/usr/local -G"Unix Makefiles"
|
|
|
|
make
|
|
|
|
make install
|
|
|
|
}
|
|
|
|
|
|
|
|
install_build_dependencies() {
|
2023-01-24 10:15:03 +01:00
|
|
|
install_packages cmake gcc
|
2023-01-18 13:47:04 +01:00
|
|
|
ensure_libjpeg_is_fast
|
2023-01-18 08:01:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
ensure_libjpeg_is_fast() {
|
2023-01-24 10:15:03 +01:00
|
|
|
install_packages nasm
|
2023-01-18 08:01:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
prepare_libjpeg_source() {
|
2023-03-15 17:50:16 +01:00
|
|
|
export JPEG_TURBO_RELEASE=$(curl -sX GET "https://api.github.com/repos/libjpeg-turbo/libjpeg-turbo/releases/latest" \
|
|
|
|
| awk '/tag_name/{print $4;exit}' FS='[""]')
|
|
|
|
mkdir libjpeg-turbo
|
|
|
|
curl -Ls "https://github.com/libjpeg-turbo/libjpeg-turbo/archive/${JPEG_TURBO_RELEASE}.tar.gz" | \
|
|
|
|
tar xzvf - -C libjpeg-turbo/ --strip-components=1
|
2023-01-18 08:01:19 +01:00
|
|
|
cd libjpeg-turbo
|
|
|
|
}
|
|
|
|
|
2023-01-18 13:35:36 +01:00
|
|
|
source_dir=$(dirname "$0")
|
|
|
|
. "$source_dir/common.sh"
|
|
|
|
|
2023-01-18 08:01:19 +01:00
|
|
|
install_build_dependencies
|
|
|
|
prepare_libjpeg_source
|
|
|
|
build_and_install
|