aboutsummaryrefslogtreecommitdiff
path: root/tools/meson.build
diff options
context:
space:
mode:
authorAqua-sama <aqua@iserlohn-fortress.net>2020-01-03 18:04:08 +0200
committerAqua-sama <aqua@iserlohn-fortress.net>2020-01-03 20:24:29 +0200
commit23a7f3baa33265519840609dc54e950615ec39b1 (patch)
treeff2737f76b63a2acf5f8a9fffd5c15e3eb4c46c8 /tools/meson.build
parentWebProfile refactoring (diff)
downloadsmolbote-23a7f3baa33265519840609dc54e950615ec39b1.tar.xz
Merge some QoL improvements from staging branch
- Build executable in top-level buildroot - Use meson sourceset - Pull in poi-crash and poi-update from staging - Remove extraneous scripts in tools/ - Pull in configure scripts in scripts/
Diffstat (limited to 'tools/meson.build')
-rw-r--r--tools/meson.build36
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