meson.build (1208B)
1 # The paywall page is assembled from a jinja2 template at build time. 2 # Asking for the module here turns a missing jinja2 into an actionable 3 # 'meson setup' error instead of a Python traceback in the middle of a 4 # build. 5 python = import('python').find_installation( 6 'python3', 7 modules: ['jinja2'], 8 ) 9 10 paywall_must = custom_target( 11 'paywall.en.must', 12 input: 'paywall.en.must.j2', 13 output: 'paywall.en.must', 14 command: [ 15 python, 16 # files(), not a bare path: passing the generator as a plain 17 # string leaves meson unaware of it, so editing the generator 18 # does not regenerate the template. 19 files('generate-paywall.py'), 20 '@INPUT@', 21 '@OUTPUT@', 22 ], 23 depend_files: files('paywall.js'), 24 install: true, 25 install_dir: get_option('datadir') / 'paivana' / 'templates', 26 ) 27 28 # paywall.js is plain JavaScript, but it is type-checked with tsc in 29 # checkJs mode. The script reports 'skipped' when no local TypeScript 30 # compiler is installed; it deliberately never fetches one, since a 31 # build must not depend on the network. 32 test( 33 'paywall_typecheck', 34 files('typecheck.sh'), 35 env: {'SRCDIR': meson.current_source_dir()}, 36 )