2023-01-18 08:01:19 +01:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
set -euo pipefail
|
|
|
|
|
|
|
|
build_and_install() {
|
|
|
|
export MAKEFLAGS=-j`nproc`
|
2023-01-18 13:35:36 +01:00
|
|
|
export CFLAGS="-fpic -flto"
|
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-18 13:47:04 +01:00
|
|
|
ensure_libjpeg_is_fast
|
|
|
|
|
2023-01-18 13:35:36 +01:00
|
|
|
if [ "$DISTRO" = centos ]; then
|
|
|
|
yum install -y cmake gcc
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
|
2023-01-18 08:01:19 +01:00
|
|
|
apt-get update
|
|
|
|
apt-get install -y cmake gcc
|
|
|
|
}
|
|
|
|
|
|
|
|
ensure_libjpeg_is_fast() {
|
2023-01-18 13:35:36 +01:00
|
|
|
if [ "$DISTRO" = centos ]; then
|
|
|
|
yum install -y nasm
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
|
2023-01-18 13:47:04 +01:00
|
|
|
apt-get update
|
2023-01-18 08:01:19 +01:00
|
|
|
apt-get install -y nasm
|
|
|
|
}
|
|
|
|
|
|
|
|
prepare_libjpeg_source() {
|
|
|
|
git clone --depth=1 https://github.com/libjpeg-turbo/libjpeg-turbo.git
|
|
|
|
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
|