Update tarball download location to Github to accomodate new download site format.

This commit is contained in:
Christoph Scholtes 2021-09-23 18:26:44 -06:00
parent daeff0701c
commit 2eadd25c4c

View File

@ -34,19 +34,22 @@ CLANG_PKG=""
function set_package_link()
{
pushd $BUILD_DIR &>/dev/null
download https://releases.llvm.org/download.html &>/dev/null
if [[ $(file download.html) == *gzip* ]]; then
mv download.html download.html.gz
DOWNLOAD_PAGE=llvmorg-$CLANG_VERSION
download https://github.com/llvm/llvm-project/releases/tag/$DOWNLOAD_PAGE &>/dev/null
if [[ $(file $DOWNLOAD_PAGE) == *gzip* ]]; then
mv $DOWNLOAD_PAGE $DOWNLOAD_PAGE.gz
require gzip
gzip -d download.html.gz
gzip -d $DOWNLOAD_PAGE.gz
fi
links=$(cat download.html | grep -Po '(?<=href=")[^"]*' | grep -v "\.sig")
rm -f download.html
links=$(cat $DOWNLOAD_PAGE | grep -Po '(?<=href=")[^"]*' | grep -v "\.sig")
rm -f $DOWNLOAD_PAGE
LLVM_PKG=$(echo "$links" | grep "llvm-$CLANG_VERSION.src" | head -n 1 || true)
CLANG_PKG=$(echo "$links" | grep -E "(clang|cfe)-$CLANG_VERSION.src" | head -n 1 || true)
if [ -n "$LLVM_PKG" ] && [[ $LLVM_PKG != https* ]]; then
LLVM_PKG="https://releases.llvm.org/$LLVM_PKG"
CLANG_PKG="https://releases.llvm.org/$CLANG_PKG"
LLVM_PKG="https://github.com/$LLVM_PKG"
CLANG_PKG="https://github.com/$CLANG_PKG"
fi
popd &>/dev/null
}