56 lines
2.8 KiB
Diff
56 lines
2.8 KiB
Diff
From 1fbb8d0a57ce146e9b0c3c48bae03693beb15fea Mon Sep 17 00:00:00 2001
|
|
From: =?UTF-8?q?=D0=90=D0=BB=D0=B5=D0=BA=D1=81=D0=B5=D0=B9?=
|
|
<alexey.pawlow@gmail.com>
|
|
Date: Thu, 17 Jun 2021 18:52:28 +0530
|
|
Subject: [PATCH 082/N] distutils: add windmc to cygwinccompiler
|
|
|
|
---
|
|
Lib/distutils/cygwinccompiler.py | 26 ++++++++++++++++++++++++--
|
|
1 file changed, 24 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/Lib/distutils/cygwinccompiler.py b/Lib/distutils/cygwinccompiler.py
|
|
index 75bc17b..6a40e80 100644
|
|
--- a/Lib/distutils/cygwinccompiler.py
|
|
+++ b/Lib/distutils/cygwinccompiler.py
|
|
@@ -170,6 +170,28 @@ 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':
|
|
+ # Adapted from msvc9compiler:
|
|
+ #
|
|
+ # Compile .MC to .RC file to .RES file.
|
|
+ # * '-h dir' specifies the directory for the generated include file
|
|
+ # * '-r dir' specifies the target directory of the generated RC file and the binary message resource it includes
|
|
+ #
|
|
+ # For now (since there are no options to change this),
|
|
+ # we use the source-directory for the include file and
|
|
+ # the build directory for the RC file and message
|
|
+ # resources. This works at least for win32all.
|
|
+ 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:
|
|
self.spawn(self.compiler_so + cc_args + [src, '-o', obj] +
|
|
@@ -264,9 +286,9 @@ def object_filenames(self, source_filenames, strip_dir=0, output_dir=''):
|
|
base, ext = os.path.splitext(src_name)
|
|
# use 'normcase' only for resource suffixes
|
|
ext_normcase = os.path.normcase(ext)
|
|
- if ext_normcase in ['.rc','.res']:
|
|
+ if ext_normcase in ['.rc', '.res', '.mc']:
|
|
ext = ext_normcase
|
|
- if ext not in (self.src_extensions + ['.rc','.res']):
|
|
+ if ext not in (self.src_extensions + ['.rc', '.res', '.mc']):
|
|
raise UnknownFileError("unknown file type '%s' (from '%s')" % \
|
|
(ext, src_name))
|
|
base = os.path.splitdrive(base)[1] # Chop off the drive
|