abinfo "Installing symlinks for the default llvm-runtime ..."
mkdir -pv "$PKGDIR"/usr/lib
cd /usr/lib
ln -sv llvm-"${PKGVER%%.*}"/lib/* "$PKGDIR"/usr/lib

abinfo "Removing versioned symlinks ..."
cd "$PKGDIR"/usr/lib
rm -v *.so."${PKGVER%%.*}"*
rm -v libLLVM-"${PKGVER%%.*}".so

# Note: libunwind.so is provided by libunwind, which also provides
# libunwind.so.8, while llvm-runtime provides libunwind.so.1.
# Not all targets have llvm-based libunwind.
if [ -L libunwind.so ]; then
    abinfo "Removing unexpected symlinks ..."
    rm -v libunwind.so
fi

abinfo "Asserting that key symlinks exist ..."
for i in lib{clang{,-cpp},LLVM,LTO}.so; do
    abinfo "Checking $i ..."
    test -L "$PKGDIR"/usr/lib/"$i"
done
