diff options
15 files changed, 65 insertions, 17 deletions
diff --git a/native_client_sdk/src/build_tools/generate_make.py b/native_client_sdk/src/build_tools/generate_make.py index f694ac9..d44d2a5 100644 --- a/native_client_sdk/src/build_tools/generate_make.py +++ b/native_client_sdk/src/build_tools/generate_make.py @@ -182,6 +182,35 @@ def FindAndCopyFiles(src_files, root, search_dirs, dst_dir): buildbot_common.CopyFile(src_file, dst_file) +def ModifyDescInPlace(desc): + """Perform post-load processing on .dsc file data. + + Currently this consists of: + - Add -Wall to CXXFLAGS + - Synthesize SEL_LDR_LIBS and SEL_LDR_DEPS by stripping + down LIBS and DEPS (removing certain ppapi-only libs). + """ + + ppapi_only_libs = ['ppapi_simple'] + + for target in desc['TARGETS']: + target.setdefault('CXXFLAGS', []) + target['CXXFLAGS'].insert(0, '-Wall') + + def filter_out(key): + value = target.get(key, []) + if type(value) == dict: + value = dict(value) + for key in value.keys(): + value[key] = [v for v in value[key] if v not in ppapi_only_libs] + else: + value = [v for v in value if v not in ppapi_only_libs] + return value + + target['SEL_LDR_LIBS'] = filter_out('LIBS') + target['SEL_LDR_DEPS'] = filter_out('DEPS') + + def ProcessProject(pepperdir, srcroot, dstroot, desc, toolchains, configs=None, first_toolchain=False): if not configs: @@ -222,9 +251,8 @@ def ProcessProject(pepperdir, srcroot, dstroot, desc, toolchains, configs=None, tools = [tool for tool in toolchains if tool in desc['TOOLS']] if first_toolchain: tools = [tools[0]] - for target in desc['TARGETS']: - target.setdefault('CXXFLAGS', []) - target['CXXFLAGS'].insert(0, '-Wall') + + ModifyDescInPlace(desc) template_dict = { 'desc': desc, @@ -232,6 +260,7 @@ def ProcessProject(pepperdir, srcroot, dstroot, desc, toolchains, configs=None, 'pre': desc.get('PRE', ''), 'post': desc.get('POST', ''), 'tools': tools, + 'sel_ldr': desc.get('SEL_LDR'), 'targets': desc['TARGETS'], } RunTemplateFileIfChanged(template, make_path, template_dict) diff --git a/native_client_sdk/src/build_tools/parse_dsc.py b/native_client_sdk/src/build_tools/parse_dsc.py index bf18d57..42ef1dd 100755 --- a/native_client_sdk/src/build_tools/parse_dsc.py +++ b/native_client_sdk/src/build_tools/parse_dsc.py @@ -148,7 +148,10 @@ def ValidateFormat(src, dsc_format): def LoadProject(filename): with open(filename, 'r') as descfile: - desc = eval(descfile.read(), {}, {}) + try: + desc = eval(descfile.read(), {}, {}) + except Exception as e: + raise ValidationError(e) if desc.get('DISABLE', False): return None ValidateFormat(desc, DSC_FORMAT) diff --git a/native_client_sdk/src/build_tools/test_sdk.py b/native_client_sdk/src/build_tools/test_sdk.py index 21bd968..61e6373 100755 --- a/native_client_sdk/src/build_tools/test_sdk.py +++ b/native_client_sdk/src/build_tools/test_sdk.py @@ -124,7 +124,8 @@ def main(args): parser = optparse.OptionParser(description=__doc__, usage=usage) parser.add_option('--experimental', help='build experimental tests', action='store_true') - parser.add_option('--verbose', help='Verbose output', action='store_true') + parser.add_option('--verbose', '-v', help='Verbose output', + action='store_true') if 'NACL_SDK_ROOT' in os.environ: # We don't want the currently configured NACL_SDK_ROOT to have any effect diff --git a/native_client_sdk/src/examples/demo/flock/example.dsc b/native_client_sdk/src/examples/demo/flock/example.dsc index 50fdeeb..e32cb06 100644 --- a/native_client_sdk/src/examples/demo/flock/example.dsc +++ b/native_client_sdk/src/examples/demo/flock/example.dsc @@ -13,7 +13,7 @@ 'vector2.h' ], 'DEPS': ['ppapi_simple', 'nacl_io'], - 'LIBS': ['ppapi_cpp', 'ppapi', 'pthread'] + 'LIBS': ['ppapi_simple', 'nacl_io', 'ppapi_cpp', 'ppapi', 'pthread'] } ], 'DATA': [ diff --git a/native_client_sdk/src/examples/demo/life/example.dsc b/native_client_sdk/src/examples/demo/life/example.dsc index 215cfa8..660df66 100644 --- a/native_client_sdk/src/examples/demo/life/example.dsc +++ b/native_client_sdk/src/examples/demo/life/example.dsc @@ -8,7 +8,7 @@ 'life.c', ], 'DEPS': ['ppapi_simple', 'nacl_io'], - 'LIBS': ['ppapi_cpp', 'ppapi', 'pthread'] + 'LIBS': ['ppapi_simple', 'nacl_io', 'ppapi_cpp', 'ppapi', 'pthread'] } ], 'DEST': 'examples/demo', diff --git a/native_client_sdk/src/examples/demo/nacl_io/example.dsc b/native_client_sdk/src/examples/demo/nacl_io/example.dsc index 65bb304..1c85cc2 100644 --- a/native_client_sdk/src/examples/demo/nacl_io/example.dsc +++ b/native_client_sdk/src/examples/demo/nacl_io/example.dsc @@ -13,7 +13,7 @@ 'queue.h', ], 'DEPS': ['nacl_io'], - 'LIBS': ['ppapi', 'pthread'] + 'LIBS': ['nacl_io', 'ppapi', 'pthread'] } ], 'DATA': [ diff --git a/native_client_sdk/src/examples/demo/pi_generator/example.dsc b/native_client_sdk/src/examples/demo/pi_generator/example.dsc index 09a53d5..5dcbe7c 100644 --- a/native_client_sdk/src/examples/demo/pi_generator/example.dsc +++ b/native_client_sdk/src/examples/demo/pi_generator/example.dsc @@ -6,7 +6,7 @@ 'TYPE' : 'main', 'SOURCES' : ['pi_generator.cc'], 'DEPS': ['ppapi_simple', 'nacl_io', 'ppapi_cpp'], - 'LIBS': ['ppapi', 'pthread'] + 'LIBS': ['ppapi_simple', 'nacl_io', 'ppapi_cpp', 'ppapi', 'pthread'] } ], 'DATA': [ diff --git a/native_client_sdk/src/examples/tutorial/debugging/example.dsc b/native_client_sdk/src/examples/tutorial/debugging/example.dsc index f7e20ead..480234f 100644 --- a/native_client_sdk/src/examples/tutorial/debugging/example.dsc +++ b/native_client_sdk/src/examples/tutorial/debugging/example.dsc @@ -10,7 +10,7 @@ ], 'CFLAGS': ['-fno-omit-frame-pointer'], 'DEPS' : ['error_handling'], - 'LIBS' : ['ppapi', 'pthread'] + 'LIBS' : ['error_handling', 'ppapi', 'pthread'] } ], 'DATA': [ diff --git a/native_client_sdk/src/examples/tutorial/dlopen/example.dsc b/native_client_sdk/src/examples/tutorial/dlopen/example.dsc index 8a1f104..47d6c89 100644 --- a/native_client_sdk/src/examples/tutorial/dlopen/example.dsc +++ b/native_client_sdk/src/examples/tutorial/dlopen/example.dsc @@ -6,7 +6,7 @@ 'TYPE': 'main', 'SOURCES': ['dlopen.cc'], 'DEPS': ['nacl_io', 'ppapi_cpp'], - 'LIBS': ['dl', 'ppapi', 'pthread'] + 'LIBS': ['nacl_io', 'ppapi_cpp', 'ppapi', 'dl', 'pthread'] }, { 'NAME' : 'eightball', diff --git a/native_client_sdk/src/examples/tutorial/using_ppapi_simple/example.dsc b/native_client_sdk/src/examples/tutorial/using_ppapi_simple/example.dsc index 9acec7c..17b1c94 100644 --- a/native_client_sdk/src/examples/tutorial/using_ppapi_simple/example.dsc +++ b/native_client_sdk/src/examples/tutorial/using_ppapi_simple/example.dsc @@ -7,7 +7,7 @@ 'TYPE' : 'main', 'SOURCES' : ['hello_world.c'], 'DEPS': ['ppapi_simple', 'nacl_io', 'ppapi_cpp'], - 'LIBS': ['ppapi', 'pthread'] + 'LIBS': ['ppapi_simple', 'nacl_io', 'ppapi_cpp', 'ppapi', 'pthread'] } ], 'DATA': [ diff --git a/native_client_sdk/src/examples/tutorial/using_ppapi_simple/hello_world.c b/native_client_sdk/src/examples/tutorial/using_ppapi_simple/hello_world.c index 9c98d6c..10322d0 100644 --- a/native_client_sdk/src/examples/tutorial/using_ppapi_simple/hello_world.c +++ b/native_client_sdk/src/examples/tutorial/using_ppapi_simple/hello_world.c @@ -24,5 +24,10 @@ int example_main(int argc, char* argv[]) { /* * Register the function to call once the Instance Object is initialized. * see: pappi_simple/ps_main.h + * + * This is not needed when building the sel_ldr version of this example + * which does not link against ppapi_simple. */ +#ifndef SEL_LDR PPAPI_SIMPLE_REGISTER_MAIN(example_main) +#endif diff --git a/native_client_sdk/src/resources/Makefile.example.template b/native_client_sdk/src/resources/Makefile.example.template index b313eca..940c714 100644 --- a/native_client_sdk/src/resources/Makefile.example.template +++ b/native_client_sdk/src/resources/Makefile.example.template @@ -41,8 +41,18 @@ CHROME_ARGS += --allow-nacl-socket-api=localhost [[]] TARGET = {{targets[0]['NAME']}} -[[ExpandDict('DEPS', targets[0].get('DEPS', []))]] -[[ExpandDict('LIBS', targets[0].get('LIBS', []), pre_list=['$(DEPS)'])]] +[[if sel_ldr and targets[0].get('SEL_LDR_LIBS'):]] +ifdef SEL_LDR +[[ ExpandDict('DEPS', targets[0].get('SEL_LDR_DEPS', []))]] +[[ ExpandDict('LIBS', targets[0].get('SEL_LDR_LIBS', []))]] +else +[[ ExpandDict('DEPS', targets[0].get('DEPS', []))]] +[[ ExpandDict('LIBS', targets[0].get('LIBS', []))]] +endif +[[else:]] +[[ ExpandDict('DEPS', targets[0].get('DEPS', []))]] +[[ ExpandDict('LIBS', targets[0].get('LIBS', []))]] +[[]] [[for target in targets:]] [[ source_list = (s for s in sorted(target['SOURCES']) if not s.endswith('.h'))]] diff --git a/native_client_sdk/src/tests/nacl_io_socket_test/example.dsc b/native_client_sdk/src/tests/nacl_io_socket_test/example.dsc index ec87c98..98f58f5 100644 --- a/native_client_sdk/src/tests/nacl_io_socket_test/example.dsc +++ b/native_client_sdk/src/tests/nacl_io_socket_test/example.dsc @@ -13,7 +13,7 @@ 'DEPS': ['ppapi_simple', 'nacl_io'], # Order matters here: gtest has a "main" function that will be used if # referenced before ppapi. - 'LIBS': ['gmock', 'ppapi_cpp', 'ppapi', 'gtest', 'pthread'], + 'LIBS': ['ppapi_simple', 'gmock', 'nacl_io', 'ppapi_cpp', 'ppapi', 'gtest', 'pthread'], 'CXXFLAGS': ['-Wno-sign-compare'] } ], diff --git a/native_client_sdk/src/tests/nacl_io_test/example.dsc b/native_client_sdk/src/tests/nacl_io_test/example.dsc index afa3a8b..7b2db96 100644 --- a/native_client_sdk/src/tests/nacl_io_test/example.dsc +++ b/native_client_sdk/src/tests/nacl_io_test/example.dsc @@ -61,7 +61,7 @@ 'DEPS': ['ppapi_simple', 'nacl_io'], # Order matters here: gtest has a "main" function that will be used if # referenced before ppapi. - 'LIBS': ['gmock', 'ppapi_cpp', 'ppapi', 'gtest', 'pthread'], + 'LIBS': ['ppapi_simple', 'gmock', 'nacl_io', 'ppapi_cpp', 'ppapi', 'gtest', 'pthread'], 'INCLUDES': ["."], 'CXXFLAGS': ['-Wno-sign-compare'], } diff --git a/native_client_sdk/src/tests/sdk_util_test/example.dsc b/native_client_sdk/src/tests/sdk_util_test/example.dsc index 937820b..1481069 100644 --- a/native_client_sdk/src/tests/sdk_util_test/example.dsc +++ b/native_client_sdk/src/tests/sdk_util_test/example.dsc @@ -13,7 +13,7 @@ 'DEPS': ['ppapi_simple', 'sdk_util', 'nacl_io'], # Order matters here: gtest has a "main" function that will be used if # referenced before ppapi. - 'LIBS': ['gmock', 'ppapi_cpp', 'ppapi', 'gtest', 'pthread'], + 'LIBS': ['ppapi_simple', 'sdk_util', 'nacl_io', 'gmock', 'ppapi_cpp', 'ppapi', 'gtest', 'pthread'], 'CXXFLAGS': ['-Wno-sign-compare'] } ], |