Skip to content

Commit

Permalink
distutils: compiler customize mingw cygwin compilers
Browse files Browse the repository at this point in the history
Co-authored-by: Naveen M K <[email protected]>
  • Loading branch information
2 people authored and lazka committed Jul 19, 2023
1 parent 7b1cd02 commit aac2cf7
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion Lib/distutils/sysconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,23 @@ def customize_compiler(compiler):
Mainly needed on Unix, so we can plug in the information that
varies across Unices and is stored in Python's Makefile.
"""
if compiler.compiler_type == "unix":
global _config_vars
if compiler.compiler_type in ["cygwin", "mingw32"]:
# Note that cygwin use posix build and 'unix' compiler.
# If build is not based on posix then we must predefine
# some environment variables corresponding to posix
# build rules and defaults.
if not 'GCC' in sys.version:
_config_vars['CC'] = "gcc"
_config_vars['CXX'] = "g++"
_config_vars['OPT'] = "-fwrapv -O3 -Wall -Wstrict-prototypes"
_config_vars['CFLAGS'] = ""
_config_vars['CCSHARED'] = ""
_config_vars['LDSHARED'] = "gcc -shared -Wl,--enable-auto-image-base"
_config_vars['AR'] = "ar"
_config_vars['ARFLAGS'] = "rc"

if compiler.compiler_type in ["unix", "cygwin", "mingw32"]:
if sys.platform == "darwin":
# Perform first-time customization of compiler-related
# config vars on OS X now that we know we need a compiler.
Expand Down

0 comments on commit aac2cf7

Please sign in to comment.