winegcc 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #!/bin/sh
  2. # Wrapper for winegcc that allows it to be used in a build generated
  3. # from PuTTY's CMakeLists.txt, by bodging around the command-line
  4. # options that CMake gets wrong.
  5. init=true
  6. link=true
  7. for arg in init "$@"; do
  8. if $init; then
  9. set --
  10. init=false
  11. continue
  12. fi
  13. case "$arg" in
  14. # The Windows build definition for PuTTY specifies all the
  15. # system API libraries by names like kernel32.lib. When CMake
  16. # reads that file and thinks it's compiling for Linux, it will
  17. # generate link options such as -lkernel32.lib. But in fact
  18. # winegcc expects -lkernel32, so we need to strip the ".lib"
  19. # suffix.
  20. -l*.lib) set -- "$@" "${arg%.lib}";;
  21. # Options that mean we're not linking.
  22. -E | -S | -c) link=false set -- "$@" "$arg";;
  23. # Anything else, we leave unchanged.
  24. *) set -- "$@" "$arg";;
  25. esac
  26. done
  27. if $link; then
  28. # winegcc requires this library for _wfopen
  29. set -- "$@" -lucrtbase
  30. fi
  31. echo "$@" >&2
  32. exec winegcc "$@"