shithub: aubio

Download patch

ref: 4b084a93667f14f82582714fa5185349f1f03a6e
parent: dad51ced4a3c4ed6910883e3ab90e834a2667995
author: Martin Hermant <martin.hermant@gmail.com>
date: Tue May 30 07:22:26 EDT 2017

wscript : emscripten
	add NO_FILESYSTEM flag for lib export
	add fmat and cvec functions to exported

fix indent error on enable_atlas

--- a/wscript
+++ b/wscript
@@ -237,22 +237,27 @@
         else:
             ctx.env.LINKFLAGS += ['-Oz']
             ctx.env.cshlib_PATTERN = '%s.min.js'
-        
-         # import exposed function names
-        from python.lib.gen_external import get_c_declarations,get_cpp_objects_from_c_declarations,get_all_func_names_from_lib,generate_lib_from_c_declarations
-        c_decls = get_c_declarations(usedouble=False) #emscripten can't use double
-        objects = get_cpp_objects_from_c_declarations(c_decls)
-        objects+=['fvec_t']
-        lib =  generate_lib_from_c_declarations(objects,c_decls)
-        exported_funcnames = get_all_func_names_from_lib(lib)
-        c_mangled_names = ['_'+s for s in exported_funcnames]
-        ctx.env.LINKFLAGS_cshlib += ['-s','EXPORTED_FUNCTIONS=%s'%c_mangled_names]
-        # put memory file inside generated js files
-        ctx.env.LINKFLAGS+=['--memory-init-file','0']
+
+        # lib doesnt ship file system support
+        ctx.env.LINKFLAGS_cshlib += ['-s', 'NO_FILESYSTEM=1']
+        # put memory file inside generated js files for easier portability
+        ctx.env.LINKFLAGS += ['--memory-init-file', '0']
         ctx.env.cprogram_PATTERN = "%s.js"
         ctx.env.cstlib_PATTERN = '%s.a'
-        if (ctx.options.enable_atlas != True):
-            ctx.options.enable_atlas = False
+
+        # get exposed functions
+        from python.lib.gen_external import get_c_declarations, get_cpp_objects_from_c_declarations, get_all_func_names_from_lib, generate_lib_from_c_declarations
+        c_decls = get_c_declarations(usedouble=False)  # emscripten can't use double
+        objects = get_cpp_objects_from_c_declarations(c_decls)
+        # ensure that aubio structs are exported
+        objects += ['fvec_t', 'cvec_t', 'fmat_t']
+        lib = generate_lib_from_c_declarations(objects, c_decls)
+        exported_funcnames = get_all_func_names_from_lib(lib)
+        c_mangled_names = ['_' + s for s in exported_funcnames]
+        ctx.env.LINKFLAGS_cshlib += ['-s', 'EXPORTED_FUNCTIONS=%s' % c_mangled_names]
+
+    if (ctx.options.enable_atlas != True):
+        ctx.options.enable_atlas = False
 
     # check support for C99 __VA_ARGS__ macros
     check_c99_varargs = '''