summaryrefslogtreecommitdiffstats
path: root/waftools
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-04-13 18:00:51 +0200
committerwm4 <wm4@nowhere>2014-04-13 18:03:01 +0200
commit78128bddda4bcea1f256fc13cc33fa2652ed277c (patch)
tree35bf6596cb8e2d7927618845833c3ee36534f890 /waftools
parent44f382cf98564c0fe08bdc78579c284362cd6f3c (diff)
downloadmpv-78128bddda4bcea1f256fc13cc33fa2652ed277c.tar.bz2
mpv-78128bddda4bcea1f256fc13cc33fa2652ed277c.tar.xz
Kill all tabs
I hate tabs. This replaces all tabs in all source files with spaces. The only exception is old-makefile. The replacement was made by running the GNU coreutils "expand" command on every file. Since the replacement was automatic, it's possible that some formatting was destroyed (but perhaps only if it was assuming that the end of a tab does not correspond to aligning the end to multiples of 8 spaces).
Diffstat (limited to 'waftools')
-rw-r--r--waftools/syms.py106
1 files changed, 53 insertions, 53 deletions
diff --git a/waftools/syms.py b/waftools/syms.py
index 9b55de0759..4bef9a36f3 100644
--- a/waftools/syms.py
+++ b/waftools/syms.py
@@ -8,7 +8,7 @@ by default, all symbols are exported by gcc, and nothing by msvc.
to use the tool, do something like:
def build(ctx):
- ctx(features='c cshlib syms', source='a.c b.c', export_symbols_regex='mylib_.*', target='testlib')
+ ctx(features='c cshlib syms', source='a.c b.c', export_symbols_regex='mylib_.*', target='testlib')
only the symbols starting with 'mylib_' will be exported.
"""
@@ -21,65 +21,65 @@ from waflib.Errors import WafError
from waflib.TaskGen import feature, after_method
class gen_sym(Task):
- def run(self):
- obj = self.inputs[0]
- kw = {}
- if 'msvc' in (self.env.CC_NAME, self.env.CXX_NAME):
- re_nm = re.compile(r'External\s+\|\s+_(' + self.generator.export_symbols_regex + r')\b')
- cmd = [self.env.DUMPBIN or 'dumpbin', '/symbols', obj.abspath()]
+ def run(self):
+ obj = self.inputs[0]
+ kw = {}
+ if 'msvc' in (self.env.CC_NAME, self.env.CXX_NAME):
+ re_nm = re.compile(r'External\s+\|\s+_(' + self.generator.export_symbols_regex + r')\b')
+ cmd = [self.env.DUMPBIN or 'dumpbin', '/symbols', obj.abspath()]
- # Dumpbin requires custom environment sniffed out by msvc.py earlier
- if self.env['PATH']:
- env = dict(self.env.env or os.environ)
- env.update(PATH = os.pathsep.join(self.env['PATH']))
- kw['env'] = env
+ # Dumpbin requires custom environment sniffed out by msvc.py earlier
+ if self.env['PATH']:
+ env = dict(self.env.env or os.environ)
+ env.update(PATH = os.pathsep.join(self.env['PATH']))
+ kw['env'] = env
- else:
- if self.env.DEST_BINFMT in ('pe', 'mac-o'): #gcc uses nm, and has a preceding _ on windows and osx
- re_nm = re.compile(r'T\s+_(' + self.generator.export_symbols_regex + r')\b')
- else:
- re_nm = re.compile(r'T\s+(' + self.generator.export_symbols_regex + r')\b')
- cmd = [self.env.NM or 'nm', '-g', obj.abspath()]
- syms = re_nm.findall(self.generator.bld.cmd_and_log(cmd, quiet=STDOUT, **kw))
- self.outputs[0].write('%r' % syms)
+ else:
+ if self.env.DEST_BINFMT in ('pe', 'mac-o'): #gcc uses nm, and has a preceding _ on windows and osx
+ re_nm = re.compile(r'T\s+_(' + self.generator.export_symbols_regex + r')\b')
+ else:
+ re_nm = re.compile(r'T\s+(' + self.generator.export_symbols_regex + r')\b')
+ cmd = [self.env.NM or 'nm', '-g', obj.abspath()]
+ syms = re_nm.findall(self.generator.bld.cmd_and_log(cmd, quiet=STDOUT, **kw))
+ self.outputs[0].write('%r' % syms)
class compile_sym(Task):
- def run(self):
- syms = {}
- for x in self.inputs:
- slist = eval(x.read())
- for s in slist:
- syms[s] = 1
- lsyms = list(syms.keys())
- lsyms.sort()
- if self.env.DEST_BINFMT == 'pe':
- self.outputs[0].write('EXPORTS\n' + '\n'.join(lsyms))
- elif self.env.DEST_BINFMT == 'elf':
- self.outputs[0].write('{ global:\n' + ';\n'.join(lsyms) + ";\nlocal: *; };\n")
- elif self.env.DEST_BINFMT == 'mac-o':
- self.outputs[0].write('\n'.join("_"+sym for sym in lsyms))
- else:
- raise WafError('NotImplemented')
+ def run(self):
+ syms = {}
+ for x in self.inputs:
+ slist = eval(x.read())
+ for s in slist:
+ syms[s] = 1
+ lsyms = list(syms.keys())
+ lsyms.sort()
+ if self.env.DEST_BINFMT == 'pe':
+ self.outputs[0].write('EXPORTS\n' + '\n'.join(lsyms))
+ elif self.env.DEST_BINFMT == 'elf':
+ self.outputs[0].write('{ global:\n' + ';\n'.join(lsyms) + ";\nlocal: *; };\n")
+ elif self.env.DEST_BINFMT == 'mac-o':
+ self.outputs[0].write('\n'.join("_"+sym for sym in lsyms))
+ else:
+ raise WafError('NotImplemented')
@feature('syms')
@after_method('process_source', 'process_use', 'apply_link', 'process_uselib_local')
def do_the_symbol_stuff(self):
- ins = [x.outputs[0] for x in self.compiled_tasks]
- self.gen_sym_tasks = [self.create_task('gen_sym', x, x.change_ext('.%d.sym' % self.idx)) for x in ins]
+ ins = [x.outputs[0] for x in self.compiled_tasks]
+ self.gen_sym_tasks = [self.create_task('gen_sym', x, x.change_ext('.%d.sym' % self.idx)) for x in ins]
- tsk = self.create_task('compile_sym',
- [x.outputs[0] for x in self.gen_sym_tasks],
- self.path.find_or_declare(getattr(self, 'sym_filename', self.target + '.def')))
- self.link_task.set_run_after(tsk)
- self.link_task.dep_nodes.append(tsk.outputs[0])
- if 'msvc' in (self.env.CC_NAME, self.env.CXX_NAME):
- self.link_task.env.append_value('LINKFLAGS', ['/def:' + tsk.outputs[0].bldpath()])
- elif self.env.DEST_BINFMT == 'pe': #gcc on windows takes *.def as an additional input
- self.link_task.inputs.append(tsk.outputs[0])
- elif self.env.DEST_BINFMT == 'elf':
- self.link_task.env.append_value('LINKFLAGS', ['-Wl,-version-script', '-Wl,' + tsk.outputs[0].bldpath()])
- elif self.env.DEST_BINFMT == 'mac-o':
- self.link_task.env.append_value('LINKFLAGS', ['-exported_symbols_list', tsk.outputs[0].bldpath()])
- else:
- raise WafError('NotImplemented')
+ tsk = self.create_task('compile_sym',
+ [x.outputs[0] for x in self.gen_sym_tasks],
+ self.path.find_or_declare(getattr(self, 'sym_filename', self.target + '.def')))
+ self.link_task.set_run_after(tsk)
+ self.link_task.dep_nodes.append(tsk.outputs[0])
+ if 'msvc' in (self.env.CC_NAME, self.env.CXX_NAME):
+ self.link_task.env.append_value('LINKFLAGS', ['/def:' + tsk.outputs[0].bldpath()])
+ elif self.env.DEST_BINFMT == 'pe': #gcc on windows takes *.def as an additional input
+ self.link_task.inputs.append(tsk.outputs[0])
+ elif self.env.DEST_BINFMT == 'elf':
+ self.link_task.env.append_value('LINKFLAGS', ['-Wl,-version-script', '-Wl,' + tsk.outputs[0].bldpath()])
+ elif self.env.DEST_BINFMT == 'mac-o':
+ self.link_task.env.append_value('LINKFLAGS', ['-exported_symbols_list', tsk.outputs[0].bldpath()])
+ else:
+ raise WafError('NotImplemented')