File: winegcc

package info (click to toggle)
putty 0.83-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 13,216 kB
  • sloc: ansic: 148,476; python: 8,466; perl: 1,830; makefile: 128; sh: 117
file content (39 lines) | stat: -rwxr-xr-x 1,052 bytes parent folder | download
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
#!/bin/sh

# Wrapper for winegcc that allows it to be used in a build generated
# from PuTTY's CMakeLists.txt, by bodging around the command-line
# options that CMake gets wrong.

init=true
link=true
for arg in init "$@"; do
    if $init; then
        set --
        init=false
        continue
    fi

    case "$arg" in
        # The Windows build definition for PuTTY specifies all the
        # system API libraries by names like kernel32.lib. When CMake
        # reads that file and thinks it's compiling for Linux, it will
        # generate link options such as -lkernel32.lib. But in fact
        # winegcc expects -lkernel32, so we need to strip the ".lib"
        # suffix.
        -l*.lib) set -- "$@" "${arg%.lib}";;

        # Options that mean we're not linking.
        -E | -S | -c) link=false  set -- "$@" "$arg";;

        # Anything else, we leave unchanged.
        *) set -- "$@" "$arg";;
    esac
done

if $link; then
    # winegcc requires this library for _wfopen
    set -- "$@" -lucrtbase
fi

echo "$@" >&2
exec winegcc "$@"