mirror of https://gitlab.com/ita1024/waf.git
Winrc processing is almost certainly broken...
This commit is contained in:
parent
062a5263a0
commit
75b1423ce8
|
@ -289,7 +289,7 @@ class BuildContext(Context.Context):
|
||||||
dbfn = os.path.join(self.variant_dir, Context.DBFILE)
|
dbfn = os.path.join(self.variant_dir, Context.DBFILE)
|
||||||
try:
|
try:
|
||||||
data = Utils.readf(dbfn, 'rb')
|
data = Utils.readf(dbfn, 'rb')
|
||||||
except (IOError, EOFError):
|
except (EnvironmentError, EOFError):
|
||||||
# handle missing file/empty file
|
# handle missing file/empty file
|
||||||
Logs.debug('build: Could not load the build cache %s (missing)', dbfn)
|
Logs.debug('build: Could not load the build cache %s (missing)', dbfn)
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -700,7 +700,7 @@ class Task(TaskBase):
|
||||||
except Errors.TaskNotReady:
|
except Errors.TaskNotReady:
|
||||||
raise
|
raise
|
||||||
except EnvironmentError:
|
except EnvironmentError:
|
||||||
# when a file was renamed (IOError usually), remove the stale nodes (headers in folders without source files)
|
# when a file was renamed, remove the stale nodes (headers in folders without source files)
|
||||||
# this will break the order calculation for headers created during the build in the source directory (should be uncommon)
|
# this will break the order calculation for headers created during the build in the source directory (should be uncommon)
|
||||||
# the behaviour will differ when top != out
|
# the behaviour will differ when top != out
|
||||||
for x in bld.node_deps.get(self.uid(), []):
|
for x in bld.node_deps.get(self.uid(), []):
|
||||||
|
|
|
@ -28,7 +28,6 @@ A dumb preprocessor is also available in the tool *c_dumbpreproc*
|
||||||
|
|
||||||
import re, string, traceback
|
import re, string, traceback
|
||||||
from waflib import Logs, Utils, Errors
|
from waflib import Logs, Utils, Errors
|
||||||
from waflib.Logs import debug, error
|
|
||||||
|
|
||||||
class PreprocError(Errors.WafError):
|
class PreprocError(Errors.WafError):
|
||||||
pass
|
pass
|
||||||
|
@ -908,14 +907,14 @@ class c_parser(object):
|
||||||
raise PreprocError('recursion limit exceeded')
|
raise PreprocError('recursion limit exceeded')
|
||||||
|
|
||||||
if Logs.verbose:
|
if Logs.verbose:
|
||||||
debug('preproc: reading file %r', node)
|
Logs.debug('preproc: reading file %r', node)
|
||||||
try:
|
try:
|
||||||
lines = self.parse_lines(node)
|
lines = self.parse_lines(node)
|
||||||
except EnvironmentError:
|
except EnvironmentError:
|
||||||
raise PreprocError('could not read the file %r' % node)
|
raise PreprocError('could not read the file %r' % node)
|
||||||
except Exception:
|
except Exception:
|
||||||
if Logs.verbose > 0:
|
if Logs.verbose > 0:
|
||||||
error("parsing %r failed" % node)
|
Logs.error('parsing %r failed', node)
|
||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
else:
|
else:
|
||||||
self.lines.extend(lines)
|
self.lines.extend(lines)
|
||||||
|
@ -930,7 +929,7 @@ class c_parser(object):
|
||||||
:param env: config set containing additional defines to take into account
|
:param env: config set containing additional defines to take into account
|
||||||
:type env: :py:class:`waflib.ConfigSet.ConfigSet`
|
:type env: :py:class:`waflib.ConfigSet.ConfigSet`
|
||||||
"""
|
"""
|
||||||
debug('preproc: scanning %s (in %s)', node.name, node.parent.name)
|
Logs.debug('preproc: scanning %s (in %s)', node.name, node.parent.name)
|
||||||
|
|
||||||
self.current_file = node
|
self.current_file = node
|
||||||
self.addlines(node)
|
self.addlines(node)
|
||||||
|
@ -950,7 +949,7 @@ class c_parser(object):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
ve = Logs.verbose
|
ve = Logs.verbose
|
||||||
if ve: debug('preproc: line is %s - %s state is %s', token, line, self.state)
|
if ve: Logs.debug('preproc: line is %s - %s state is %s', token, line, self.state)
|
||||||
state = self.state
|
state = self.state
|
||||||
|
|
||||||
# make certain we define the state if we are about to enter in an if block
|
# make certain we define the state if we are about to enter in an if block
|
||||||
|
@ -978,7 +977,7 @@ class c_parser(object):
|
||||||
else: state[-1] = accepted
|
else: state[-1] = accepted
|
||||||
elif token == 'include' or token == 'import':
|
elif token == 'include' or token == 'import':
|
||||||
(kind, inc) = extract_include(line, self.defs)
|
(kind, inc) = extract_include(line, self.defs)
|
||||||
if ve: debug('preproc: include found %s (%s) ', inc, kind)
|
if ve: Logs.debug('preproc: include found %s (%s) ', inc, kind)
|
||||||
if kind == '"' or not strict_quotes:
|
if kind == '"' or not strict_quotes:
|
||||||
self.current_file = self.tryfind(inc)
|
self.current_file = self.tryfind(inc)
|
||||||
if token == 'import':
|
if token == 'import':
|
||||||
|
@ -1007,7 +1006,7 @@ class c_parser(object):
|
||||||
self.ban_includes.add(self.current_file)
|
self.ban_includes.add(self.current_file)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
if Logs.verbose:
|
if Logs.verbose:
|
||||||
debug('preproc: line parsing failed (%s): %s %s', e, line, Utils.ex_stack())
|
Logs.debug('preproc: line parsing failed (%s): %s %s', e, line, Utils.ex_stack())
|
||||||
|
|
||||||
def define_name(self, line):
|
def define_name(self, line):
|
||||||
"""
|
"""
|
||||||
|
@ -1042,6 +1041,6 @@ def scan(task):
|
||||||
tmp = c_parser(nodepaths)
|
tmp = c_parser(nodepaths)
|
||||||
tmp.start(task.inputs[0], task.env)
|
tmp.start(task.inputs[0], task.env)
|
||||||
if Logs.verbose:
|
if Logs.verbose:
|
||||||
debug('deps: deps for %r: %r; unresolved %r', task.inputs, tmp.nodes, tmp.names)
|
Logs.debug('deps: deps for %r: %r; unresolved %r', task.inputs, tmp.nodes, tmp.names)
|
||||||
return (tmp.nodes, tmp.names)
|
return (tmp.nodes, tmp.names)
|
||||||
|
|
||||||
|
|
|
@ -43,36 +43,6 @@ class rc_parser(c_preproc.c_parser):
|
||||||
ret.append(('include', m.group(5)))
|
ret.append(('include', m.group(5)))
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
def addlines(self, node):
|
|
||||||
self.currentnode_stack.append(node.parent)
|
|
||||||
filepath = node.abspath()
|
|
||||||
|
|
||||||
self.count_files += 1
|
|
||||||
if self.count_files > c_preproc.recursion_limit:
|
|
||||||
raise c_preproc.PreprocError("recursion limit exceeded")
|
|
||||||
pc = self.parse_cache
|
|
||||||
Logs.debug('preproc: reading file %r', filepath)
|
|
||||||
try:
|
|
||||||
lns = pc[filepath]
|
|
||||||
except KeyError:
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
self.lines.extend(lns)
|
|
||||||
return
|
|
||||||
|
|
||||||
try:
|
|
||||||
lines = self.filter_comments(filepath)
|
|
||||||
lines.append((c_preproc.POPFILE, ''))
|
|
||||||
lines.reverse()
|
|
||||||
pc[filepath] = lines
|
|
||||||
self.lines.extend(lines)
|
|
||||||
except IOError:
|
|
||||||
raise c_preproc.PreprocError("could not read the file %s" % filepath)
|
|
||||||
except Exception:
|
|
||||||
if Logs.verbose > 0:
|
|
||||||
Logs.error("parsing %s failed", filepath)
|
|
||||||
traceback.print_exc()
|
|
||||||
|
|
||||||
class winrc(Task.Task):
|
class winrc(Task.Task):
|
||||||
"""
|
"""
|
||||||
Task for compiling resource files
|
Task for compiling resource files
|
||||||
|
@ -83,32 +53,26 @@ class winrc(Task.Task):
|
||||||
def scan(self):
|
def scan(self):
|
||||||
tmp = rc_parser(self.generator.includes_nodes)
|
tmp = rc_parser(self.generator.includes_nodes)
|
||||||
tmp.start(self.inputs[0], self.env)
|
tmp.start(self.inputs[0], self.env)
|
||||||
nodes = tmp.nodes
|
|
||||||
names = tmp.names
|
|
||||||
|
|
||||||
if Logs.verbose:
|
if Logs.verbose:
|
||||||
Logs.debug('deps: deps for %s: %r; unresolved %r', str(self), nodes, names)
|
Logs.debug('deps: deps for %s: %r; unresolved %r', self.inputs, tmp.nodes, tmp.names)
|
||||||
|
return (tmp.nodes, tmp.names)
|
||||||
return (nodes, names)
|
|
||||||
|
|
||||||
def configure(conf):
|
def configure(conf):
|
||||||
"""
|
"""
|
||||||
Detect the programs RC or windres, depending on the C/C++ compiler in use
|
Detect the programs RC or windres, depending on the C/C++ compiler in use
|
||||||
"""
|
"""
|
||||||
v = conf.env
|
v = conf.env
|
||||||
v['WINRC_TGT_F'] = '-o'
|
v.WINRC_TGT_F = '-o'
|
||||||
v['WINRC_SRC_F'] = '-i'
|
v.WINRC_SRC_F = '-i'
|
||||||
|
|
||||||
# find rc.exe
|
# find rc.exe
|
||||||
if not conf.env.WINRC:
|
if not v.WINRC:
|
||||||
if v.CC_NAME == 'msvc':
|
if v.CC_NAME == 'msvc':
|
||||||
conf.find_program('RC', var='WINRC', path_list = v['PATH'])
|
conf.find_program('RC', var='WINRC', path_list=v.PATH)
|
||||||
v['WINRC_TGT_F'] = '/fo'
|
v.WINRC_TGT_F = '/fo'
|
||||||
v['WINRC_SRC_F'] = ''
|
v.WINRC_SRC_F = ''
|
||||||
else:
|
else:
|
||||||
conf.find_program('windres', var='WINRC', path_list = v['PATH'])
|
conf.find_program('windres', var='WINRC', path_list=v.PATH)
|
||||||
if not conf.env.WINRC:
|
if not v.WINRC:
|
||||||
conf.fatal('winrc was not found!')
|
conf.fatal('winrc was not found!')
|
||||||
|
|
||||||
v['WINRCFLAGS'] = []
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue