summaryrefslogtreecommitdiff
path: root/src/lxc/meson.build
blob: d399556abdef45d4fbb0fc1efd86657f1fe0be0c (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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
lxc_driver_sources = [
  'lxc_cgroup.c',
  'lxc_conf.c',
  'lxc_container.c',
  'lxc_domain.c',
  'lxc_driver.c',
  'lxc_fuse.c',
  'lxc_hostdev.c',
  'lxc_monitor.c',
  'lxc_native.c',
  'lxc_process.c',
]

lxc_monitor_protocol = files('lxc_monitor_protocol.x')

rpc_probe_files += lxc_monitor_protocol

lxc_monitor_protocol_generated = []

lxc_monitor_protocol_generated += custom_target(
  'lxc_monitor_protocol_h',
  input: lxc_monitor_protocol,
  output: 'lxc_monitor_protocol.h',
  command: [ genprotocol_prog, rpcgen_prog, '-h', '@INPUT@', '@OUTPUT@' ]
)

lxc_monitor_protocol_generated += custom_target(
  'lxc_monitor_protocol_c',
  input: lxc_monitor_protocol,
  output: 'lxc_monitor_protocol.c',
  command: [ genprotocol_prog, rpcgen_prog, '-c', '@INPUT@', '@OUTPUT@' ]
)

lxc_monitor_generated = custom_target(
  'lxc_monitor_dispatch_h',
  input: lxc_monitor_protocol,
  output: 'lxc_monitor_dispatch.h',
  command: [
    gendispatch_prog, '--mode=client',
    'virLXCMonitor', 'VIR_LXC_MONITOR', '@INPUT@'
  ],
  capture: true,
)

driver_source_files += [
  files(lxc_driver_sources),
  lxc_monitor_protocol_generated,
  lxc_monitor_generated,
]

stateful_driver_source_files += [
  files(lxc_driver_sources),
  lxc_monitor_protocol_generated,
  lxc_monitor_generated,
]

lxc_controller_sources = files(
  'lxc_conf.c',
  'lxc_container.c',
  'lxc_cgroup.c',
  'lxc_domain.c',
  'lxc_fuse.c',
  'lxc_controller.c',
)

lxc_controller_generated = custom_target(
  'lxc_controller_dispatch_h',
  input: lxc_monitor_protocol,
  output: 'lxc_controller_dispatch.h',
  command: [
    gendispatch_prog, '--mode=server',
    'virLXCMonitor', 'VIR_LXC_MONITOR', '@INPUT@'
  ],
  capture: true,
)

if conf.has('WITH_LXC')
  lxc_driver_impl_lib = static_library(
    'virt_driver_lxc_impl',
    [
      lxc_driver_sources,
      lxc_monitor_protocol_generated,
      lxc_monitor_generated,
    ],
    dependencies: [
      access_dep,
      blkid_dep,
      capng_dep,
      fuse_dep,
      libnl_dep,
      secdriver_dep,
      src_dep,
      rpc_dep,
      xdr_dep,
    ],
    include_directories: [
      conf_inc_dir,
      hypervisor_inc_dir,
    ],
  )

  check_protocols += {
    'name': 'lxc_monitor_protocol',
    'lib': lxc_driver_impl_lib,
  }

  virt_modules += {
    'name': 'virt_driver_lxc',
    'link_whole': [
      lxc_driver_impl_lib,
    ],
    'link_args': [
      libvirt_no_undefined,
    ],
  }

  virt_daemons += {
    'name': 'virtlxcd',
    'c_args': [
      '-DDAEMON_NAME="virtlxcd"',
      '-DMODULE_NAME="lxc"',
    ],
  }

  virt_helpers += {
    'name': 'libvirt_lxc',
    'sources': [
      lxc_controller_sources,
      lxc_monitor_protocol_generated,
      lxc_controller_generated,
      datatypes_sources,
      dtrace_gen_objects,
    ],
    'include': [
      conf_inc_dir,
      hypervisor_inc_dir,
      include_directories('.'),
    ],
    'deps': [
      blkid_dep,
      capng_dep,
      fuse_dep,
      libnl_dep,
      rpc_dep,
      secdriver_dep,
      xdr_dep,
    ],
  }

  virt_conf_files += files('lxc.conf')
  virt_aug_files += files('libvirtd_lxc.aug')
  virt_test_aug_files += {
    'name': 'test_libvirtd_lxc.aug',
    'aug': files('test_libvirtd_lxc.aug.in'),
    'conf': files('lxc.conf'),
    'test_name': 'libvirtd_lxc',
    'test_srcdir': meson.current_source_dir(),
    'test_builddir': meson.current_build_dir(),
  }

  virt_daemon_confs += {
    'name': 'virtlxcd',
  }

  virt_daemon_units += {
    'service': 'virtlxcd',
    'service_in': files('virtlxcd.service.in'),
    'name': 'Libvirt lxc',
    'sockprefix': 'virtlxcd',
    'sockets': [ 'main', 'ro', 'admin' ],
  }

  openrc_init_files += {
    'name': 'virtlxcd',
    'in_file': files('virtlxcd.init.in'),
  }

  virt_install_dirs += [
    localstatedir / 'lib' / 'libvirt' / 'lxc',
    localstatedir / 'log' / 'libvirt' / 'lxc',
    runstatedir / 'libvirt' / 'lxc',
  ]
endif