1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-09 01:18:00 +00:00
putty-source/cmake/winegcc
Simon Tatham 0945fc5446 Fix breakage in winegcc build script.
Apparently when I started using _wfopen in commit 8bd75b85ed, the
winegcc build (which I mostly use for Coverity Scan) stopped working,
because _wfopen isn't included in any of the libraries I explicitly
had on my link line.

Rather than mess about with cmake, it's easier to just bodge it in the
winegcc wrapper script, since we had one of those already.
2023-08-19 08:58:36 +01:00

40 lines
1.0 KiB
Bash
Executable File

#!/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 "$@"