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
|
#!/bin/sh
#
# ld-compatible wrapper for link.exe
#
#args="/pdbtype:sept"
args="/nologo /opt:REF /incremental:no /subsystem:console /nodefaultlib:msvcrtd"
if [ -z "$LIB" -a "$Lib" ]; then
exit "LIB must be set for LINK.EXE to function properly"
fi
link=link
while [ $# -gt 0 ]
do
case $1
in
-m32)
if type link | grep amd64; then
echo "Wrong LINK.EXE in path; use 32-bit version"
exit 1
fi
if echo $LIB | grep amd64; then
echo "Wrong paths in LIB; use 32-bit version"
exit 1
fi
shift 1
;;
-m64)
if ! type link | grep amd64; then
echo "Wrong LINK.EXE in path; use 64-bit version"
exit 1
fi
if ! echo $LIB | grep amd64; then
echo "Wrong paths in LIB; use 64-bit version"
exit 1
fi
shift 1
;;
-g)
args="$args /debug"
shift 1
;;
-o)
file=$(cygpath -m "$2")
dir=$(dirname "$file")
base=$(basename "$file"|sed 's/\.[^.]*//g')
args="$args /out:\"$file\" /pdb:$dir/$base.pdb /implib:$dir/$base.lib"
shift 2
;;
-shared)
args="$args /DLL"
shift 1
;;
-static-libgcc)
shift 1
;;
*.dll)
file=$(cygpath -m "$1")
args="$args $(echo $file|sed -e 's/.dll/.lib/g')"
shift 1
;;
*.o|*.lib|*.a)
file=$(cygpath -m "$1")
args="$args $(echo $file|sed -e 's%\\%/%g')"
shift 1
;;
*)
echo "Unsupported argument '$1'"
exit 1
;;
esac
done
echo "\"$link\" $args (LIB=$LIB)"
eval "\"$link\" $args"
|