~ubuntu-branches/debian/squeeze/erlang/squeeze

« back to all changes in this revision

Viewing changes to erts/etc/win32/cygwin_tools/mc.sh

  • Committer: Bazaar Package Importer
  • Author(s): Erlang Packagers, Sergei Golovan
  • Date: 2006-12-03 17:07:44 UTC
  • mfrom: (2.1.11 feisty)
  • Revision ID: james.westby@ubuntu.com-20061203170744-rghjwupacqlzs6kv
Tags: 1:11.b.2-4
[ Sergei Golovan ]
Fixed erlang-base and erlang-base-hipe prerm scripts.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#! /bin/sh
2
 
# set -x
3
 
# Save the command line for debug outputs
4
 
SAVE="$@"
5
 
CMD=""
6
 
OUTPUT_DIRNAME=""
7
 
 
8
 
# Find the correct mc.exe. This could be done by the configure script,
9
 
# But as we seldom use the resource compiler, it might as well be done here...
10
 
MCC=""
11
 
save_ifs=$IFS
12
 
IFS=:
13
 
for p in $PATH; do 
14
 
    if [ -f $p/mc.exe ]; then 
15
 
        if [ -n "`$p/mc.exe -? 2>&1 | grep -i "message compiler"`" ]; then 
16
 
            MCC=$p/mc.exe
17
 
        fi
18
 
    fi
19
 
done
20
 
IFS=$save_ifs
21
 
 
22
 
if [ -z "$MCC" ]; then
23
 
    echo 'mc.exe not found!' >&2
24
 
    exit 1
25
 
fi
26
 
 
27
 
while test -n "$1" ; do
28
 
    x="$1"
29
 
    case "$x" in
30
 
        -o)
31
 
            shift
32
 
            OUTPUT_DIRNAME="$1";;
33
 
        -o/*)
34
 
            y=`echo $x | sed 's,^-[Io]\(/.*\),\1,g'`;
35
 
            OUTPUT_DIRNAME="$y";;
36
 
        -I)
37
 
            shift
38
 
            MPATH=`cygpath -m $1`;
39
 
            CMD="$CMD -I\"$MPATH\"";;
40
 
        -I/*)
41
 
            y=`echo $x | sed 's,^-[Io]\(/.*\),\1,g'`;
42
 
            MPATH=`cygpath -m $y`;
43
 
            CMD="$CMD -I\"$MPATH\"";;
44
 
        *)
45
 
            MPATH=`cygpath -m -a $x`;
46
 
            CMD="$CMD \"$MPATH\"";; 
47
 
    esac
48
 
    shift
49
 
done
50
 
p=$$
51
 
if [ "X$MC_SH_DEBUG_LOG" != "X" ]; then
52
 
    echo rc.sh "$SAVE" >>$MC_SH_DEBUG_LOG
53
 
    echo rc.exe $CMD >>$MC_SH_DEBUG_LOG
54
 
fi
55
 
if [ -n "$OUTPUT_DIRNAME" ]; then
56
 
    cd $OUTPUT_DIRNAME
57
 
    RES=$?
58
 
    if [ "$RES" != "0" ]; then
59
 
        echo "mc.sh: Error: could not cd to $OUTPUT_DIRNAME">&2
60
 
        exit $RES
61
 
    fi
62
 
fi
63
 
eval $MCC "$CMD"  >/tmp/mc.exe.${p}.1 2>/tmp/mc.exe.${p}.2
64
 
RES=$?
65
 
tail +2 /tmp/mc.exe.${p}.2 >&2
66
 
cat /tmp/mc.exe.${p}.1
67
 
rm -f /tmp/mc.exe.${p}.2 /tmp/mc.exe.${p}.1
68
 
exit $RES