Skip to content

Instantly share code, notes, and snippets.

@Quipyowert2
Created February 7, 2023 21:15
Show Gist options
  • Save Quipyowert2/f6258728fd365464d8e1384d7b3dc79a to your computer and use it in GitHub Desktop.
Save Quipyowert2/f6258728fd365464d8e1384d7b3dc79a to your computer and use it in GitHub Desktop.
Changes to SCons 4.4.1 to get Globulation 2 to compile on Mingw64 environment of MSYS2
diff --git a/SCons/Environment.py b/SCons/Environment.py
index 7212c89ea..69f13a9c4 100644
--- a/SCons/Environment.py
+++ b/SCons/Environment.py
@@ -587,6 +587,9 @@ class SubstitutionEnvironment:
# othewise force a shell
if not is_List(command):
kw["shell"] = True
+ if "mingw" in self["TOOLS"] and "shell" in kw:
+ command = ["sh", "-c", command]
+ kw["shell"] = False
# run constructed command
p = SCons.Action._subproc(self, command, **kw)
out, err = p.communicate()
diff --git a/SCons/Platform/posix.py b/SCons/Platform/posix.py
index 75b6c0bf2..5bae68916 100644
--- a/SCons/Platform/posix.py
+++ b/SCons/Platform/posix.py
@@ -83,6 +83,8 @@ def generate(env):
if 'ENV' not in env:
env['ENV'] = {}
env['ENV']['PATH'] = '/usr/local/bin:/opt/bin:/bin:/usr/bin:/snap/bin'
+ if 'mingw' in env['TOOLS']:
+ env.AppendENVPath('PATH', '/mingw64/bin:/mingw32/bin', 'ENV', ':')
env['OBJPREFIX'] = ''
env['OBJSUFFIX'] = '.o'
env['SHOBJPREFIX'] = '$OBJPREFIX'
diff --git a/SCons/Tool/mingw.py b/SCons/Tool/mingw.py
index 8e7ac2df9..1c7e8ec04 100644
--- a/SCons/Tool/mingw.py
+++ b/SCons/Tool/mingw.py
@@ -208,6 +208,8 @@ def generate(env):
env['LDMODULENOVERSIONSYMLINKS'] = True
env['IMPLIBNOVERSIONSYMLINKS'] = True
+ env['ENV']['PATH'] += ':/mingw64/bin:/mingw32/bin'
+ #env.AppendENVPath('PATH', ':/mingw64/bin:/mingw32/bin')
def exists(env):
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment