aboutsummaryrefslogtreecommitdiff
path: root/tools/meson.build
blob: fd1547eabfe1b8abe9999b2f00dba4fcda311319 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
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