Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 455546 Details for
Bug 599918
dev-python/pypy-bin: bump to version 5.6
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
5.6.0_all_distutils_cxx.patch
5.6.0_all_distutils_cxx.patch (text/plain), 34.90 KB, created by
Jan Ziak (atomsymbol)
on 2016-12-08 20:28:31 UTC
(
hide
)
Description:
5.6.0_all_distutils_cxx.patch
Filename:
MIME Type:
Creator:
Jan Ziak (atomsymbol)
Created:
2016-12-08 20:28:31 UTC
Size:
34.90 KB
patch
obsolete
>http://bugs.python.org/issue1222585 >http://bugs.gentoo.org/show_bug.cgi?id=599918 > >diff -Naur pypy2-v5.6.0-src/lib-python/2.7/distutils/cygwinccompiler.py pypy2-v5.6.0-src-patched/lib-python/2.7/distutils/cygwinccompiler.py >--- pypy2-v5.6.0-src/lib-python/2.7/distutils/cygwinccompiler.py 2016-11-08 09:52:16.000000000 +0100 >+++ pypy2-v5.6.0-src-patched/lib-python/2.7/distutils/cygwinccompiler.py 2016-12-08 16:59:26.213690338 +0100 >@@ -120,8 +120,10 @@ > # dllwrap 2.10.90 is buggy > if self.ld_version >= "2.10.90": > self.linker_dll = "gcc" >+ self.linker_dll_cxx = "g++" > else: > self.linker_dll = "dllwrap" >+ self.linker_dll_cxx = "dllwrap" > > # ld_version >= "2.13" support -shared so use it instead of > # -mdll -static >@@ -135,9 +137,13 @@ > self.set_executables(compiler='gcc -mcygwin -O -Wall', > compiler_so='gcc -mcygwin -mdll -O -Wall', > compiler_cxx='g++ -mcygwin -O -Wall', >+ compiler_so_cxx='g++ -mcygwin -mdll -O -Wall', > linker_exe='gcc -mcygwin', > linker_so=('%s -mcygwin %s' % >- (self.linker_dll, shared_option))) >+ (self.linker_dll, shared_option)), >+ linker_exe_cxx='g++ -mcygwin', >+ linker_so_cxx=('%s -mcygwin %s' % >+ (self.linker_dll_cxx, shared_option))) > > # cygwin and mingw32 need different sets of libraries > if self.gcc_version == "2.91.57": >@@ -163,8 +169,12 @@ > raise CompileError, msg > else: # for other files use the C-compiler > try: >- self.spawn(self.compiler_so + cc_args + [src, '-o', obj] + >- extra_postargs) >+ if self.detect_language(src) == 'c++': >+ self.spawn(self.compiler_so_cxx + cc_args + [src, '-o', obj] + >+ extra_postargs) >+ else: >+ self.spawn(self.compiler_so + cc_args + [src, '-o', obj] + >+ extra_postargs) > except DistutilsExecError, msg: > raise CompileError, msg > >@@ -330,9 +340,14 @@ > self.set_executables(compiler='gcc%s -O -Wall' % no_cygwin, > compiler_so='gcc%s -mdll -O -Wall' % no_cygwin, > compiler_cxx='g++%s -O -Wall' % no_cygwin, >+ compiler_so_cxx='g++%s -mdll -O -Wall' % no_cygwin, > linker_exe='gcc%s' % no_cygwin, > linker_so='%s%s %s %s' > % (self.linker_dll, no_cygwin, >+ shared_option, entry_point), >+ linker_exe_cxx='g++%s' % no_cygwin, >+ linker_so_cxx='%s%s %s %s' >+ % (self.linker_dll_cxx, no_cygwin, > shared_option, entry_point)) > # Maybe we should also append -mthreads, but then the finished > # dlls need another dll (mingwm10.dll see Mingw32 docs) >diff -Naur pypy2-v5.6.0-src/lib-python/2.7/distutils/cygwinccompiler.py.orig pypy2-v5.6.0-src-patched/lib-python/2.7/distutils/cygwinccompiler.py.orig >--- pypy2-v5.6.0-src/lib-python/2.7/distutils/cygwinccompiler.py.orig 1970-01-01 01:00:00.000000000 +0100 >+++ pypy2-v5.6.0-src-patched/lib-python/2.7/distutils/cygwinccompiler.py.orig 2016-11-08 09:52:16.000000000 +0100 >@@ -0,0 +1,466 @@ >+"""distutils.cygwinccompiler >+ >+Provides the CygwinCCompiler class, a subclass of UnixCCompiler that >+handles the Cygwin port of the GNU C compiler to Windows. It also contains >+the Mingw32CCompiler class which handles the mingw32 port of GCC (same as >+cygwin in no-cygwin mode). >+""" >+ >+# problems: >+# >+# * if you use a msvc compiled python version (1.5.2) >+# 1. you have to insert a __GNUC__ section in its config.h >+# 2. you have to generate an import library for its dll >+# - create a def-file for python??.dll >+# - create an import library using >+# dlltool --dllname python15.dll --def python15.def \ >+# --output-lib libpython15.a >+# >+# see also http://starship.python.net/crew/kernr/mingw32/Notes.html >+# >+# * We put export_symbols in a def-file, and don't use >+# --export-all-symbols because it doesn't worked reliable in some >+# tested configurations. And because other windows compilers also >+# need their symbols specified this no serious problem. >+# >+# tested configurations: >+# >+# * cygwin gcc 2.91.57/ld 2.9.4/dllwrap 0.2.4 works >+# (after patching python's config.h and for C++ some other include files) >+# see also http://starship.python.net/crew/kernr/mingw32/Notes.html >+# * mingw32 gcc 2.95.2/ld 2.9.4/dllwrap 0.2.4 works >+# (ld doesn't support -shared, so we use dllwrap) >+# * cygwin gcc 2.95.2/ld 2.10.90/dllwrap 2.10.90 works now >+# - its dllwrap doesn't work, there is a bug in binutils 2.10.90 >+# see also http://sources.redhat.com/ml/cygwin/2000-06/msg01274.html >+# - using gcc -mdll instead dllwrap doesn't work without -static because >+# it tries to link against dlls instead their import libraries. (If >+# it finds the dll first.) >+# By specifying -static we force ld to link against the import libraries, >+# this is windows standard and there are normally not the necessary symbols >+# in the dlls. >+# *** only the version of June 2000 shows these problems >+# * cygwin gcc 3.2/ld 2.13.90 works >+# (ld supports -shared) >+# * mingw gcc 3.2/ld 2.13 works >+# (ld supports -shared) >+ >+# This module should be kept compatible with Python 2.1. >+ >+__revision__ = "$Id$" >+ >+import os,sys,copy >+from distutils.ccompiler import gen_preprocess_options, gen_lib_options >+from distutils.unixccompiler import UnixCCompiler >+from distutils.file_util import write_file >+from distutils.errors import DistutilsExecError, CompileError, UnknownFileError >+from distutils import log >+ >+def get_msvcr(): >+ """Include the appropriate MSVC runtime library if Python was built >+ with MSVC 7.0 or later. >+ """ >+ msc_pos = sys.version.find('MSC v.') >+ if msc_pos != -1: >+ msc_ver = sys.version[msc_pos+6:msc_pos+10] >+ if msc_ver == '1300': >+ # MSVC 7.0 >+ return ['msvcr70'] >+ elif msc_ver == '1310': >+ # MSVC 7.1 >+ return ['msvcr71'] >+ elif msc_ver == '1400': >+ # VS2005 / MSVC 8.0 >+ return ['msvcr80'] >+ elif msc_ver == '1500': >+ # VS2008 / MSVC 9.0 >+ return ['msvcr90'] >+ elif msc_ver == '1600': >+ # VS2010 / MSVC 10.0 >+ return ['msvcr100'] >+ else: >+ raise ValueError("Unknown MS Compiler version %s " % msc_ver) >+ >+ >+class CygwinCCompiler (UnixCCompiler): >+ >+ compiler_type = 'cygwin' >+ obj_extension = ".o" >+ static_lib_extension = ".a" >+ shared_lib_extension = ".dll" >+ static_lib_format = "lib%s%s" >+ shared_lib_format = "%s%s" >+ exe_extension = ".exe" >+ >+ def __init__ (self, verbose=0, dry_run=0, force=0): >+ >+ UnixCCompiler.__init__ (self, verbose, dry_run, force) >+ >+ (status, details) = check_config_h() >+ self.debug_print("Python's GCC status: %s (details: %s)" % >+ (status, details)) >+ if status is not CONFIG_H_OK: >+ self.warn( >+ "Python's pyconfig.h doesn't seem to support your compiler. " >+ "Reason: %s. " >+ "Compiling may fail because of undefined preprocessor macros." >+ % details) >+ >+ self.gcc_version, self.ld_version, self.dllwrap_version = \ >+ get_versions() >+ self.debug_print(self.compiler_type + ": gcc %s, ld %s, dllwrap %s\n" % >+ (self.gcc_version, >+ self.ld_version, >+ self.dllwrap_version) ) >+ >+ # ld_version >= "2.10.90" and < "2.13" should also be able to use >+ # gcc -mdll instead of dllwrap >+ # Older dllwraps had own version numbers, newer ones use the >+ # same as the rest of binutils ( also ld ) >+ # dllwrap 2.10.90 is buggy >+ if self.ld_version >= "2.10.90": >+ self.linker_dll = "gcc" >+ else: >+ self.linker_dll = "dllwrap" >+ >+ # ld_version >= "2.13" support -shared so use it instead of >+ # -mdll -static >+ if self.ld_version >= "2.13": >+ shared_option = "-shared" >+ else: >+ shared_option = "-mdll -static" >+ >+ # Hard-code GCC because that's what this is all about. >+ # XXX optimization, warnings etc. should be customizable. >+ self.set_executables(compiler='gcc -mcygwin -O -Wall', >+ compiler_so='gcc -mcygwin -mdll -O -Wall', >+ compiler_cxx='g++ -mcygwin -O -Wall', >+ linker_exe='gcc -mcygwin', >+ linker_so=('%s -mcygwin %s' % >+ (self.linker_dll, shared_option))) >+ >+ # cygwin and mingw32 need different sets of libraries >+ if self.gcc_version == "2.91.57": >+ # cygwin shouldn't need msvcrt, but without the dlls will crash >+ # (gcc version 2.91.57) -- perhaps something about initialization >+ self.dll_libraries=["msvcrt"] >+ self.warn( >+ "Consider upgrading to a newer version of gcc") >+ else: >+ # Include the appropriate MSVC runtime library if Python was built >+ # with MSVC 7.0 or later. >+ self.dll_libraries = get_msvcr() >+ >+ # __init__ () >+ >+ >+ def _compile(self, obj, src, ext, cc_args, extra_postargs, pp_opts): >+ if ext == '.rc' or ext == '.res': >+ # gcc needs '.res' and '.rc' compiled to object files !!! >+ try: >+ self.spawn(["windres", "-i", src, "-o", obj]) >+ except DistutilsExecError, msg: >+ raise CompileError, msg >+ else: # for other files use the C-compiler >+ try: >+ self.spawn(self.compiler_so + cc_args + [src, '-o', obj] + >+ extra_postargs) >+ except DistutilsExecError, msg: >+ raise CompileError, msg >+ >+ def link (self, >+ target_desc, >+ objects, >+ output_filename, >+ output_dir=None, >+ libraries=None, >+ library_dirs=None, >+ runtime_library_dirs=None, >+ export_symbols=None, >+ debug=0, >+ extra_preargs=None, >+ extra_postargs=None, >+ build_temp=None, >+ target_lang=None): >+ >+ # use separate copies, so we can modify the lists >+ extra_preargs = copy.copy(extra_preargs or []) >+ libraries = copy.copy(libraries or []) >+ objects = copy.copy(objects or []) >+ >+ # Additional libraries >+ libraries.extend(self.dll_libraries) >+ >+ # handle export symbols by creating a def-file >+ # with executables this only works with gcc/ld as linker >+ if ((export_symbols is not None) and >+ (target_desc != self.EXECUTABLE or self.linker_dll == "gcc")): >+ # (The linker doesn't do anything if output is up-to-date. >+ # So it would probably better to check if we really need this, >+ # but for this we had to insert some unchanged parts of >+ # UnixCCompiler, and this is not what we want.) >+ >+ # we want to put some files in the same directory as the >+ # object files are, build_temp doesn't help much >+ # where are the object files >+ temp_dir = os.path.dirname(objects[0]) >+ # name of dll to give the helper files the same base name >+ (dll_name, dll_extension) = os.path.splitext( >+ os.path.basename(output_filename)) >+ >+ # generate the filenames for these files >+ def_file = os.path.join(temp_dir, dll_name + ".def") >+ lib_file = os.path.join(temp_dir, 'lib' + dll_name + ".a") >+ >+ # Generate .def file >+ contents = [ >+ "LIBRARY %s" % os.path.basename(output_filename), >+ "EXPORTS"] >+ for sym in export_symbols: >+ contents.append(sym) >+ self.execute(write_file, (def_file, contents), >+ "writing %s" % def_file) >+ >+ # next add options for def-file and to creating import libraries >+ >+ # dllwrap uses different options than gcc/ld >+ if self.linker_dll == "dllwrap": >+ extra_preargs.extend(["--output-lib", lib_file]) >+ # for dllwrap we have to use a special option >+ extra_preargs.extend(["--def", def_file]) >+ # we use gcc/ld here and can be sure ld is >= 2.9.10 >+ else: >+ # doesn't work: bfd_close build\...\libfoo.a: Invalid operation >+ #extra_preargs.extend(["-Wl,--out-implib,%s" % lib_file]) >+ # for gcc/ld the def-file is specified as any object files >+ objects.append(def_file) >+ >+ #end: if ((export_symbols is not None) and >+ # (target_desc != self.EXECUTABLE or self.linker_dll == "gcc")): >+ >+ # who wants symbols and a many times larger output file >+ # should explicitly switch the debug mode on >+ # otherwise we let dllwrap/ld strip the output file >+ # (On my machine: 10KB < stripped_file < ??100KB >+ # unstripped_file = stripped_file + XXX KB >+ # ( XXX=254 for a typical python extension)) >+ if not debug: >+ extra_preargs.append("-s") >+ >+ UnixCCompiler.link(self, >+ target_desc, >+ objects, >+ output_filename, >+ output_dir, >+ libraries, >+ library_dirs, >+ runtime_library_dirs, >+ None, # export_symbols, we do this in our def-file >+ debug, >+ extra_preargs, >+ extra_postargs, >+ build_temp, >+ target_lang) >+ >+ # link () >+ >+ # -- Miscellaneous methods ----------------------------------------- >+ >+ # overwrite the one from CCompiler to support rc and res-files >+ def object_filenames (self, >+ source_filenames, >+ strip_dir=0, >+ output_dir=''): >+ if output_dir is None: output_dir = '' >+ obj_names = [] >+ for src_name in source_filenames: >+ # use normcase to make sure '.rc' is really '.rc' and not '.RC' >+ (base, ext) = os.path.splitext (os.path.normcase(src_name)) >+ if ext not in (self.src_extensions + ['.rc','.res']): >+ raise UnknownFileError, \ >+ "unknown file type '%s' (from '%s')" % \ >+ (ext, src_name) >+ if strip_dir: >+ base = os.path.basename (base) >+ if ext == '.res' or ext == '.rc': >+ # these need to be compiled to object files >+ obj_names.append (os.path.join (output_dir, >+ base + ext + self.obj_extension)) >+ else: >+ obj_names.append (os.path.join (output_dir, >+ base + self.obj_extension)) >+ return obj_names >+ >+ # object_filenames () >+ >+# class CygwinCCompiler >+ >+ >+# the same as cygwin plus some additional parameters >+class Mingw32CCompiler (CygwinCCompiler): >+ >+ compiler_type = 'mingw32' >+ >+ def __init__ (self, >+ verbose=0, >+ dry_run=0, >+ force=0): >+ >+ CygwinCCompiler.__init__ (self, verbose, dry_run, force) >+ >+ # ld_version >= "2.13" support -shared so use it instead of >+ # -mdll -static >+ if self.ld_version >= "2.13": >+ shared_option = "-shared" >+ else: >+ shared_option = "-mdll -static" >+ >+ # A real mingw32 doesn't need to specify a different entry point, >+ # but cygwin 2.91.57 in no-cygwin-mode needs it. >+ if self.gcc_version <= "2.91.57": >+ entry_point = '--entry _DllMain@12' >+ else: >+ entry_point = '' >+ >+ if self.gcc_version < '4' or is_cygwingcc(): >+ no_cygwin = ' -mno-cygwin' >+ else: >+ no_cygwin = '' >+ >+ self.set_executables(compiler='gcc%s -O -Wall' % no_cygwin, >+ compiler_so='gcc%s -mdll -O -Wall' % no_cygwin, >+ compiler_cxx='g++%s -O -Wall' % no_cygwin, >+ linker_exe='gcc%s' % no_cygwin, >+ linker_so='%s%s %s %s' >+ % (self.linker_dll, no_cygwin, >+ shared_option, entry_point)) >+ # Maybe we should also append -mthreads, but then the finished >+ # dlls need another dll (mingwm10.dll see Mingw32 docs) >+ # (-mthreads: Support thread-safe exception handling on `Mingw32') >+ >+ # no additional libraries needed >+ self.dll_libraries=[] >+ >+ # Include the appropriate MSVC runtime library if Python was built >+ # with MSVC 7.0 or later. >+ self.dll_libraries = get_msvcr() >+ >+ # __init__ () >+ >+# class Mingw32CCompiler >+ >+# Because these compilers aren't configured in Python's pyconfig.h file by >+# default, we should at least warn the user if he is using a unmodified >+# version. >+ >+CONFIG_H_OK = "ok" >+CONFIG_H_NOTOK = "not ok" >+CONFIG_H_UNCERTAIN = "uncertain" >+ >+def check_config_h(): >+ >+ """Check if the current Python installation (specifically, pyconfig.h) >+ appears amenable to building extensions with GCC. Returns a tuple >+ (status, details), where 'status' is one of the following constants: >+ CONFIG_H_OK >+ all is well, go ahead and compile >+ CONFIG_H_NOTOK >+ doesn't look good >+ CONFIG_H_UNCERTAIN >+ not sure -- unable to read pyconfig.h >+ 'details' is a human-readable string explaining the situation. >+ >+ Note there are two ways to conclude "OK": either 'sys.version' contains >+ the string "GCC" (implying that this Python was built with GCC), or the >+ installed "pyconfig.h" contains the string "__GNUC__". >+ """ >+ >+ # XXX since this function also checks sys.version, it's not strictly a >+ # "pyconfig.h" check -- should probably be renamed... >+ >+ from distutils import sysconfig >+ import string >+ # if sys.version contains GCC then python was compiled with >+ # GCC, and the pyconfig.h file should be OK >+ if string.find(sys.version,"GCC") >= 0: >+ return (CONFIG_H_OK, "sys.version mentions 'GCC'") >+ >+ fn = sysconfig.get_config_h_filename() >+ try: >+ # It would probably better to read single lines to search. >+ # But we do this only once, and it is fast enough >+ f = open(fn) >+ try: >+ s = f.read() >+ finally: >+ f.close() >+ >+ except IOError, exc: >+ # if we can't read this file, we cannot say it is wrong >+ # the compiler will complain later about this file as missing >+ return (CONFIG_H_UNCERTAIN, >+ "couldn't read '%s': %s" % (fn, exc.strerror)) >+ >+ else: >+ # "pyconfig.h" contains an "#ifdef __GNUC__" or something similar >+ if string.find(s,"__GNUC__") >= 0: >+ return (CONFIG_H_OK, "'%s' mentions '__GNUC__'" % fn) >+ else: >+ return (CONFIG_H_NOTOK, "'%s' does not mention '__GNUC__'" % fn) >+ >+ >+ >+def get_versions(): >+ """ Try to find out the versions of gcc, ld and dllwrap. >+ If not possible it returns None for it. >+ """ >+ from distutils.version import LooseVersion >+ from distutils.spawn import find_executable >+ import re >+ >+ gcc_exe = find_executable('gcc') >+ if gcc_exe: >+ out = os.popen(gcc_exe + ' -dumpversion','r') >+ out_string = out.read() >+ out.close() >+ result = re.search('(\d+\.\d+(\.\d+)*)',out_string) >+ if result: >+ gcc_version = LooseVersion(result.group(1)) >+ else: >+ gcc_version = None >+ else: >+ gcc_version = None >+ ld_exe = find_executable('ld') >+ if ld_exe: >+ out = os.popen(ld_exe + ' -v','r') >+ out_string = out.read() >+ out.close() >+ result = re.search('(\d+\.\d+(\.\d+)*)',out_string) >+ if result: >+ ld_version = LooseVersion(result.group(1)) >+ else: >+ ld_version = None >+ else: >+ ld_version = None >+ dllwrap_exe = find_executable('dllwrap') >+ if dllwrap_exe: >+ out = os.popen(dllwrap_exe + ' --version','r') >+ out_string = out.read() >+ out.close() >+ result = re.search(' (\d+\.\d+(\.\d+)*)',out_string) >+ if result: >+ dllwrap_version = LooseVersion(result.group(1)) >+ else: >+ dllwrap_version = None >+ else: >+ dllwrap_version = None >+ return (gcc_version, ld_version, dllwrap_version) >+ >+def is_cygwingcc(): >+ '''Try to determine if the gcc that would be used is from cygwin.''' >+ out = os.popen('gcc -dumpmachine', 'r') >+ out_string = out.read() >+ out.close() >+ # out_string is the target triplet cpu-vendor-os >+ # Cygwin's gcc sets the os to 'cygwin' >+ return out_string.strip().endswith('cygwin') >diff -Naur pypy2-v5.6.0-src/lib-python/2.7/distutils/emxccompiler.py pypy2-v5.6.0-src-patched/lib-python/2.7/distutils/emxccompiler.py >--- pypy2-v5.6.0-src/lib-python/2.7/distutils/emxccompiler.py 2016-11-08 09:52:16.000000000 +0100 >+++ pypy2-v5.6.0-src-patched/lib-python/2.7/distutils/emxccompiler.py 2016-12-08 16:59:26.213690338 +0100 >@@ -65,8 +65,12 @@ > # XXX optimization, warnings etc. should be customizable. > self.set_executables(compiler='gcc -Zomf -Zmt -O3 -fomit-frame-pointer -mprobe -Wall', > compiler_so='gcc -Zomf -Zmt -O3 -fomit-frame-pointer -mprobe -Wall', >+ compiler_cxx='g++ -Zomf -Zmt -O3 -fomit-frame-pointer -mprobe -Wall', >+ compiler_so_cxx='g++ -Zomf -Zmt -O3 -fomit-frame-pointer -mprobe -Wall', > linker_exe='gcc -Zomf -Zmt -Zcrtdll', >- linker_so='gcc -Zomf -Zmt -Zcrtdll -Zdll') >+ linker_so='gcc -Zomf -Zmt -Zcrtdll -Zdll', >+ linker_exe_cxx='g++ -Zomf -Zmt -Zcrtdll', >+ linker_so_cxx='g++ -Zomf -Zmt -Zcrtdll -Zdll') > > # want the gcc library statically linked (so that we don't have > # to distribute a version dependent on the compiler we have) >@@ -83,8 +87,12 @@ > raise CompileError, msg > else: # for other files use the C-compiler > try: >- self.spawn(self.compiler_so + cc_args + [src, '-o', obj] + >- extra_postargs) >+ if self.detect_language(src) == 'c++': >+ self.spawn(self.compiler_so_cxx + cc_args + [src, '-o', obj] + >+ extra_postargs) >+ else: >+ self.spawn(self.compiler_so + cc_args + [src, '-o', obj] + >+ extra_postargs) > except DistutilsExecError, msg: > raise CompileError, msg > >diff -Naur pypy2-v5.6.0-src/lib-python/2.7/distutils/sysconfig_cpython.py pypy2-v5.6.0-src-patched/lib-python/2.7/distutils/sysconfig_cpython.py >--- pypy2-v5.6.0-src/lib-python/2.7/distutils/sysconfig_cpython.py 2016-11-08 09:52:16.000000000 +0100 >+++ pypy2-v5.6.0-src-patched/lib-python/2.7/distutils/sysconfig_cpython.py 2016-12-08 16:59:26.213690338 +0100 >@@ -171,10 +171,12 @@ > _osx_support.customize_compiler(_config_vars) > _config_vars['CUSTOMIZED_OSX_COMPILER'] = 'True' > >- (cc, cxx, opt, cflags, ccshared, ldshared, so_ext, ar, ar_flags) = \ >- get_config_vars('CC', 'CXX', 'OPT', 'CFLAGS', >- 'CCSHARED', 'LDSHARED', 'SO', 'AR', >- 'ARFLAGS') >+ (cc, cxx, ccshared, ldshared, ldcxxshared, so_ext, ar, ar_flags) = \ >+ get_config_vars('CC', 'CXX', 'CCSHARED', 'LDSHARED', 'LDCXXSHARED', >+ 'SO', 'AR', 'ARFLAGS') >+ >+ cflags = '' >+ cxxflags = '' > > if 'CC' in os.environ: > newcc = os.environ['CC'] >@@ -189,19 +191,27 @@ > cxx = os.environ['CXX'] > if 'LDSHARED' in os.environ: > ldshared = os.environ['LDSHARED'] >+ if 'LDCXXSHARED' in os.environ: >+ ldcxxshared = os.environ['LDCXXSHARED'] > if 'CPP' in os.environ: > cpp = os.environ['CPP'] > else: > cpp = cc + " -E" # not always > if 'LDFLAGS' in os.environ: > ldshared = ldshared + ' ' + os.environ['LDFLAGS'] >+ ldcxxshared = ldcxxshared + ' ' + os.environ['LDFLAGS'] > if 'CFLAGS' in os.environ: >- cflags = opt + ' ' + os.environ['CFLAGS'] >+ cflags = os.environ['CFLAGS'] > ldshared = ldshared + ' ' + os.environ['CFLAGS'] >+ if 'CXXFLAGS' in os.environ: >+ cxxflags = os.environ['CXXFLAGS'] >+ ldcxxshared = ldcxxshared + ' ' + os.environ['CXXFLAGS'] > if 'CPPFLAGS' in os.environ: > cpp = cpp + ' ' + os.environ['CPPFLAGS'] > cflags = cflags + ' ' + os.environ['CPPFLAGS'] >+ cxxflags = cxxflags + ' ' + os.environ['CPPFLAGS'] > ldshared = ldshared + ' ' + os.environ['CPPFLAGS'] >+ ldcxxshared = ldcxxshared + ' ' + os.environ['CPPFLAGS'] > if 'AR' in os.environ: > ar = os.environ['AR'] > if 'ARFLAGS' in os.environ: >@@ -210,13 +220,17 @@ > archiver = ar + ' ' + ar_flags > > cc_cmd = cc + ' ' + cflags >+ cxx_cmd = cxx + ' ' + cxxflags > compiler.set_executables( > preprocessor=cpp, > compiler=cc_cmd, > compiler_so=cc_cmd + ' ' + ccshared, >- compiler_cxx=cxx, >+ compiler_cxx=cxx_cmd, >+ compiler_so_cxx=cxx_cmd + ' ' + ccshared, > linker_so=ldshared, > linker_exe=cc, >+ linker_so_cxx=ldcxxshared, >+ linker_exe_cxx=cxx, > archiver=archiver) > > compiler.shared_lib_extension = so_ext >diff -Naur pypy2-v5.6.0-src/lib-python/2.7/distutils/sysconfig_pypy.py pypy2-v5.6.0-src-patched/lib-python/2.7/distutils/sysconfig_pypy.py >--- pypy2-v5.6.0-src/lib-python/2.7/distutils/sysconfig_pypy.py 2016-11-08 09:52:16.000000000 +0100 >+++ pypy2-v5.6.0-src-patched/lib-python/2.7/distutils/sysconfig_pypy.py 2016-12-08 17:01:33.594553801 +0100 >@@ -126,19 +126,56 @@ > setattr(compiler, executable, command) > > if compiler.compiler_type == "unix": >- compiler.compiler_so.extend(['-O2', '-fPIC', '-Wimplicit']) >+ cc = ' '.join(compiler.compiler) >+ cxx = ' '.join(compiler.compiler_cxx) >+ ldshared = ' '.join(compiler.linker_so) >+ ldcxxshared = ' '.join(compiler.linker_so_cxx) >+ >+ cflags = '' >+ cxxflags = '' >+ ccshared = '-fPIC' >+ >+ if 'CC' in os.environ: >+ cc = os.environ['CC'] >+ if 'CXX' in os.environ: >+ cxx = os.environ['CXX'] >+ if 'LDSHARED' in os.environ: >+ ldshared = os.environ['LDSHARED'] >+ if 'LDCXXSHARED' in os.environ: >+ ldcxxshared = os.environ['LDCXXSHARED'] >+ if 'CPP' in os.environ: >+ cpp = os.environ['CPP'] >+ else: >+ cpp = cc + " -E" # not always >+ if 'CPPFLAGS' in os.environ: >+ cpp = cpp + ' ' + os.environ['CPPFLAGS'] >+ cflags = cflags + ' ' + os.environ['CPPFLAGS'] >+ cxxflags = cxxflags + ' ' + os.environ['CPPFLAGS'] >+ ldshared = ldshared + ' ' + os.environ['CPPFLAGS'] >+ ldcxxshared = ldcxxshared + ' ' + os.environ['CPPFLAGS'] >+ if 'CFLAGS' in os.environ: >+ cflags = os.environ['CFLAGS'] >+ ldshared = ldshared + ' ' + os.environ['CFLAGS'] >+ if 'CXXFLAGS' in os.environ: >+ cxxflags = os.environ['CXXFLAGS'] >+ ldcxxshared = ldcxxshared + ' ' + os.environ['CXXFLAGS'] >+ if 'LDFLAGS' in os.environ: >+ ldshared = ldshared + ' ' + os.environ['LDFLAGS'] >+ ldcxxshared = ldcxxshared + ' ' + os.environ['LDFLAGS'] >+ >+ cc_cmd = cc + ' ' + cflags >+ cxx_cmd = cxx + ' ' + cxxflags >+ compiler.set_executables( >+ preprocessor=cpp, >+ compiler=cc_cmd, >+ compiler_so=cc_cmd + ' ' + ccshared, >+ compiler_cxx=cxx_cmd, >+ compiler_so_cxx=cxx_cmd + ' ' + ccshared, >+ linker_so=ldshared, >+ linker_exe=cc, >+ linker_so_cxx=ldcxxshared, >+ linker_exe_cxx=cxx) > compiler.shared_lib_extension = get_config_var('SO') >- if "CPPFLAGS" in os.environ: >- cppflags = shlex.split(os.environ["CPPFLAGS"]) >- for executable in ('compiler', 'compiler_so', 'linker_so'): >- customize(executable, cppflags) >- if "CFLAGS" in os.environ: >- cflags = shlex.split(os.environ["CFLAGS"]) >- for executable in ('compiler', 'compiler_so', 'linker_so'): >- customize(executable, cflags) >- if "LDFLAGS" in os.environ: >- ldflags = shlex.split(os.environ["LDFLAGS"]) >- customize('linker_so', ldflags) > > > from sysconfig_cpython import ( >diff -Naur pypy2-v5.6.0-src/lib-python/2.7/distutils/unixccompiler.py pypy2-v5.6.0-src-patched/lib-python/2.7/distutils/unixccompiler.py >--- pypy2-v5.6.0-src/lib-python/2.7/distutils/unixccompiler.py 2016-11-08 09:52:16.000000000 +0100 >+++ pypy2-v5.6.0-src-patched/lib-python/2.7/distutils/unixccompiler.py 2016-12-08 16:59:26.213690338 +0100 >@@ -55,14 +55,17 @@ > # are pretty generic; they will probably have to be set by an outsider > # (eg. using information discovered by the sysconfig about building > # Python extensions). >- executables = {'preprocessor' : None, >- 'compiler' : ["cc"], >- 'compiler_so' : ["cc"], >- 'compiler_cxx' : ["c++"], # pypy: changed, 'cc' is bogus >- 'linker_so' : ["cc", "-shared"], >- 'linker_exe' : ["cc"], >- 'archiver' : ["ar", "-cr"], >- 'ranlib' : None, >+ executables = {'preprocessor' : None, >+ 'compiler' : ["cc"], >+ 'compiler_so' : ["cc"], >+ 'compiler_cxx' : ["c++"], >+ 'compiler_so_cxx' : ["c++"], >+ 'linker_so' : ["cc", "-shared"], >+ 'linker_exe' : ["cc"], >+ 'linker_so_cxx' : ["c++", "-shared"], >+ 'linker_exe_cxx' : ["c++"], >+ 'archiver' : ["ar", "-cr"], >+ 'ranlib' : None, > } > > if sys.platform[:6] == "darwin": >@@ -129,12 +132,19 @@ > > def _compile(self, obj, src, ext, cc_args, extra_postargs, pp_opts): > compiler_so = self.compiler_so >+ compiler_so_cxx = self.compiler_so_cxx > if sys.platform == 'darwin': > compiler_so = _osx_support.compiler_fixup(compiler_so, > cc_args + extra_postargs) >+ compiler_so_cxx = _osx_support.compiler_fixup(compiler_so_cxx, >+ cc_args + extra_postargs) > try: >- self.spawn(compiler_so + cc_args + [src, '-o', obj] + >- extra_postargs) >+ if self.detect_language(src) == 'c++': >+ self.spawn(compiler_so_cxx + cc_args + [src, '-o', obj] + >+ extra_postargs) >+ else: >+ self.spawn(compiler_so + cc_args + [src, '-o', obj] + >+ extra_postargs) > except DistutilsExecError, msg: > raise CompileError, msg > >@@ -191,23 +201,16 @@ > ld_args.extend(extra_postargs) > self.mkpath(os.path.dirname(output_filename)) > try: >- if target_desc == CCompiler.EXECUTABLE: >- linker = self.linker_exe[:] >+ if target_lang == "c++": >+ if target_desc == CCompiler.EXECUTABLE: >+ linker = self.linker_exe_cxx[:] >+ else: >+ linker = self.linker_so_cxx[:] > else: >- linker = self.linker_so[:] >- if target_lang == "c++" and self.compiler_cxx: >- # skip over environment variable settings if /usr/bin/env >- # is used to set up the linker's environment. >- # This is needed on OSX. Note: this assumes that the >- # normal and C++ compiler have the same environment >- # settings. >- i = 0 >- if os.path.basename(linker[0]) == "env": >- i = 1 >- while '=' in linker[i]: >- i = i + 1 >- >- linker[i] = self.compiler_cxx[i] >+ if target_desc == CCompiler.EXECUTABLE: >+ linker = self.linker_exe[:] >+ else: >+ linker = self.linker_so[:] > > if sys.platform == 'darwin': > linker = _osx_support.compiler_fixup(linker, ld_args) >diff -Naur pypy2-v5.6.0-src/lib-python/2.7/_osx_support.py pypy2-v5.6.0-src-patched/lib-python/2.7/_osx_support.py >--- pypy2-v5.6.0-src/lib-python/2.7/_osx_support.py 2016-11-08 09:52:16.000000000 +0100 >+++ pypy2-v5.6.0-src-patched/lib-python/2.7/_osx_support.py 2016-12-08 16:59:26.213690338 +0100 >@@ -14,13 +14,13 @@ > # configuration variables that may contain universal build flags, > # like "-arch" or "-isdkroot", that may need customization for > # the user environment >-_UNIVERSAL_CONFIG_VARS = ('CFLAGS', 'LDFLAGS', 'CPPFLAGS', 'BASECFLAGS', >- 'BLDSHARED', 'LDSHARED', 'CC', 'CXX', >- 'PY_CFLAGS', 'PY_LDFLAGS', 'PY_CPPFLAGS', >- 'PY_CORE_CFLAGS') >+_UNIVERSAL_CONFIG_VARS = ('CFLAGS', 'CXXFLAGS', 'LDFLAGS', 'CPPFLAGS', >+ 'BASECFLAGS', 'BLDSHARED', 'LDSHARED', 'LDCXXSHARED', >+ 'CC', 'CXX', 'PY_CFLAGS', 'PY_LDFLAGS', >+ 'PY_CPPFLAGS', 'PY_CORE_CFLAGS') > > # configuration variables that may contain compiler calls >-_COMPILER_CONFIG_VARS = ('BLDSHARED', 'LDSHARED', 'CC', 'CXX') >+_COMPILER_CONFIG_VARS = ('BLDSHARED', 'LDSHARED', 'LDCXXSHARED', 'CC', 'CXX') > > # prefix added to original configuration variable names > _INITPRE = '_OSX_SUPPORT_INITIAL_'
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 599918
:
455544
| 455546