217 lines
7.9 KiB
Diff
217 lines
7.9 KiB
Diff
From a5776eadcc30f6de25191d37752871fb1af86c2f Mon Sep 17 00:00:00 2001
|
|
From: "atom.long" <atom.long@hotmail.com>
|
|
Date: Thu, 25 May 2017 21:37:00 +0800
|
|
Subject: [PATCH] msys-ize
|
|
|
|
---
|
|
gyptest.py | 1 +
|
|
pylib/gyp/MSVSVersion.py | 4 ++--
|
|
pylib/gyp/__init__.py | 4 ++--
|
|
pylib/gyp/common.py | 1 +
|
|
pylib/gyp/generator/make.py | 5 ++++-
|
|
pylib/gyp/generator/ninja.py | 2 +-
|
|
test/actions-multiple/gyptest-all.py | 2 +-
|
|
test/lib/TestCommon.py | 2 +-
|
|
test/lib/TestGyp.py | 6 +++---
|
|
test/library_dirs/gyptest-library-dirs.py | 2 +-
|
|
test/rules/src/external/external.gyp | 2 +-
|
|
test/target/gyptest-target.py | 2 +-
|
|
12 files changed, 19 insertions(+), 14 deletions(-)
|
|
|
|
diff --git a/gyptest.py b/gyptest.py
|
|
index 98957e1..4469795 100755
|
|
--- a/gyptest.py
|
|
+++ b/gyptest.py
|
|
@@ -100,6 +100,7 @@ def main(argv=None):
|
|
'freebsd8': ['make'],
|
|
'openbsd5': ['make'],
|
|
'cygwin': ['msvs'],
|
|
+ 'msys': ['msvs'],
|
|
'win32': ['msvs', 'ninja'],
|
|
'linux': ['make', 'ninja'],
|
|
'linux2': ['make', 'ninja'],
|
|
diff --git a/pylib/gyp/MSVSVersion.py b/pylib/gyp/MSVSVersion.py
|
|
index edaf6ee..c815350 100644
|
|
--- a/pylib/gyp/MSVSVersion.py
|
|
+++ b/pylib/gyp/MSVSVersion.py
|
|
@@ -131,7 +131,7 @@ def _RegistryQueryBase(sysdir, key, value):
|
|
stdout from reg.exe, or None for failure.
|
|
"""
|
|
# Skip if not on Windows or Python Win32 setup issue
|
|
- if sys.platform not in ('win32', 'cygwin'):
|
|
+ if sys.platform not in ('win32', 'cygwin', 'msys'):
|
|
return None
|
|
# Setup params to pass to and attempt to launch reg.exe
|
|
cmd = [os.path.join(os.environ.get('WINDIR', ''), sysdir, 'reg.exe'),
|
|
@@ -335,7 +335,7 @@ def _CreateVersion(name, path, sdk_based=False):
|
|
|
|
def _ConvertToCygpath(path):
|
|
"""Convert to cygwin path if we are using cygwin."""
|
|
- if sys.platform == 'cygwin':
|
|
+ if sys.platform in ('cygwin', 'msys'):
|
|
p = subprocess.Popen(['cygpath', path], stdout=subprocess.PIPE)
|
|
path = p.communicate()[0].strip()
|
|
return path
|
|
diff --git a/pylib/gyp/__init__.py b/pylib/gyp/__init__.py
|
|
index 668f38b..1c14c59 100755
|
|
--- a/pylib/gyp/__init__.py
|
|
+++ b/pylib/gyp/__init__.py
|
|
@@ -360,7 +360,7 @@ def gyp_main(args):
|
|
|
|
if not home_dot_gyp:
|
|
home_vars = ['HOME']
|
|
- if sys.platform in ('cygwin', 'win32'):
|
|
+ if sys.platform in ('cygwin', 'msys', 'win32'):
|
|
home_vars.append('USERPROFILE')
|
|
for home_var in home_vars:
|
|
home = os.getenv(home_var)
|
|
@@ -389,7 +389,7 @@ def gyp_main(args):
|
|
# Nothing in the variable, default based on platform.
|
|
if sys.platform == 'darwin':
|
|
options.formats = ['xcode']
|
|
- elif sys.platform in ('win32', 'cygwin'):
|
|
+ elif sys.platform in ('win32', 'cygwin', 'msys'):
|
|
options.formats = ['msvs']
|
|
else:
|
|
options.formats = ['make']
|
|
diff --git a/pylib/gyp/common.py b/pylib/gyp/common.py
|
|
index a1e1db5..ca60f58 100644
|
|
--- a/pylib/gyp/common.py
|
|
+++ b/pylib/gyp/common.py
|
|
@@ -411,6 +411,7 @@ def GetFlavor(params):
|
|
"""Returns |params.flavor| if it's set, the system's default flavor else."""
|
|
flavors = {
|
|
'cygwin': 'win',
|
|
+ 'msys': 'win',
|
|
'win32': 'win',
|
|
'darwin': 'mac',
|
|
}
|
|
diff --git a/pylib/gyp/generator/make.py b/pylib/gyp/generator/make.py
|
|
index e80ebae..e1907a0 100644
|
|
--- a/pylib/gyp/generator/make.py
|
|
+++ b/pylib/gyp/generator/make.py
|
|
@@ -1355,7 +1355,10 @@ $(obj).$(TOOLSET)/$(TARGET)/%%.o: $(obj)/%%%s FORCE_DO_CMD
|
|
if self.flavor == 'aix':
|
|
target_ext = '.a'
|
|
else:
|
|
- target_ext = '.so'
|
|
+ if self.flavor == 'win':
|
|
+ target_ext = '.dll'
|
|
+ else:
|
|
+ target_ext = '.so'
|
|
elif self.type == 'none':
|
|
target = '%s.stamp' % target
|
|
elif self.type != 'executable':
|
|
diff --git a/pylib/gyp/generator/ninja.py b/pylib/gyp/generator/ninja.py
|
|
index 0555a4a..c5f2276 100644
|
|
--- a/pylib/gyp/generator/ninja.py
|
|
+++ b/pylib/gyp/generator/ninja.py
|
|
@@ -1747,7 +1747,7 @@ def GetDefaultConcurrentLinks():
|
|
if pool_size:
|
|
return pool_size
|
|
|
|
- if sys.platform in ('win32', 'cygwin'):
|
|
+ if sys.platform in ('win32', 'cygwin', 'msys'):
|
|
import ctypes
|
|
|
|
class MEMORYSTATUSEX(ctypes.Structure):
|
|
diff --git a/test/actions-multiple/gyptest-all.py b/test/actions-multiple/gyptest-all.py
|
|
index 2a083de..30b7339 100755
|
|
--- a/test/actions-multiple/gyptest-all.py
|
|
+++ b/test/actions-multiple/gyptest-all.py
|
|
@@ -35,7 +35,7 @@ if test.format in ['make', 'ninja']:
|
|
if test.format == 'make':
|
|
target = 'multi2.txt'
|
|
elif test.format == 'ninja':
|
|
- if sys.platform in ['win32', 'cygwin']:
|
|
+ if sys.platform in ('win32', 'cygwin', 'msys'):
|
|
target = '..\\..\\multi2.txt'
|
|
else:
|
|
target = '../../multi2.txt'
|
|
diff --git a/test/lib/TestCommon.py b/test/lib/TestCommon.py
|
|
index 2f526a6..5dc7b3a 100644
|
|
--- a/test/lib/TestCommon.py
|
|
+++ b/test/lib/TestCommon.py
|
|
@@ -127,7 +127,7 @@ if sys.platform == 'win32':
|
|
dll_suffix = '.dll'
|
|
module_prefix = ''
|
|
module_suffix = '.dll'
|
|
-elif sys.platform == 'cygwin':
|
|
+elif sys.platform in ('cygwin', 'msys'):
|
|
exe_suffix = '.exe'
|
|
obj_suffix = '.o'
|
|
shobj_suffix = '.os'
|
|
diff --git a/test/lib/TestGyp.py b/test/lib/TestGyp.py
|
|
index e7a522c..54de5de 100644
|
|
--- a/test/lib/TestGyp.py
|
|
+++ b/test/lib/TestGyp.py
|
|
@@ -625,7 +625,7 @@ class TestGypMake(TestGypBase):
|
|
|
|
def ConvertToCygpath(path):
|
|
"""Convert to cygwin path if we are using cygwin."""
|
|
- if sys.platform == 'cygwin':
|
|
+ if sys.platform in ('cygwin', 'msys'):
|
|
p = subprocess.Popen(['cygpath', path], stdout=subprocess.PIPE)
|
|
path = p.communicate()[0].strip()
|
|
return path
|
|
@@ -759,7 +759,7 @@ class TestGypOnMSToolchain(TestGypBase):
|
|
|
|
def initialize_build_tool(self):
|
|
super(TestGypOnMSToolchain, self).initialize_build_tool()
|
|
- if sys.platform in ('win32', 'cygwin'):
|
|
+ if sys.platform in ('win32', 'cygwin', 'msys'):
|
|
build_tools = FindVisualStudioInstallation()
|
|
self.devenv_path, self.uses_msbuild, self.msbuild_path = build_tools
|
|
self.vsvars_path = TestGypOnMSToolchain._ComputeVsvarsPath(
|
|
@@ -768,7 +768,7 @@ class TestGypOnMSToolchain(TestGypBase):
|
|
def run_dumpbin(self, *dumpbin_args):
|
|
"""Run the dumpbin tool with the specified arguments, and capturing and
|
|
returning stdout."""
|
|
- assert sys.platform in ('win32', 'cygwin')
|
|
+ assert sys.platform in ('win32', 'cygwin', 'msys')
|
|
cmd = os.environ.get('COMSPEC', 'cmd.exe')
|
|
arguments = [cmd, '/c', self.vsvars_path, '&&', 'dumpbin']
|
|
arguments.extend(dumpbin_args)
|
|
diff --git a/test/library_dirs/gyptest-library-dirs.py b/test/library_dirs/gyptest-library-dirs.py
|
|
index e725dd1..d0f1a20 100644
|
|
--- a/test/library_dirs/gyptest-library-dirs.py
|
|
+++ b/test/library_dirs/gyptest-library-dirs.py
|
|
@@ -31,7 +31,7 @@ expect = """Hello world
|
|
test.run_built_executable(
|
|
'libraries-search-path-test', chdir='subdir', stdout=expect)
|
|
|
|
-if sys.platform in ('win32', 'cygwin'):
|
|
+if sys.platform in ('win32', 'cygwin', 'msys'):
|
|
test.run_gyp('test-win.gyp',
|
|
'-D',
|
|
'abs_path_to_secret_library_location={0}'.format(lib_dir),
|
|
diff --git a/test/rules/src/external/external.gyp b/test/rules/src/external/external.gyp
|
|
index b28174f..335af69 100644
|
|
--- a/test/rules/src/external/external.gyp
|
|
+++ b/test/rules/src/external/external.gyp
|
|
@@ -19,7 +19,7 @@
|
|
'conditions': [
|
|
['OS=="win"', {
|
|
'dependencies': [
|
|
- 'cygwin',
|
|
+ 'msys',
|
|
],
|
|
}],
|
|
],
|
|
diff --git a/test/target/gyptest-target.py b/test/target/gyptest-target.py
|
|
index 4338db7..fb400ed 100644
|
|
--- a/test/target/gyptest-target.py
|
|
+++ b/test/target/gyptest-target.py
|
|
@@ -13,7 +13,7 @@ target_extension is used to avoid MSB8012 for msvs.
|
|
import sys
|
|
import TestGyp
|
|
|
|
-if sys.platform in ('win32', 'cygwin'):
|
|
+if sys.platform in ('win32', 'cygwin', 'msys'):
|
|
test = TestGyp.TestGyp()
|
|
|
|
test.run_gyp('target.gyp')
|
|
--
|
|
2.10.1.windows.1
|
|
|