LIBHEIF INSTALL
I wanted this tool for HEIC image conversions on my own system. Once I got started trying to figure it all out, I found a whole world out there doing cool stuff with it. I also found that my Rocky 8 load was gunna give me some challenges. Here is a install process that I hope overcomes those challenges, for you.
My fave package handler: https://negativo17.org/
His repo I use: https://negativo17.org/repos
# ----- FIND A NICE PLACE TO WORK -----
cd /opt
# ----- ADD NEGATIVO17 REPO -----
yum-config-manager --add-repo=https://negativo17.org/repos/epel-multimedia.repo
dnf update -y
# ----- INSTALL LIBRARIES AND TOOLS -----
dnf install -y \
git git-core git-core-doc \
doxygen \
graphviz \
SDL2 SDL2-devel \
libjpeg libjpeg-devel \
libpng libpng-devel \
giflib giflib-devel \
libXext libXext-devel \
libtiff libtiff-devel \
qt5-qtbase-gui \
qtsinglecoreapplication-qt5 qtsinglecoreapplication-qt5-devel \
cmake cmake-data cmake-doc cmake-filesystem cmake-rpm-macros \
ninja-build yasm nasm meson \
gcc-objc gcc-objc++ gcc-gfortran gcc-go \
gcc-x86_64-linux-gnu gcc-c++-x86_64-linux-gnu \
binutils-x86_64-linux-gnu glibc-static gmp-c++ \
freeglut-devel iso-codes \
ffmpeg ffmpeg-devel ffmpeg-libs libavcodec-devel \
libavfilter-devel libavformat-devel libavutil-devel \
kvazaar kvazaar-devel kvazaar-libs \
libswscale libswscale-devel \
x264-devel x264-libs x265-devel x265-libs \
openh264-devel openh264-libs libopenjph-devel \
vvdec-devel vvdec-libs vvenc-devel vvenc-libs \
vvdec vvenc brotli brotli-devel clang
# ----- LOAD GCC 11 COMPILER AND SWAP ENVIRONMENTS -----
dnf install -y gcc-toolset-11
scl enable gcc-toolset-11 bash
# ----- MAKE SURE YOUR GCC IS VERSION 11 -----
gcc --version
# ----- INSTALL CARGO/RUSTUP -----
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs -o rustup.sh
chmod +x rustup.sh
./rustup.sh --no-modify-path -y -q
rm -f rustup.sh
# ----- PRE-CREATE, CREATE, AND EXPORT MISSING PATHS -----
cat > /etc/ld.so.conf.d/local-lib.conf << "EOF"
/usr/local/lib
/usr/local/lib64
EOF
mkdir -p {/usr/local/lib64/pkgconfig,/usr/local/share/pkgconfig}
cat >> ~/.bashrc << "EOF"
PKGPATH=$(pkg-config --variable pc_path pkg-config);
PKG_CONFIG_PATH="$PKGPATH:/usr/local/lib64/pkgconfig:/usr/local/share/pkgconfig"
export PKG_CONFIG_PATH
PREPATH=$(echo $PATH);
CARPATH="$HOME/.cargo/bin"
PATH="$PREPATH:$CARPATH"
export PATH
EOF
source ~/.bashrc
ldconfig
rustup update
The environment should be pretty well setup now. This next part is the meat and potatoes. I am going to keep these builds around for awhile so I created scripts for each one, and will locate them inside a codecs
directory. This is a bit out of the norm if you're reading the "libheif" documentation as well. But you're here, so here it goes...
# ----- CREATE CODECS DIRECTORY -----
mkdir codecs
# ----- GENERATE THE SCRIPTS -----
cat > libde265.sh << "EOF"
#!/usr/bin/env bash
git clone https://github.com/strukturag/libde265.git
cd libde265
./autogen.sh && ./configure --enable-encoder
make
make install
ldconfig
EOF
cat > openjpg2.sh << "EOF"
#!/usr/bin/env bash
git clone -b v2.5.3 --depth 1 https://github.com/uclouvain/openjpeg.git
mkdir -p openjpeg/build
cd openjpeg/build
cmake .. -DCMAKE_BUILD_TYPE=Release -DBUILD_THIRDPARTY:BOOL=ON -DBUILD_CODEC:bool=on
make
make install
ldconfig
EOF
cat > aom.sh << "EOF"
#!/usr/bin/env bash
git clone -b v3.12.0 --depth 1 https://aomedia.googlesource.com/aom
cd aom
cmake -S . -B build.libavif -G Ninja -DCMAKE_INSTALL_PREFIX="$(pwd)/dist" -DCMAKE_BUILD_TYPE=Release -DENABLE_DOCS=0 -DENABLE_EXAMPLES=0 -DENABLE_TESTDATA=0 -DENABLE_TESTS=0 -DENABLE_TOOLS=0 -DCMAKE_POSITION_INDEPENDENT_CODE=ON
ninja -C build.libavif
ninja -C build.libavif install
cd ..
A='#!/usr/bin/env bash'
B="PKG_CONFIG_PATH=\$PKG_CONFIG_PATH:$PWD/aom/dist/lib64/pkgconfig"
C='PKGCONFPATH'
sed -i "s%$A%$A\n\n$B%" $C
EOF
cat > dav1d.sh << "EOF"
#!/usr/bin/env bash
git clone -b 1.5.0 --depth 1 https://code.videolan.org/videolan/dav1d.git
cd dav1d
meson build --default-library=static --buildtype release --prefix "$(pwd)/dist" $@
ninja -C build
ninja -C build install
cd ..
A='#!/usr/bin/env bash'
B="PKG_CONFIG_PATH=\$PKG_CONFIG_PATH:$PWD/dav1d/dist/lib64/pkgconfig"
C='PKGCONFPATH'
sed -i "s%$A%$A\n\n$B%" $C
EOF
cat > libwebp.sh << "EOF"
#!/usr/bin/env bash
git clone --single-branch https://chromium.googlesource.com/webm/libwebp
mkdir -p ./libwebp/build
cd ./libwebp/build
cmake -G Ninja -DCMAKE_INSTALL_PREFIX="$(pwd)/dist" -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Release ..
ninja sharpyuv
ninja install
cd ../..
A='#!/usr/bin/env bash'
B="PKG_CONFIG_PATH=\$PKG_CONFIG_PATH:$PWD/libwebp/build/dist/lib64/pkgconfig"
C='PKGCONFPATH'
sed -i "s%$A%$A\n\n$B%" $C
EOF
cat > rav1e.sh << "EOF"
#!/usr/bin/env bash
git clone -b v0.7.1 --depth 1 https://github.com/xiph/rav1e.git
cd rav1e
cargo update
cargo install cargo-c
cargo cinstall --crt-static --release --prefix="$(pwd)/dist" --library-type=staticlib
cd ..
A='#!/usr/bin/env bash'
B="PKG_CONFIG_PATH=\$PKG_CONFIG_PATH:$PWD/rav1e/dist/lib64/pkgconfig"
C='PKGCONFPATH'
sed -i "s%$A%$A\n\n$B%" $C
EOF
cat > svt.sh << "EOF"
#!/usr/bin/env bash
git clone -b v3.0.0 --depth 1 https://gitlab.com/AOMediaCodec/SVT-AV1.git
cd SVT-AV1/Build/linux
./build.sh release static no-apps disable-lto prefix=$(pwd)/install install
cd ../../..
A='#!/usr/bin/env bash'
B="PKG_CONFIG_PATH=\$PKG_CONFIG_PATH:$PWD/SVT-AV1/Build/linux/install/lib64/pkgconfig"
C='PKGCONFPATH'
sed -i "s%$A%$A\n\n$B%" $C
EOF