summaryrefslogtreecommitdiff
path: root/giscanner
diff options
context:
space:
mode:
authorChristoph Reiter <reiter.christoph@gmail.com>2018-12-29 14:28:26 +0100
committerChristoph Reiter <reiter.christoph@gmail.com>2018-12-29 14:28:26 +0100
commitc14d0372283abc1b857e38517e791447233e4d62 (patch)
tree49898523b9ffd620aefe08737e280240133e1285 /giscanner
parent508ec4aadbee562eee69bd8d6db24d35f05352ea (diff)
downloadgobject-introspection-c14d0372283abc1b857e38517e791447233e4d62.tar.gz
ccompiler: don't use Python compiler flags. Fixes #150
Only use flags provided by env vars from the user and never from the Python sysconfig. The sysconfig values depend on the way Python was built, might conflict when using g-i with a different compiler and can't be controlled by the g-i user.
Diffstat (limited to 'giscanner')
-rw-r--r--giscanner/ccompiler.py14
1 files changed, 8 insertions, 6 deletions
diff --git a/giscanner/ccompiler.py b/giscanner/ccompiler.py
index d8b15bce..8ea99445 100644
--- a/giscanner/ccompiler.py
+++ b/giscanner/ccompiler.py
@@ -36,13 +36,13 @@ from . import utils
def customize_compiler(compiler):
"""This is a version of distutils.sysconfig.customize_compiler, without
- any macOS specific bits.
+ any macOS specific bits and which tries to avoid using any Python specific
+ defaults if alternatives through env vars are given.
"""
if compiler.compiler_type == "unix":
- (cc, cxx, opt, cflags, ccshared, ldshared, shlib_suffix, ar, ar_flags) = \
- get_config_vars('CC', 'CXX', 'OPT', 'CFLAGS',
- 'CCSHARED', 'LDSHARED', 'SHLIB_SUFFIX', 'AR', 'ARFLAGS')
+ (cc, cxx, ldshared, shlib_suffix, ar, ar_flags) = \
+ get_config_vars('CC', 'CXX', 'LDSHARED', 'SHLIB_SUFFIX', 'AR', 'ARFLAGS')
if 'CC' in os.environ:
cc = os.environ['CC']
@@ -57,8 +57,10 @@ def customize_compiler(compiler):
if 'LDFLAGS' in os.environ:
ldshared = ldshared + ' ' + os.environ['LDFLAGS']
if 'CFLAGS' in os.environ:
- cflags = opt + ' ' + os.environ['CFLAGS']
+ cflags = os.environ['CFLAGS']
ldshared = ldshared + ' ' + os.environ['CFLAGS']
+ else:
+ cflags = ''
if 'CPPFLAGS' in os.environ:
cpp = cpp + ' ' + os.environ['CPPFLAGS']
cflags = cflags + ' ' + os.environ['CPPFLAGS']
@@ -74,7 +76,7 @@ def customize_compiler(compiler):
compiler.set_executables(
preprocessor=cpp,
compiler=cc_cmd,
- compiler_so=cc_cmd + ' ' + ccshared,
+ compiler_so=cc_cmd,
compiler_cxx=cxx,
linker_so=ldshared,
linker_exe=cc,