summaryrefslogtreecommitdiffstats
path: root/tools/update-gmsl
diff options
context:
space:
mode:
authorTimothy Gu <timothygu99@gmail.com>2014-04-27 04:07:00 (GMT)
committerTimothy Gu <timothygu99@gmail.com>2014-04-27 04:07:00 (GMT)
commit53b4442df67394fefda9daead0add47b95c6743d (patch)
tree724f66a39b2c134ba691b5a6d83e44d6a0cc6402 /tools/update-gmsl
parent1fb8ff6fa639e94fcb87b38c9a7b8159fc9ea9e0 (diff)
downloadmxe-53b4442df67394fefda9daead0add47b95c6743d.zip
mxe-53b4442df67394fefda9daead0add47b95c6743d.tar.gz
mxe-53b4442df67394fefda9daead0add47b95c6743d.tar.bz2
Add tool to update GMSL
Signed-off-by: Timothy Gu <timothygu99@gmail.com>
Diffstat (limited to 'tools/update-gmsl')
-rwxr-xr-xtools/update-gmsl45
1 files changed, 45 insertions, 0 deletions
diff --git a/tools/update-gmsl b/tools/update-gmsl
new file mode 100755
index 0000000..c633324
--- /dev/null
+++ b/tools/update-gmsl
@@ -0,0 +1,45 @@
+#!/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-*
+}
+
+# Ported from main Makefile
+SED='sed'
+SORT='sort'
+if [ gsed --help >/dev/null 2>&1 ]; then
+ SED='gsed'
+fi
+if [ gsort --help >/dev/null 2>&1 ]; then
+ SED='gsort'
+fi
+WGET="wget --no-check-certificate
+ --user-agent=$(wget --version |
+ $SED -n 's,GNU \(Wget\) \([0-9.]*\).*,\1/\2,p')"
+
+# 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
+ $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
+fi