shithub: aubio

Download patch

ref: 87740479650d07ab4b571fae6d6fd805d6efa259
parent: f2f9d8b27aabea41aaacd6492e234f4ff1830bfe
author: Paul Brossier <piem@piem.org>
date: Tue Oct 3 11:27:37 EDT 2017

src/wscript_build: on windows, use 'link /dump /symbols' to generate list of symbols

--- a/src/wscript_build
+++ b/src/wscript_build
@@ -51,20 +51,21 @@
     def run(self):
         syms = {}
         reg = getattr(self.generator, 'export_symbols_regex','.+?')
-        binary_path = self.generator.link_task.outputs[0].abspath()
         if 'msvc' in self.env.CC_NAME:
-            reg_compiled = re.compile(r'External\s+\|\s+_(?P<symbol>%s)\b' % reg)
-            cmd =(self.env.DUMPBIN or['dumpbin'])+['/symbols', binary_path]
+            outputs = [x.abspath() for x in self.generator.link_task.outputs]
+            binary_path = list(filter(lambda x: x.endswith('lib'), outputs))[0]
+            reg_compiled = re.compile(r'External\s+\|\s+(?P<symbol>%s)\b' % reg)
+            cmd =(self.env.LINK_CC) + ['/dump', '/symbols', binary_path]
         else: # using gcc? assume we have nm
+            binary_path = self.generator.link_task.outputs[0].abspath()
             reg_compiled = re.compile(r'(T|D)\s+_(?P<symbol>%s)\b'%reg)
             cmd = (self.env.NM or ['nm']) + ['-g', binary_path]
-        print (cmd)
         dump_output = self.generator.bld.cmd_and_log(cmd, quiet=STDOUT)
-        print (dump_output)
-        syms = []
+        syms = set([])
         for m in reg_compiled.finditer(dump_output):
-            syms += [m.group('symbol')]
-            print (m.group('symbol'))
+            syms.add(m.group('symbol'))
+        syms = list(syms)
+        syms.sort()
         self.outputs[0].write('EXPORTS\n'+'\n'.join(syms))
 
 @TaskGen.feature('gensyms')
@@ -81,7 +82,7 @@
     ctx(features = 'c ' + target,
             use = uselib + ['lib_objects'],
             target = 'aubio',
-            export_symbols_regex=r'(?:.*aubio|fvec|lvec|cvec|fmat)_.*',
+            export_symbols_regex=r'(?:.*aubio|fvec|lvec|cvec|fmat|new|del)_.*',
             vnum = ctx.env['LIB_VERSION'])
 
 # install headers, except _priv.h ones