aboutsummaryrefslogtreecommitdiffstats
path: root/compat/windows/mswindres
blob: 450525a33e388ef913724b5c28d7bad965eb5774 (plain) (blame)
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
#!/bin/sh

if [ "$1" = "--version" ]; then
    rc.exe /?
    exit $?
fi

if [ $# -lt 2 ]; then
    echo "Usage: mswindres [-I/include/path ...] [-DSOME_DEFINE ...] [-o output.o] input.rc [output.o]" >&2
    exit 0
fi

EXTRA_OPTS="/nologo"

while [ $# -gt 2 ]; do
    case $1 in
    -D*) EXTRA_OPTS="$EXTRA_OPTS /d$(echo $1 | sed -e "s/^..//" -e "s/ /\\\\ /g")" ;;
    -I*) EXTRA_OPTS="$EXTRA_OPTS /i$(echo $1 | sed -e "s/^..//" -e "s/ /\\\\ /g")" ;;
    -o)  OPT_OUT="$2"; shift ;;
    esac
    shift
done

IN="$1"
if [ -z "$OPT_OUT" ]; then
    OUT="$2"
else
    OUT="$OPT_OUT"
fi

eval set -- $EXTRA_OPTS
rc.exe "$@" /fo "$OUT" "$IN"