# Get the source tarball
cd
test -f installed/dav1d-1.3.0.tar.xz && mv -f installed/dav1d-1.3.0.tar.xz .
test ! -f dav1d-1.3.0.tar.xz &&
wget https://downloads.videolan.org/videolan/dav1d/1.3.0/dav1d-1.3.0.tar.xz
# Extract the source
mkdir -p -m 0700 ~/src
cd ~/src
find -maxdepth 1 -type d -name "dav1d-*" -exec rm -r {} \;
tar xJvf ~/dav1d-1.3.0.tar.xz
cd dav1d-1.3.0
test $UID = 0 && chown -R root:root .
# Create a build directory
# (or 'meson setup build' to combine the next two parts)
mkdir build
cd build
# Make it a Meson build directory
meson setup .. .
# List configuration options, if you need to change anything
# It should already know to use lib64 if 64-bit
meson configure
# Change some options
#
# meson configure -Dprefix=/usr/local -Dinfodir=info -Dmandir=man -Dsysconfdir=/etc
#
# To build documentation add -Denable_docs=true
# Build it
ninja
# Test the build
ninja test
# Become root to install it
su
# Install it
ninja install
ldconfig
# Make sure your non-root user can remove the source later
chown -R $(logname) .
chmod -R u+w .
# Become your non-root user again
exit
# Save the tarball for later
cd
mkdir -p -m 0700 installed
rm -f installed/dav1d-*.tar.*
mv -f dav1d-1.3.0.tar.xz installed/
# If you ever want to uninstall dav1d, this should do it:
cd
su
test -d src/dav1d-* && ( cd src/dav1d-*/build ; ninja uninstall )
rm -f /usr/local/bin/dav1d /usr/local/lib*/libdav1d.*
test -d /usr/local/include/dav1d && rm -r /usr/local/include/dav1d
ldconfig
exit
find ~/src -maxdepth 1 -type d -name "dav1d-*" -exec rm -r {} \;
rm -f ~/installed/dav1d-*.tar.*