mingw.py (SCons-4.3.0) | : | mingw.py (SCons-4.4.0) | ||
---|---|---|---|---|
skipping to change at line 44 | skipping to change at line 44 | |||
import os | import os | |||
import os.path | import os.path | |||
import glob | import glob | |||
import SCons.Action | import SCons.Action | |||
import SCons.Builder | import SCons.Builder | |||
import SCons.Defaults | import SCons.Defaults | |||
import SCons.Tool | import SCons.Tool | |||
import SCons.Util | import SCons.Util | |||
mingw_paths = [ | mingw_base_paths = [ | |||
r'c:\MinGW\bin', | r'c:\MinGW\bin', | |||
r'C:\cygwin64\bin', | r'C:\cygwin64\bin', | |||
r'C:\msys64', | r'C:\msys64', | |||
r'C:\msys64\mingw64\bin', | r'C:\msys64\mingw64\bin', | |||
r'C:\cygwin\bin', | r'C:\cygwin\bin', | |||
r'C:\msys', | r'C:\msys', | |||
r'C:\ProgramData\chocolatey\lib\mingw\tools\install\mingw64\bin' | r'C:\ProgramData\chocolatey\lib\mingw\tools\install\mingw64\bin' | |||
] | ] | |||
def shlib_generator(target, source, env, for_signature): | def shlib_generator(target, source, env, for_signature): | |||
skipping to change at line 126 | skipping to change at line 126 | |||
# This is what we search for to find mingw: | # This is what we search for to find mingw: | |||
# key_program = 'mingw32-gcc' | # key_program = 'mingw32-gcc' | |||
key_program = 'mingw32-make' | key_program = 'mingw32-make' | |||
def find_version_specific_mingw_paths(): | def find_version_specific_mingw_paths(): | |||
r""" | r""" | |||
One example of default mingw install paths is: | One example of default mingw install paths is: | |||
C:\mingw-w64\x86_64-6.3.0-posix-seh-rt_v5-rev2\mingw64\bin | C:\mingw-w64\x86_64-6.3.0-posix-seh-rt_v5-rev2\mingw64\bin | |||
Use glob'ing to find such and add to mingw_paths | Use glob'ing to find such and add to mingw_base_paths | |||
""" | """ | |||
new_paths = glob.glob(r"C:\mingw-w64\*\mingw64\bin") | new_paths = glob.glob(r"C:\mingw-w64\*\mingw64\bin") | |||
return new_paths | return new_paths | |||
_mingw_all_paths = None | ||||
def get_mingw_paths(): | ||||
global _mingw_all_paths | ||||
if _mingw_all_paths is None: | ||||
_mingw_all_paths = mingw_base_paths + find_version_specific_mingw_paths( | ||||
) | ||||
return _mingw_all_paths | ||||
def generate(env): | def generate(env): | |||
global mingw_paths | ||||
# Check for reasoanble mingw default paths | # Check for reasoanble mingw default paths | |||
mingw_paths += find_version_specific_mingw_paths() | mingw_paths = get_mingw_paths() | |||
mingw = SCons.Tool.find_program_path(env, key_program, default_paths=mingw_p aths) | mingw = SCons.Tool.find_program_path(env, key_program, default_paths=mingw_p aths) | |||
if mingw: | if mingw: | |||
mingw_bin_dir = os.path.dirname(mingw) | mingw_bin_dir = os.path.dirname(mingw) | |||
# Adjust path if we found it in a chocolatey install | # Adjust path if we found it in a chocolatey install | |||
if mingw_bin_dir == r'C:\ProgramData\chocolatey\bin': | if mingw_bin_dir == r'C:\ProgramData\chocolatey\bin': | |||
mingw_bin_dir = r'C:\ProgramData\chocolatey\lib\mingw\tools\install\ mingw64\bin' | mingw_bin_dir = r'C:\ProgramData\chocolatey\lib\mingw\tools\install\ mingw64\bin' | |||
env.AppendENVPath('PATH', mingw_bin_dir) | env.AppendENVPath('PATH', mingw_bin_dir) | |||
skipping to change at line 200 | skipping to change at line 207 | |||
# Handle new versioned shared library logic | # Handle new versioned shared library logic | |||
env['_SHLIBSUFFIX'] = '$SHLIBSUFFIX' | env['_SHLIBSUFFIX'] = '$SHLIBSUFFIX' | |||
env["SHLIBPREFIX"] = "" | env["SHLIBPREFIX"] = "" | |||
# Disable creating symlinks for versioned shared library. | # Disable creating symlinks for versioned shared library. | |||
env['SHLIBNOVERSIONSYMLINKS'] = True | env['SHLIBNOVERSIONSYMLINKS'] = True | |||
env['LDMODULENOVERSIONSYMLINKS'] = True | env['LDMODULENOVERSIONSYMLINKS'] = True | |||
env['IMPLIBNOVERSIONSYMLINKS'] = True | env['IMPLIBNOVERSIONSYMLINKS'] = True | |||
def exists(env): | def exists(env): | |||
mingw_paths = get_mingw_paths() | ||||
mingw = SCons.Tool.find_program_path(env, key_program, default_paths=mingw_p aths) | mingw = SCons.Tool.find_program_path(env, key_program, default_paths=mingw_p aths) | |||
if mingw: | if mingw: | |||
mingw_bin_dir = os.path.dirname(mingw) | mingw_bin_dir = os.path.dirname(mingw) | |||
env.AppendENVPath('PATH', mingw_bin_dir) | env.AppendENVPath('PATH', mingw_bin_dir) | |||
return mingw | return mingw | |||
# Local Variables: | # Local Variables: | |||
# tab-width:4 | # tab-width:4 | |||
# indent-tabs-mode:nil | # indent-tabs-mode:nil | |||
End of changes. 6 change blocks. | ||||
4 lines changed or deleted | 13 lines changed or added |