LEFT | RIGHT |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 | 2 |
3 # This file is part of Adblock Plus <https://adblockplus.org/>, | 3 # This file is part of Adblock Plus <https://adblockplus.org/>, |
4 # Copyright (C) 2006-2017 Eyeo GmbH | 4 # Copyright (C) 2006-2017 Eyeo GmbH |
5 # | 5 # |
6 # Adblock Plus is free software: you can redistribute it and/or modify | 6 # Adblock Plus is free software: you can redistribute it and/or modify |
7 # it under the terms of the GNU General Public License version 3 as | 7 # it under the terms of the GNU General Public License version 3 as |
8 # published by the Free Software Foundation. | 8 # published by the Free Software Foundation. |
9 # | 9 # |
10 # Adblock Plus is distributed in the hope that it will be useful, | 10 # Adblock Plus is distributed in the hope that it will be useful, |
(...skipping 23 matching lines...) Expand all Loading... |
34 'TOTAL_STACK': 1*1024*1024, | 34 'TOTAL_STACK': 1*1024*1024, |
35 'ALLOW_MEMORY_GROWTH': 1, | 35 'ALLOW_MEMORY_GROWTH': 1, |
36 'NO_EXIT_RUNTIME': 1, | 36 'NO_EXIT_RUNTIME': 1, |
37 'NO_DYNAMIC_EXECUTION': 1, | 37 'NO_DYNAMIC_EXECUTION': 1, |
38 'NO_FILESYSTEM': 1, | 38 'NO_FILESYSTEM': 1, |
39 'INVOKE_RUN': 0, | 39 'INVOKE_RUN': 0, |
40 'TEXTDECODER': 0, | 40 'TEXTDECODER': 0, |
41 'EXPORTED_RUNTIME_METHODS': ['cwrap', 'ccall', 'stringToAscii'], | 41 'EXPORTED_RUNTIME_METHODS': ['cwrap', 'ccall', 'stringToAscii'], |
42 } | 42 } |
43 DEFINES = [] | 43 DEFINES = [] |
44 ADDITIONAL_PARAMS = ['-O3', '-m32', '-std=gnu++14', '--memory-init-file', '0', | 44 ADDITIONAL_PARAMS = ['-O3', '-m32', '-std=c++1z', '--memory-init-file', '0', |
45 '--emit-symbol-map', '-Wall', '-Werror', '-fno-exceptions', | 45 '--emit-symbol-map', '-Wall', '-Werror', '-fno-exceptions', |
46 '-fno-rtti', '--js-library', JS_LIBRARY] | 46 '-fno-rtti', '--js-library', JS_LIBRARY] |
47 | 47 |
48 | 48 |
49 def get_source_files(phase): | 49 def get_source_files(phase): |
50 for (path, dirs, files) in os.walk(SOURCE_DIR): | 50 for (path, dirs, files) in os.walk(SOURCE_DIR): |
51 for f in files: | 51 for f in files: |
52 if os.path.splitext(f)[1] != '.cpp': | 52 if os.path.splitext(f)[1] != '.cpp': |
53 continue | 53 continue |
54 if ( | 54 if ( |
(...skipping 13 matching lines...) Expand all Loading... |
68 'EMSCRIPTEN': scope['EMSCRIPTEN_ROOT'], | 68 'EMSCRIPTEN': scope['EMSCRIPTEN_ROOT'], |
69 'PYTHON': scope.get('PYTHON', sys.executable), | 69 'PYTHON': scope.get('PYTHON', sys.executable), |
70 'NODE_JS': scope.get('NODE_JS', 'node'), | 70 'NODE_JS': scope.get('NODE_JS', 'node'), |
71 }) | 71 }) |
72 return env | 72 return env |
73 | 73 |
74 | 74 |
75 def generate_bindings(env): | 75 def generate_bindings(env): |
76 params = [ | 76 params = [ |
77 env['PYTHON'], os.path.join(env['EMSCRIPTEN'], 'emcc'), | 77 env['PYTHON'], os.path.join(env['EMSCRIPTEN'], 'emcc'), |
78 '-o', BINDINGS_GENERATOR, '-std=gnu++14', '--js-library', JS_LIBRARY, | 78 '-o', BINDINGS_GENERATOR, '-std=c++1z', '--js-library', JS_LIBRARY, |
79 '--js-library', os.path.join(SOURCE_DIR, 'bindings', 'library.js'), | 79 '--js-library', os.path.join(SOURCE_DIR, 'bindings', 'library.js'), |
80 ] + list(get_source_files('bindings')) | 80 ] + list(get_source_files('bindings')) |
81 subprocess.check_call(params, env=env) | 81 subprocess.check_call(params, env=env) |
82 | 82 |
83 with open(BINDINGS_OUTPUT, 'w') as file: | 83 with open(BINDINGS_OUTPUT, 'w') as file: |
84 subprocess.check_call([env['NODE_JS'], BINDINGS_GENERATOR], | 84 subprocess.check_call([env['NODE_JS'], BINDINGS_GENERATOR], |
85 stdout=file) | 85 stdout=file) |
86 | 86 |
87 | 87 |
88 def run_compiler(env, debug=False, tracing=False): | 88 def run_compiler(env, debug=False, tracing=False): |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 parser.add_argument( | 123 parser.add_argument( |
124 '-t', '--tracing', | 124 '-t', '--tracing', |
125 action='store_true', | 125 action='store_true', |
126 help='Enable memory tracing' | 126 help='Enable memory tracing' |
127 ) | 127 ) |
128 args = parser.parse_args() | 128 args = parser.parse_args() |
129 | 129 |
130 env = getenv(args.emscripten_config) | 130 env = getenv(args.emscripten_config) |
131 generate_bindings(env) | 131 generate_bindings(env) |
132 run_compiler(env, debug=args.debug, tracing=args.tracing) | 132 run_compiler(env, debug=args.debug, tracing=args.tracing) |
LEFT | RIGHT |