summaryrefslogtreecommitdiffstats
path: root/tools/update-gmsl
blob: 29cf5925d648f55e925db21908008c17ba5a117f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/sh
# This file is part of MXE.
# See index.html for further information.
#
# Script to automatically update GNU Make Standard Library
# (http://gmsl.sourceforge.net/)

clean(){
    rm -rf tmp-gmsl.tar.gz gmsl-*
}

. tools/compat-init.sh

# Current GMSL version. E.g. '1.1.5'
current_version=$(grep 'gmsl_version.*=' 'ext/__gmsl' | \
                  cut -d'=' -f2 | $SED -e 's/^ //' -e 's/ *$//' | tr ' ' '.')
# Latest GMSL version fetched from SourceForge
latest_version=$(
    $WGET -q -O- http://sourceforge.net/projects/gmsl/files/GNU%20Make%20Standard%20Library/ | \
    $SED -n 's,.*/v\([0-9][^"]*\)/".*,\1,p' | \
    $SORT -V | \
    tail -1)

clean
if [ $current_version != $latest_version ]; then
    echo "New version found: $current_version --> $latest_version"
    $WGET -q -O tmp-gmsl.tar.gz \
        "http://downloads.sourceforge.net/project/gmsl/GNU%20Make%20Standard%20Library/v${latest_version}/gmsl-${latest_version}.tar.gz"
    tar xzf tmp-gmsl.tar.gz
    rm -f ext/*gmsl doc/gmsl*
    cp -a gmsl-${latest_version}/gmsl ext/
    cp -a gmsl-${latest_version}/__gmsl ext/
    cp -a gmsl-${latest_version}/index.html doc/gmsl.html
    clean
else
    echo "No new version available: $current_version"
fi