mirror of
https://github.com/mpv-player/mpv
synced 2025-01-24 00:23:27 +00:00
build: syms: add support for Mach-O binaries
Current code stolen from waf's extras, only supported 'pe' and 'elf'. OS X uses the 'Mach-O' binary format (which waf calls 'mac-o'... go figure). Add support for generating the global symbols file with nm and using it from clang.
This commit is contained in:
parent
f6ed246826
commit
08170c6a67
@ -35,7 +35,7 @@ class gen_sym(Task):
|
||||
kw['env'] = env
|
||||
|
||||
else:
|
||||
if self.env.DEST_BINFMT == 'pe': #gcc uses nm, and has a preceding _ on windows
|
||||
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')
|
||||
@ -56,6 +56,8 @@ class compile_sym(Task):
|
||||
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')
|
||||
|
||||
@ -76,6 +78,8 @@ def do_the_symbol_stuff(self):
|
||||
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')
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user