diff options
Diffstat (limited to 'tools/meson.build')
-rw-r--r-- | tools/meson.build | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/tools/meson.build b/tools/meson.build new file mode 100644 index 0000000..fd1547e --- /dev/null +++ b/tools/meson.build @@ -0,0 +1,36 @@ +if get_option('crashhandler').enabled() or get_option('updater').enabled() + go = find_program('go', required: true) + go_args = [ '-buildmode=pie' ] +endif + +if get_option('crashhandler').enabled() + +# normally, you'd use configure_file to create this file, but that would only place it in build, +# and go will refuse to build from files in two different directories +meson.add_postconf_script(meson.source_root()/'scripts/gen-crashhandler-default-go.py', + '--kconfig=' + meson.source_root()/'Kconfig', + '--dotconfig=' + meson.source_root()/host_machine.system()/'.config', + '--input=' + meson.current_source_dir()/'src/crashhandler/defaults.go.in', + '--output=' + meson.current_source_dir()/'src/crashhandler/defaults.go' +) + +custom_target('poi-crash', + input: [ files('src/updater/main.go'), meson.current_source_dir()/'src/crashhandler/defaults.go' ], + output: 'poi-crash', + command: ['env', 'GOPATH='+meson.current_source_dir(), go, 'build', go_args, '-o=@OUTPUT@', 'crashhandler'], + build_by_default: true, + install: true, + install_dir: get_option('bindir'), +) +endif + +if get_option('updater').enabled() +custom_target('poi-update', + input: files('src/updater/main.go'), + output: 'poi-update', + command: ['env', 'GOPATH='+meson.current_source_dir(), go, 'build', go_args, '-o=@OUTPUT@', 'updater'], + build_by_default: true, + install: true, + install_dir: get_option('bindir'), +) +endif |