summaryrefslogtreecommitdiff
path: root/src/polkitbackend/meson.build
blob: 93c3c34574efbedb62cb8f3cc63f6acdfef5563f (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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
name = '@0@-backend-@1@'.format(meson.project_name(), pk_api_version)

sources = files(
  'polkitbackendactionlookup.c',
  'polkitbackendactionpool.c',
  'polkitbackendauthority.c',
  'polkitbackendinteractiveauthority.c',
  'polkitbackendjsauthority.cpp',
)

output = 'initjs.h'

sources += custom_target(
  output,
  input: 'init.js',
  output: output,
  capture: true,
  command: [find_program('perl'), meson.current_source_dir() / 'toarray.pl', '@INPUT@', 'init_js'],
)

deps = [
  expat_dep,
  libpolkit_gobject_dep,
  mozjs_dep,
]

c_flags = [
  '-D_POLKIT_COMPILATION',
  '-D_POLKIT_BACKEND_COMPILATION',
  '-DPACKAGE_DATA_DIR="@0@"'.format(pk_prefix / pk_datadir),
  '-DPACKAGE_SYSCONF_DIR="@0@"'.format(pk_prefix / pk_sysconfdir),
]

if enable_logind
  sources += files('polkitbackendsessionmonitor-systemd.c')

  deps += logind_dep
else
  sources += files('polkitbackendsessionmonitor.c')
endif

libpolkit_backend = static_library(
  name,
  sources: sources,
  include_directories: top_inc,
  dependencies: deps,
  c_args: c_flags,
  cpp_args: c_flags,
)

install_data(
  '50-default.rules',
  install_dir: pk_pkgsysconfdir / 'rules.d',
)

program = 'polkitd'

c_flags = [
  '-DG_LOG_DOMAIN="@0@-@1@"'.format(program, pk_api_version),
  '-DPOLKIT_BACKEND_I_KNOW_API_IS_SUBJECT_TO_CHANGE',
]

executable(
  program,
  program + '.c',
  include_directories: top_inc,
  dependencies: libpolkit_gobject_dep,
  c_args: c_flags,
  link_with: libpolkit_backend,
  install: true,
  install_dir: pk_pkglibdir,
)