summaryrefslogtreecommitdiff
path: root/src/polkitbackend/meson.build
blob: c35e6c2f10566011f006312dd7a56d1b315c0b21 (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
73
74
75
76
77
78
79
80
81
82
83
name = '@0@-backend-@1@'.format(meson.project_name(), pk_api_version)

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

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,
  js_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),
  '-D_XOPEN_SOURCE=700',
  '-D_GNU_SOURCE=1',
]

if js_engine == 'duktape'
  sources += files('polkitbackendduktapeauthority.c')
  deps += libm_dep
  deps += thread_dep
elif js_engine == 'mozjs'
  add_languages('cpp')
  sources += files('polkitbackendjsauthority.cpp')
endif

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_pkgdatadir / '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_libprivdir,
)