gcc.py 955 B

12345678910111213141516171819202122232425262728293031323334353637
  1. #!/usr/bin/env python
  2. # A wrapper for i686-w64-mingw32-gcc that removes -mno-cygwin and converts
  3. # Windows paths to Unix paths, so that the w64-mingw32 gcc can be called by
  4. # Python distutils.
  5. import os
  6. import subprocess
  7. import sys
  8. import common
  9. args = ["/var/tmp/dist/mingw-w64/bin/i686-w64-mingw32-gcc"]
  10. sys.argv.pop(0)
  11. while sys.argv:
  12. a = sys.argv.pop(0)
  13. if not a.startswith("-"):
  14. args.append(common.winepath(a))
  15. continue
  16. if a == "-mno-cygwin":
  17. continue
  18. if a in ("-I", "-L"):
  19. args.append(a)
  20. args.append(common.winepath(sys.argv.pop(0)))
  21. continue
  22. o = common.search_startswith(a, ("-I", "-L"))
  23. if o is not None:
  24. path = a[len(o):]
  25. args.append("%s%s" % (o, common.winepath(path)))
  26. continue
  27. args.append(a)
  28. p = common.popen_faketime(args, stderr=subprocess.PIPE)
  29. stderr = p.stderr.read()
  30. sys.stderr.write(stderr)
  31. if " error: " in stderr:
  32. sys.exit(1)