nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at 22.05 180 lines 9.0 kB view raw
1diff --git a/setuptools/_distutils/cygwinccompiler.py b/setuptools/_distutils/cygwinccompiler.py 2index c5c86d8f..b879e447 100644 3--- a/setuptools/_distutils/cygwinccompiler.py 4+++ b/setuptools/_distutils/cygwinccompiler.py 5@@ -124,14 +124,19 @@ class CygwinCCompiler(UnixCCompiler): 6 self.cxx = os.environ.get('CXX', 'g++') 7 8 self.linker_dll = self.cc 9+ self.linker_dll_cxx = self.cxx 10 shared_option = "-shared" 11 12 self.set_executables(compiler='%s -mcygwin -O -Wall' % self.cc, 13 compiler_so='%s -mcygwin -mdll -O -Wall' % self.cc, 14 compiler_cxx='%s -mcygwin -O -Wall' % self.cxx, 15+ compiler_so_cxx='%s -mcygwin -mdll -O -Wall' % self.cxx, 16 linker_exe='%s -mcygwin' % self.cc, 17 linker_so=('%s -mcygwin %s' % 18- (self.linker_dll, shared_option))) 19+ (self.linker_dll, shared_option)), 20+ linker_exe_cxx='%s -mcygwin' % self.cxx, 21+ linker_so_cxx=('%s -mcygwin %s' % 22+ (self.linker_dll_cxx, shared_option))) 23 24 # Include the appropriate MSVC runtime library if Python was built 25 # with MSVC 7.0 or later. 26@@ -162,8 +167,12 @@ class CygwinCCompiler(UnixCCompiler): 27 raise CompileError(msg) 28 else: # for other files use the C-compiler 29 try: 30- self.spawn(self.compiler_so + cc_args + [src, '-o', obj] + 31- extra_postargs) 32+ if self.detect_language(src) == 'c++': 33+ self.spawn(self.compiler_so_cxx + cc_args + [src, '-o', obj] + 34+ extra_postargs) 35+ else: 36+ self.spawn(self.compiler_so + cc_args + [src, '-o', obj] + 37+ extra_postargs) 38 except DistutilsExecError as msg: 39 raise CompileError(msg) 40 41@@ -279,9 +288,13 @@ class Mingw32CCompiler(CygwinCCompiler): 42 self.set_executables(compiler='%s -O -Wall' % self.cc, 43 compiler_so='%s -mdll -O -Wall' % self.cc, 44 compiler_cxx='%s -O -Wall' % self.cxx, 45+ compiler_so_cxx='%s -mdll -O -Wall' % self.cxx, 46 linker_exe='%s' % self.cc, 47 linker_so='%s %s' 48- % (self.linker_dll, shared_option)) 49+ % (self.linker_dll, shared_option), 50+ linker_exe_cxx='%s' % self.cxx, 51+ linker_so_cxx='%s %s' 52+ % (self.linker_dll_cxx, shared_option)) 53 54 # Maybe we should also append -mthreads, but then the finished 55 # dlls need another dll (mingwm10.dll see Mingw32 docs) 56diff --git a/setuptools/_distutils/sysconfig.py b/setuptools/_distutils/sysconfig.py 57index 9fad3835..889e2595 100644 58--- a/setuptools/_distutils/sysconfig.py 59+++ b/setuptools/_distutils/sysconfig.py 60@@ -216,9 +216,11 @@ def customize_compiler(compiler): 61 _osx_support.customize_compiler(_config_vars) 62 _config_vars['CUSTOMIZED_OSX_COMPILER'] = 'True' 63 64- (cc, cxx, cflags, ccshared, ldshared, shlib_suffix, ar, ar_flags) = \ 65- get_config_vars('CC', 'CXX', 'CFLAGS', 66- 'CCSHARED', 'LDSHARED', 'SHLIB_SUFFIX', 'AR', 'ARFLAGS') 67+ (cc, cxx, cflags, ccshared, ldshared, ldcxxshared, shlib_suffix, ar, ar_flags) = \ 68+ get_config_vars('CC', 'CXX', 'CFLAGS', 'CCSHARED', 'LDSHARED', 'LDCXXSHARED', 69+ 'SHLIB_SUFFIX', 'AR', 'ARFLAGS') 70+ 71+ cxxflags = cflags 72 73 if 'CC' in os.environ: 74 newcc = os.environ['CC'] 75@@ -232,19 +234,27 @@ def customize_compiler(compiler): 76 cxx = os.environ['CXX'] 77 if 'LDSHARED' in os.environ: 78 ldshared = os.environ['LDSHARED'] 79+ if 'LDCXXSHARED' in os.environ: 80+ ldcxxshared = os.environ['LDCXXSHARED'] 81 if 'CPP' in os.environ: 82 cpp = os.environ['CPP'] 83 else: 84 cpp = cc + " -E" # not always 85 if 'LDFLAGS' in os.environ: 86 ldshared = ldshared + ' ' + os.environ['LDFLAGS'] 87+ ldcxxshared = ldcxxshared + ' ' + os.environ['LDFLAGS'] 88 if 'CFLAGS' in os.environ: 89- cflags = cflags + ' ' + os.environ['CFLAGS'] 90+ cflags = os.environ['CFLAGS'] 91 ldshared = ldshared + ' ' + os.environ['CFLAGS'] 92+ if 'CXXFLAGS' in os.environ: 93+ cxxflags = os.environ['CXXFLAGS'] 94+ ldcxxshared = ldcxxshared + ' ' + os.environ['CXXFLAGS'] 95 if 'CPPFLAGS' in os.environ: 96 cpp = cpp + ' ' + os.environ['CPPFLAGS'] 97 cflags = cflags + ' ' + os.environ['CPPFLAGS'] 98+ cxxflags = cxxflags + ' ' + os.environ['CPPFLAGS'] 99 ldshared = ldshared + ' ' + os.environ['CPPFLAGS'] 100+ ldcxxshared = ldcxxshared + ' ' + os.environ['CPPFLAGS'] 101 if 'AR' in os.environ: 102 ar = os.environ['AR'] 103 if 'ARFLAGS' in os.environ: 104@@ -253,13 +263,17 @@ def customize_compiler(compiler): 105 archiver = ar + ' ' + ar_flags 106 107 cc_cmd = cc + ' ' + cflags 108+ cxx_cmd = cxx + ' ' + cxxflags 109 compiler.set_executables( 110 preprocessor=cpp, 111 compiler=cc_cmd, 112 compiler_so=cc_cmd + ' ' + ccshared, 113- compiler_cxx=cxx, 114+ compiler_cxx=cxx_cmd, 115+ compiler_so_cxx=cxx_cmd + ' ' + ccshared, 116 linker_so=ldshared, 117 linker_exe=cc, 118+ linker_so_cxx=ldcxxshared, 119+ linker_exe_cxx=cxx, 120 archiver=archiver) 121 122 if 'RANLIB' in os.environ and compiler.executables.get('ranlib', None): 123diff --git a/setuptools/_distutils/unixccompiler.py b/setuptools/_distutils/unixccompiler.py 124index 715408f5..6125a1eb 100644 125--- a/setuptools/_distutils/unixccompiler.py 126+++ b/setuptools/_distutils/unixccompiler.py 127@@ -110,14 +110,17 @@ class UnixCCompiler(CCompiler): 128 # are pretty generic; they will probably have to be set by an outsider 129 # (eg. using information discovered by the sysconfig about building 130 # Python extensions). 131- executables = {'preprocessor' : None, 132- 'compiler' : ["cc"], 133- 'compiler_so' : ["cc"], 134- 'compiler_cxx' : ["cc"], 135- 'linker_so' : ["cc", "-shared"], 136- 'linker_exe' : ["cc"], 137- 'archiver' : ["ar", "-cr"], 138- 'ranlib' : None, 139+ executables = {'preprocessor' : None, 140+ 'compiler' : ["cc"], 141+ 'compiler_so' : ["cc"], 142+ 'compiler_cxx' : ["c++"], 143+ 'compiler_so_cxx' : ["c++"], 144+ 'linker_so' : ["cc", "-shared"], 145+ 'linker_exe' : ["cc"], 146+ 'linker_so_cxx' : ["c++", "-shared"], 147+ 'linker_exe_cxx' : ["c++"], 148+ 'archiver' : ["ar", "-cr"], 149+ 'ranlib' : None, 150 } 151 152 if sys.platform[:6] == "darwin": 153@@ -169,9 +172,15 @@ class UnixCCompiler(CCompiler): 154 def _compile(self, obj, src, ext, cc_args, extra_postargs, pp_opts): 155 compiler_so = compiler_fixup( 156 self.compiler_so, cc_args + extra_postargs) 157+ compiler_so_cxx = compiler_fixup( 158+ self.compiler_so_cxx, cc_args + extra_postargs) 159 try: 160- self.spawn(compiler_so + cc_args + [src, '-o', obj] + 161- extra_postargs) 162+ if self.detect_language(src) == 'c++': 163+ self.spawn(compiler_so_cxx + cc_args + [ src, '-o', obj] + 164+ extra_postargs) 165+ else: 166+ self.spawn(compiler_so + cc_args + [src, '-o', obj] + 167+ extra_postargs) 168 except DistutilsExecError as msg: 169 raise CompileError(msg) 170 171@@ -233,7 +242,8 @@ class UnixCCompiler(CCompiler): 172 # building an executable or linker_so (with shared options) 173 # when building a shared library. 174 building_exe = target_desc == CCompiler.EXECUTABLE 175- linker = (self.linker_exe if building_exe else self.linker_so)[:] 176+ linker = (self.linker_exe if building_exe else (self.linker_so_cxx if 177+ target_lang == "c++" else self.linker_so))[:] 178 179 if target_lang == "c++" and self.compiler_cxx: 180 env, linker_ne = _split_env(linker)