File: ld.sh

package info (click to toggle)
libjna-java 5.18.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 11,840 kB
  • sloc: java: 90,395; ansic: 4,994; xml: 3,722; makefile: 434; sh: 299
file content (75 lines) | stat: -rwxr-xr-x 1,598 bytes parent folder | download | duplicates (7)
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"