| Index: meson.build | 
| =================================================================== | 
| new file mode 100644 | 
| --- /dev/null | 
| +++ b/meson.build | 
| @@ -0,0 +1,97 @@ | 
| +project('adblockpluscore', license: ['GPL3']) | 
| 
 
Wladimir Palant
2017/10/11 10:00:47
Meson 0.39.1 (what you currently get on Ubuntu) co
 
hub
2017/10/11 18:23:16
Done.
 
 | 
| + | 
| +emcc = find_program('emcc') | 
| +nodejs = find_program('node') | 
| 
 
Wladimir Palant
2017/10/11 10:00:47
I tried reading Emscripten configuration and the f
 
hub
2017/10/11 18:23:17
Done.
 
 | 
| + | 
| +JS_LIBRARY = files('compiled/library.js') | 
| +BINDINGS_GENERATOR = 'bindings.cpp.js' | 
| +BINDINGS_OUTPUT = 'bindings.js' | 
| +COMPILER_OUTPUT = 'compiled.js' | 
| +# params for emcc compilation | 
| +ADDITIONAL_PARAMS = ['-O3', '-m32', '-std=c++1z', '--memory-init-file', '0', | 
| + '--emit-symbol-map', '-Wall', '-Werror', '-fno-exceptions', | 
| + '-fno-rtti', '--js-library', JS_LIBRARY] | 
| +DEFINES = [] | 
| +GENERATION_PARAMS = [ | 
| + ['SHELL_FILE', '"' + meson.source_root() + '/compiled/shell.js"'], | 
| + ['ASM_JS', '2'], # "almost asm" | 
| + ['TOTAL_MEMORY', 16*1024*1024], | 
| + ['TOTAL_STACK', 1*1024*1024], | 
| + ['ALLOW_MEMORY_GROWTH', 1], | 
| + ['NO_EXIT_RUNTIME', 1], | 
| + ['NO_DYNAMIC_EXECUTION', 1], | 
| + ['NO_FILESYSTEM', 1], | 
| + ['INVOKE_RUN', 0], | 
| + ['TEXTDECODER', 0], | 
| + ['EXPORTED_RUNTIME_METHODS', '["cwrap", "ccall", "stringToAscii"]'] | 
| +] | 
| + | 
| +bindings_sources = files( | 
| + 'compiled/bindings/generator.cpp', | 
| + 'compiled/bindings/main.cpp', | 
| +) | 
| +sources = files( | 
| + 'compiled/bindings/runtime_utils.cpp', | 
| + 'compiled/filter/ActiveFilter.cpp', | 
| + 'compiled/filter/BlockingFilter.cpp', | 
| + 'compiled/filter/CommentFilter.cpp', | 
| + 'compiled/filter/ElemHideBase.cpp', | 
| + 'compiled/filter/ElemHideEmulationFilter.cpp', | 
| + 'compiled/filter/ElemHideException.cpp', | 
| + 'compiled/filter/ElemHideFilter.cpp', | 
| + 'compiled/filter/Filter.cpp', | 
| + 'compiled/filter/InvalidFilter.cpp', | 
| + 'compiled/filter/RegExpFilter.cpp', | 
| + 'compiled/filter/WhitelistFilter.cpp', | 
| + 'compiled/storage/FilterStorage.cpp', | 
| + 'compiled/subscription/DownloadableSubscription.cpp', | 
| + 'compiled/subscription/Subscription.cpp', | 
| + 'compiled/subscription/UserDefinedSubscription.cpp', | 
| + 'compiled/traceInit.cpp' | 
| +) | 
| + | 
| +bindings_generator = custom_target('bindings-generator', | 
| + input: bindings_sources + sources, | 
| + output: BINDINGS_GENERATOR, | 
| + command: [emcc, '-o', '@OUTPUT@', | 
| + '-std=c++1z', '--js-library', JS_LIBRARY, | 
| + '--js-library', | 
| + files('compiled/bindings/library.js'), | 
| + '@INPUT@']) | 
| +bindings_output = custom_target('bindings-output', | 
| + input: bindings_generator, | 
| + output: BINDINGS_OUTPUT, | 
| + capture: true, | 
| + command: [nodejs, '@INPUT@']) | 
| + | 
| + | 
| +defines_args = [] | 
| +foreach define : DEFINES | 
| + defines_args += '-D' + define | 
| +endforeach | 
| + | 
| +generation_args = [] | 
| +foreach param : GENERATION_PARAMS | 
| + generation_args += '-s' | 
| + generation_args += param[0] + '=' + '@0@'.format(param[1]) | 
| 
 
Wladimir Palant
2017/10/11 10:00:47
Nit: You should really unify leading whitespace in
 
hub
2017/10/11 18:23:16
Done.
 
 | 
| +endforeach | 
| + | 
| +optional_args = [] | 
| +debug = get_option('buildtype') | 
| +if debug.startswith('debug') | 
| + optional_args += '-g3' | 
| +endif | 
| +tracing = get_option('tracing') | 
| +if tracing | 
| + optional_args += '--tracing' | 
| +endif | 
| + | 
| +output_file = meson.source_root() + '/lib/' + COMPILER_OUTPUT | 
| +compiler_output = custom_target('compiled.js', | 
| + build_by_default: true, | 
| + input: sources, | 
| + output: COMPILER_OUTPUT, | 
| 
 
Wladimir Palant
2017/10/11 10:00:47
I'd consider that a temporary hack. It's probably
 
hub
2017/10/11 18:23:17
Acknowledged.
 
 | 
| + command: [emcc, '-o', output_file, '-std=c++1z', | 
| 
 
Wladimir Palant
2017/10/11 10:00:47
-std=c++1z parameter is unnecessary here, it is al
 
hub
2017/10/11 18:23:16
Done.
 
 | 
| + '--post-js', bindings_output, '@INPUT@'] + | 
| + defines_args + generation_args + optional_args + | 
| + ADDITIONAL_PARAMS) | 
| 
 
Wladimir Palant
2017/10/11 10:00:47
Object files should really be generated as separat
 
hub
2017/10/11 18:23:16
I wanted to use the c++ targets, but meson doesn't
 
Wladimir Palant
2017/10/11 21:01:23
That's too bad. It would have been much nicer if w
 
 |