# Get the source tarball
cd
test -f installed/libavif-1.0.3.tar.gz &&
mv -f installed/libavif-1.0.3.tar.gz .
test ! -f libavif-1.0.3.tar.gz &&
wget -O libavif-1.0.3.tar.gz \
https://github.com/AOMediaCodec/libavif/archive/refs/tags/v1.0.3.tar.gz
# Extract the source
mkdir -m 0700 ~/src
cd ~/src
find -maxdepth 1 -type d -name "libavif-*" -exec rm -r {} \;
tar xzvf ~/libavif-1.0.3.tar.gz
cd libavif-1.0.3
test $UID = 0 && chown -R root:root .
# Create a build directory
mkdir build
cd build
# See ./README.md
# Define each codec you want to enable
# -DAVIF_CODEC_AOM=ON
# -DAVIF_CODEC_DAV1D=ON
# -DAVIF_CODEC_LIBGAV1=ON
# -DAVIF_CODEC_RAV1E=ON
# -DAVIF_CODEC_SVT=ON
# If you installed GoogleTest
# -DAVIF_BUILD_TESTS=ON
# -DAVIF_ENABLE_GTEST=ON
# Configure the build
# It should figure out lib|lib64
cmake -DAVIF_CODEC_AOM=ON -DAVIF_CODEC_DAV1D=ON -DAVIF_CODEC_RAV1E=ON ..
# Build it
make
# Become root to install it
su
# Install it
make install
ldconfig
# Make sure your non-root user can remove the source later
chown -R $(logname) .
chmod -R u+rwx .
# Become your non-root user again
exit
# Save the source for later
cd
mkdir -p -m 0700 installed
rm -f installed/libavif-*.tar.*
mv libavif-1.0.3.tar.gz installed/
# If you ever want to uninstall libavif, this should do it:
# (see ~/src/libavif-1.0.3/build/install_manifest.txt)
cd
su
test -d /usr/local/include/avif && rm -r /usr/local/include/avif
( cd /usr/local/lib
test -d cmake/libavif && rm -r cmake/libavif
test -d pkgconfig && rm -f pkgconfig/libavif.pc
rm -f libavif.so* )
test -d /usr/local/lib64 &&
( cd /usr/local/lib64
test -d cmake/libavif && rm -r cmake/libavif
test -d pkgconfig && rm -f pkgconfig/libavif.pc
rm -f libavif.so* )
ldconfig
exit
find ~/src -maxdepth 1 -type d -name "libavif-*" -exec rm -r {} \;
rm -f ~/installed/libavif-*.tar.*