Files
MINGW-packages/mingw-w64-python-setuptools/0011-add-support-for-windmc.patch
2024-11-06 07:07:33 +01:00

33 lines
1.4 KiB
Diff

diff --git a/setuptools/_distutils/cygwinccompiler.py b/setuptools/_distutils/cygwinccompiler.py
index 3c67524e6d..2159c7b875 100644
--- a/setuptools/_distutils/cygwinccompiler.py
+++ b/setuptools/_distutils/cygwinccompiler.py
@@ -109,6 +109,18 @@ def _compile(self, obj, src, ext, cc_args, extra_postargs, pp_opts):
self.spawn(["windres", "-i", src, "-o", obj])
except DistutilsExecError as msg:
raise CompileError(msg)
+ elif ext == '.mc':
+ h_dir = os.path.dirname(src)
+ rc_dir = os.path.dirname(obj)
+ try:
+ # first compile .mc to .rc and .h file
+ self.spawn(['windmc'] + ['-h', h_dir, '-r', rc_dir] + [src])
+ base, _ = os.path.splitext(os.path.basename(src))
+ rc_file = os.path.join(rc_dir, base + '.rc')
+ # then compile .rc to .res file
+ self.spawn(['windres', '-i', rc_file, '-o', obj])
+ except DistutilsExecError as msg:
+ raise CompileError(msg)
else: # for other files use the C-compiler
try:
if self.detect_language(src) == 'c++':
@@ -235,7 +247,7 @@ def out_extensions(self):
"""
return {
**super().out_extensions,
- **{ext: ext + self.obj_extension for ext in ('.res', '.rc')},
+ **{ext: ext + self.obj_extension for ext in ('.res', '.rc', '.mc')},
}