1#!/bin/sh 2 3set -e 4glpk_ver=4.48 5 6wgetcmd=wget 7wgetcount=`which wget 2>/dev/null | wc -l` 8if test ! $wgetcount = 1; then 9 echo "Utility wget not found in your PATH." 10 if test `uname` = Darwin; then 11 wgetcmd="curl -L -O" 12 echo "Using curl instead." 13 elif test `uname` = FreeBSD; then 14 wgetcmd=fetch 15 echo "Using fetch instead." 16 else 17 exit -1 18 fi 19fi 20 21echo " " 22echo "Running script to download the source code for GLPK $glpk_ver." 23echo " " 24 25rm -f glpk*.tar.gz 26 27echo "Downloading the source code from ftp.gnu.org..." 28$wgetcmd ftp://ftp.gnu.org/gnu/glpk/glpk-${glpk_ver}.tar.gz 29 30echo "Uncompressing the tarball..." 31gunzip -f glpk-${glpk_ver}.tar.gz 32 33if test -d glpk ; then 34 echo "Moving current glpk to glpk.OLD." 35 if test -d glpk.OLD ; then 36 rm -rf glpk.OLD 37 fi 38 mv glpk glpk.OLD 39fi 40 41echo "Unpacking the source code..." 42tar xf glpk-${glpk_ver}.tar 43 44echo "Deleting the tar file..." 45rm glpk-${glpk_ver}.tar 46 47mv glpk-${glpk_ver} glpk 48 49echo " " 50echo "Done downloading the source code for GLPK." 51echo "Applying patch file." 52 53patch -p0 < glpk.patch 54 55echo "Touch every source file to force rebuild of whole package." 56 57touch glpk/src/*.c glpk/src/*/*.c 58 59echo " " 60echo "Verify that there are no error message in the output above." 61