File: fixghc

package info (click to toggle)
hat 2.02-12
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 8,296 kB
  • ctags: 668
  • sloc: haskell: 64,394; ansic: 6,112; sh: 888; makefile: 451
file content (117 lines) | stat: -rwxr-xr-x 2,521 bytes parent folder | download | duplicates (5)
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
#!/bin/sh
#	fixghc:  a small script to patch up the -syslib changes between
#		versions 4.04, 4.06, 4.08, and 5.xx of ghc.

case $# in
  0) exit 1;;
esac
ghcversion=$1
shift

# We need a working `echo' command: Solaris2.6 and HP/UX may not have it.
case `echo -n hello | wc -c | ( read n ; echo $n )` in
    5) echon () { echo -n "$@"; } ;;
    *) LOCAL=${LOCAL-`dirname $0`}
       if [ -x $LOCAL/echo ]
       then echon () { $LOCAL/echo -n "$@"; }
       else echon () { echo "$@"; }
       fi ;;
esac

# Versions of ghc > 6.0 need a hack to make the version number larger.
if [ $ghcversion -le 100 ]
then
  ghcversion=${ghcversion}0
fi

# We permit arguments to arrive in any format (4.04, 4.06, 4.08, 5.00, 5.04),
# and translate to the format specified by the first arg.

if [ $ghcversion -le 405 ]
then
  while test "'$1'" != "''" 
  do
    case $1 in
      -syslib|-package) shift
               case $1 in
                 lang) echon " -syslib exts";;
                 text) echon " -syslib misc";;
                 base) ;;
                 *)    echon " -syslib $1" ;;
               esac ;;
      *) echon " $1" ;;
    esac
    shift
  done
  echo
  exit 0
fi

if [ $ghcversion -gt 405 -a $ghcversion -lt 408 ]
then
  while test "'$1'" != "''" 
  do
    case $1 in
      -syslib|-package) shift
               case $1 in
                 exts) echon " -syslib lang";;
                 misc) ;;
                 base) ;;
                 *)    echon " -syslib $1" ;;
               esac ;;
      *) echon " $1" ;;
    esac
    shift
  done
  echo
  exit 0
fi

if [ $ghcversion -ge 408 -a $ghcversion -lt 504 ]
then
  while test "'$1'" != "''" 
  do
    case $1 in
      -syslib) shift
               case $1 in
                 exts) echon " -package lang";;
                 misc) ;;
                 base) ;;
                 *)    echon " -package $1" ;;
               esac ;;
      -package) shift
               case $1 in
                 base) ;;
                 haskell98) ;;
                 *)    echon " -package $1" ;;
               esac ;;
      *) echon " $1" ;;
    esac
    shift
  done
  echo
  exit 0
fi

if [ $ghcversion -ge 504 ]
then
  while test "'$1'" != "''" 
  do
    case $1 in
      -syslib) shift
               case $1 in
                 exts) echon " -package lang";;
                 misc) ;;
                 *)    echon " -package $1" ;;
               esac ;;
      *) echon " $1" ;;
    esac
    shift
  done
  echo
  exit 0
fi

# stand-by default case
echo "$@"
exit 0