put CFLAGS into CC to prevent issue during ./configure. ref #301
This commit is contained in:
parent
97a5e399bf
commit
b73c520923
1 changed files with 20 additions and 5 deletions
25
toolchain.py
25
toolchain.py
|
@ -146,11 +146,24 @@ class Arch(object):
|
||||||
env = {}
|
env = {}
|
||||||
ccache = sh.which('ccache')
|
ccache = sh.which('ccache')
|
||||||
cc = sh.xcrun("-find", "-sdk", self.sdk, "clang").strip()
|
cc = sh.xcrun("-find", "-sdk", self.sdk, "clang").strip()
|
||||||
|
cxx = sh.xcrun("-find", "-sdk", self.sdk, "clang++").strip()
|
||||||
|
|
||||||
|
# we put the flags in CC / CXX as sometimes the ./configure test
|
||||||
|
# with the preprocessor (aka CC -E) without CFLAGS, which fails for
|
||||||
|
# cross compiled projects
|
||||||
|
flags = " ".join([
|
||||||
|
"--sysroot", self.sysroot,
|
||||||
|
"-arch", self.arch,
|
||||||
|
"-pipe", "-no-cpp-precomp",
|
||||||
|
])
|
||||||
|
cc += " " + flags
|
||||||
|
cxx += " " + flags
|
||||||
if ccache:
|
if ccache:
|
||||||
ccache = ccache.strip()
|
ccache = ccache.strip()
|
||||||
use_ccache = environ.get("USE_CCACHE", "1")
|
use_ccache = environ.get("USE_CCACHE", "1")
|
||||||
if use_ccache != '1':
|
if use_ccache != '1':
|
||||||
env["CC"] = cc
|
env["CC"] = cc
|
||||||
|
env["CXX"] = cxx
|
||||||
else:
|
else:
|
||||||
if not self._ccsh:
|
if not self._ccsh:
|
||||||
self._ccsh = ccsh = sh.mktemp().strip()
|
self._ccsh = ccsh = sh.mktemp().strip()
|
||||||
|
@ -158,11 +171,17 @@ class Arch(object):
|
||||||
f.write('#!/bin/sh\n')
|
f.write('#!/bin/sh\n')
|
||||||
f.write(ccache + ' ' + cc + ' "$@"\n')
|
f.write(ccache + ' ' + cc + ' "$@"\n')
|
||||||
sh.chmod('+x', ccsh)
|
sh.chmod('+x', ccsh)
|
||||||
|
self._cxxsh = cxxsh = sh.mktemp().strip()
|
||||||
|
with open(cxxsh, 'w') as f:
|
||||||
|
f.write('#!/bin/sh\n')
|
||||||
|
f.write(ccache + ' ' + cxx + ' "$@"\n')
|
||||||
|
sh.chmod('+x', cxxsh)
|
||||||
else:
|
else:
|
||||||
ccsh = self._ccsh
|
ccsh = self._ccsh
|
||||||
env["USE_CCACHE"] = '1'
|
env["USE_CCACHE"] = '1'
|
||||||
env["CCACHE"] = ccache
|
env["CCACHE"] = ccache
|
||||||
env["CC"] = ccsh
|
env["CC"] = ccsh
|
||||||
|
env["CXX"] = cxxsh
|
||||||
|
|
||||||
env.update({k: v for k, v in environ.items() if k.startswith('CCACHE_')})
|
env.update({k: v for k, v in environ.items() if k.startswith('CCACHE_')})
|
||||||
env.setdefault('CCACHE_MAXSIZE', '10G')
|
env.setdefault('CCACHE_MAXSIZE', '10G')
|
||||||
|
@ -171,6 +190,7 @@ class Arch(object):
|
||||||
'include_file_mtime,include_file_ctime,file_stat_matches'))
|
'include_file_mtime,include_file_ctime,file_stat_matches'))
|
||||||
else:
|
else:
|
||||||
env["CC"] = cc
|
env["CC"] = cc
|
||||||
|
env["CXX"] = cxx
|
||||||
env["AR"] = sh.xcrun("-find", "-sdk", self.sdk, "ar").strip()
|
env["AR"] = sh.xcrun("-find", "-sdk", self.sdk, "ar").strip()
|
||||||
env["LD"] = sh.xcrun("-find", "-sdk", self.sdk, "ld").strip()
|
env["LD"] = sh.xcrun("-find", "-sdk", self.sdk, "ld").strip()
|
||||||
env["OTHER_CFLAGS"] = " ".join(include_dirs)
|
env["OTHER_CFLAGS"] = " ".join(include_dirs)
|
||||||
|
@ -178,11 +198,6 @@ class Arch(object):
|
||||||
"-L{}/{}".format(self.ctx.dist_dir, "lib"),
|
"-L{}/{}".format(self.ctx.dist_dir, "lib"),
|
||||||
])
|
])
|
||||||
env["CFLAGS"] = " ".join([
|
env["CFLAGS"] = " ".join([
|
||||||
"-arch", self.arch,
|
|
||||||
"-pipe", "-no-cpp-precomp",
|
|
||||||
"--sysroot", self.sysroot,
|
|
||||||
#"-I{}/common".format(self.ctx.include_dir),
|
|
||||||
#"-I{}/{}".format(self.ctx.include_dir, self.arch),
|
|
||||||
"-O3",
|
"-O3",
|
||||||
self.version_min
|
self.version_min
|
||||||
] + include_dirs)
|
] + include_dirs)
|
||||||
|
|
Loading…
Reference in a new issue