mirror of https://gitlab.com/ita1024/waf.git
Do not duplicate flags from the OS environment - https://github.com/waf-project/waf/issues/1574
This commit is contained in:
parent
be7c6103dc
commit
f048d6d20f
|
@ -4,6 +4,8 @@ NEW IN WAF 1.8.10
|
|||
* Fixed the hcode in why.py - https://github.com/waf-project/waf/issues/1561
|
||||
* Enabled execution from any folder: "waf configure --top=/arbitrary/folder --out=/tmp/build"
|
||||
* Enabled stateless out-of-tree builds by default: "waf configure --no-lock-in-top --no-lock-in-run"
|
||||
* Fixed the waf file generation on windows in Waf 1.8.9
|
||||
* Add OS flags such as LDFLAGS only once - https://github.com/waf-project/waf/issues/1574
|
||||
|
||||
NEW IN WAF 1.8.9
|
||||
----------------
|
||||
|
|
|
@ -352,7 +352,7 @@ def conf(f):
|
|||
return f
|
||||
|
||||
@conf
|
||||
def add_os_flags(self, var, dest=None):
|
||||
def add_os_flags(self, var, dest=None, dup=True):
|
||||
"""
|
||||
Import operating system environment values into ``conf.env`` dict::
|
||||
|
||||
|
@ -363,10 +363,16 @@ def add_os_flags(self, var, dest=None):
|
|||
:type var: string
|
||||
:param dest: destination variable, by default the same as var
|
||||
:type dest: string
|
||||
:param dup: add the same set of flags again
|
||||
:type dup: bool
|
||||
"""
|
||||
# do not use 'get' to make certain the variable is not defined
|
||||
try: self.env.append_value(dest or var, shlex.split(self.environ[var]))
|
||||
except KeyError: pass
|
||||
try:
|
||||
flags = shlex.split(self.environ[var])
|
||||
except KeyError:
|
||||
return
|
||||
# TODO: in waf 1.9, make dup=False the default
|
||||
if dup or ''.join(flags) not in ''.join(Utils.to_list(self.env[dest or var])):
|
||||
self.env.append_value(dest or var, flags)
|
||||
|
||||
@conf
|
||||
def cmd_to_list(self, cmd):
|
||||
|
|
|
@ -933,24 +933,24 @@ def cc_add_flags(conf):
|
|||
"""
|
||||
Add CFLAGS / CPPFLAGS from os.environ to conf.env
|
||||
"""
|
||||
conf.add_os_flags('CPPFLAGS', 'CFLAGS')
|
||||
conf.add_os_flags('CFLAGS')
|
||||
conf.add_os_flags('CPPFLAGS', dup=False)
|
||||
conf.add_os_flags('CFLAGS', dup=False)
|
||||
|
||||
@conf
|
||||
def cxx_add_flags(conf):
|
||||
"""
|
||||
Add CXXFLAGS / CPPFLAGS from os.environ to conf.env
|
||||
"""
|
||||
conf.add_os_flags('CPPFLAGS', 'CXXFLAGS')
|
||||
conf.add_os_flags('CXXFLAGS')
|
||||
conf.add_os_flags('CPPFLAGS', dup=False)
|
||||
conf.add_os_flags('CXXFLAGS', dup=False)
|
||||
|
||||
@conf
|
||||
def link_add_flags(conf):
|
||||
"""
|
||||
Add LINKFLAGS / LDFLAGS from os.environ to conf.env
|
||||
"""
|
||||
conf.add_os_flags('LINKFLAGS')
|
||||
conf.add_os_flags('LDFLAGS')
|
||||
conf.add_os_flags('LINKFLAGS', dup=False)
|
||||
conf.add_os_flags('LDFLAGS', dup=False)
|
||||
|
||||
@conf
|
||||
def cc_load_tools(conf):
|
||||
|
|
|
@ -51,9 +51,9 @@ def fc_add_flags(conf):
|
|||
"""
|
||||
Add FCFLAGS / LDFLAGS / LINKFLAGS from os.environ to conf.env
|
||||
"""
|
||||
conf.add_os_flags('FCFLAGS')
|
||||
conf.add_os_flags('LINKFLAGS')
|
||||
conf.add_os_flags('LDFLAGS')
|
||||
conf.add_os_flags('FCFLAGS', dup=False)
|
||||
conf.add_os_flags('LINKFLAGS', dup=False)
|
||||
conf.add_os_flags('LDFLAGS', dup=False)
|
||||
|
||||
@conf
|
||||
def check_fortran(self, *k, **kw):
|
||||
|
|
Loading…
Reference in New Issue