Author: arigo <[email protected]>
Branch:
Changeset: r65383:656d89fbb1de
Date: 2013-07-14 18:43 +0200
http://bitbucket.org/pypy/pypy/changeset/656d89fbb1de/
Log: Merged in squeaky/pypy-ldflags/distutils-cppldflags (pull request
#162)
ADD CPPFLAGS and LDFLAGS
diff --git a/lib-python/2.7/distutils/sysconfig_pypy.py
b/lib-python/2.7/distutils/sysconfig_pypy.py
--- a/lib-python/2.7/distutils/sysconfig_pypy.py
+++ b/lib-python/2.7/distutils/sysconfig_pypy.py
@@ -65,6 +65,11 @@
g['SOABI'] = g['SO'].rsplit('.')[0]
g['LIBDIR'] = os.path.join(sys.prefix, 'lib')
g['CC'] = "gcc -pthread" # -pthread might not be valid on OS/X, check
+ g['OPT'] = ""
+ g['CFLAGS'] = ""
+ g['CPPFLAGS'] = ""
+ g['CCSHARED'] = '-shared -O2 -fPIC -Wimplicit'
+ g['LDSHARED'] = g['CC'] + ' -shared'
global _config_vars
_config_vars = g
@@ -122,13 +127,34 @@
optional C speedup components.
"""
if compiler.compiler_type == "unix":
- compiler.compiler_so.extend(['-O2', '-fPIC', '-Wimplicit'])
+ cc, opt, cflags, ccshared, ldshared = get_config_vars(
+ 'CC', 'OPT', 'CFLAGS', 'CCSHARED', 'LDSHARED')
+
compiler.shared_lib_extension = get_config_var('SO')
- if "CFLAGS" in os.environ:
- cflags = os.environ["CFLAGS"].split()
- compiler.compiler.extend(cflags)
- compiler.compiler_so.extend(cflags)
- compiler.linker_so.extend(cflags)
+
+ if 'LDSHARED' in os.environ:
+ ldshared = os.environ['LDSHARED']
+ 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']
+ if 'CFLAGS' in os.environ:
+ cflags = opt + ' ' + os.environ['CFLAGS']
+ ldshared = ldshared + ' ' + os.environ['CFLAGS']
+ if 'CPPFLAGS' in os.environ:
+ cpp = cpp + ' ' + os.environ['CPPFLAGS']
+ cflags = cflags + ' ' + os.environ['CPPFLAGS']
+ ldshared = ldshared + ' ' + os.environ['CPPFLAGS']
+
+ cc_cmd = cc + ' ' + cflags
+
+ compiler.set_executables(
+ preprocessor=cpp,
+ compiler=cc_cmd,
+ compiler_so=cc_cmd + ' ' + ccshared,
+ linker_so=ldshared)
from sysconfig_cpython import (
diff --git a/pypy/doc/whatsnew-head.rst b/pypy/doc/whatsnew-head.rst
--- a/pypy/doc/whatsnew-head.rst
+++ b/pypy/doc/whatsnew-head.rst
@@ -20,3 +20,7 @@
.. branch: package-tk
Adapt package.py script to compile CFFI tk extension. Add a --without-tk switch
to optionally skip it.
+
+.. branch: distutils-cppldflags
+Copy CPython's implementation of customize_compiler, dont call split on
+environment variables, honour CFLAGS, CPPFLAGS, LDSHARED and LDFLAGS on Unices.
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit