KasmVNC/builder/scripts/build-libjpeg-turbo
2023-01-24 21:40:09 +13:00

62 lines
1.1 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
build_and_install() {
export MAKEFLAGS=-j`nproc`
export CFLAGS="-fpic"
cmake -DCMAKE_INSTALL_PREFIX=/usr/local -G"Unix Makefiles"
make
make install
}
install_build_dependencies() {
ensure_libjpeg_is_fast
if [ "$DISTRO" = centos ]; then
yum install -y cmake gcc
return
fi
if [ "$DISTRO" = oracle ]; then
dnf install -y cmake gcc
return
fi
if [ "$DISTRO" = opensuse ]; then
zypper install -y cmake gcc
return
fi
apt-get update
apt-get install -y cmake gcc
}
ensure_libjpeg_is_fast() {
if [ "$DISTRO" = centos ]; then
yum install -y nasm
return
fi
if [ "$DISTRO" = oracle ]; then
dnf install -y nasm
return
fi
if [ "$DISTRO" = opensuse ]; then
zypper install -y nasm
return
fi
apt-get update
apt-get install -y nasm
}
prepare_libjpeg_source() {
git clone --depth=1 https://github.com/libjpeg-turbo/libjpeg-turbo.git
cd libjpeg-turbo
}
source_dir=$(dirname "$0")
. "$source_dir/common.sh"
install_build_dependencies
prepare_libjpeg_source
build_and_install