From 7ccb25af5a8207c9736185f658cae4143c676c02 Mon Sep 17 00:00:00 2001 From: Sebastian Schuberth Date: Tue, 31 Jan 2012 11:46:37 +0100 Subject: [PATCH] mingw-w64: Parse the SF RSS feed for the latest release, follow redirects Instead of hard-coding the file name, get the most recent mingw-w64 release from the RSS feed of file releases. Also, make curl follow redirects to SourceForge mirrors. Signed-off-by: Sebastian Schuberth --- src/mingw-w64/release-easy.sh | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/mingw-w64/release-easy.sh b/src/mingw-w64/release-easy.sh index a280470c..7ac33041 100644 --- a/src/mingw-w64/release-easy.sh +++ b/src/mingw-w64/release-easy.sh @@ -3,14 +3,24 @@ cd "$(dirname "$0")" srcdir=$(pwd) -# http://kent.dl.sourceforge.net/sourceforge/ -mirror=http://ignum.dl.sourceforge.net/project/mingw-w64/ -subdir=Toolchains%20targetting%20Win64/Automated%20Builds/ -file=mingw-w64-bin_i686-mingw_20110314.zip +# Limit the number of RSS feed entries. +limit=500 + +link=$(curl -s http://sourceforge.net/api/file/index/project-id/202880/mtime/desc/limit/$limit/rss | + sed -nr "s/(.+(mingw-w64-bin_i686-mingw_[0-9]+.zip).+)<\/link>/\2\t\1/p" | + head -1) + +file=$(echo "$link" | cut -f 1) +url=$(echo "$link" | cut -f 2) + +# Trim whitespaces. +file=$(echo $file) +url=$(echo $url) + dir=${file%.zip} # download it -test -f $file || curl $mirror$subdir$file > $file || exit +test -f $file || curl -L $url -o $file || exit # unpack & install it test -f sysroot/.root.init.marker && -- 2.11.4.GIT