blob: ab9d2d91d83811814d793baa74fac86b299c64c8 [file] [log] [blame]
Ratan Guptaca039ca2022-01-09 12:22:27 +05301project('phosphor-user-manager',
2 'cpp',
3 version: '0.1', meson_version: '>=0.57.0',
4 default_options: [
5 'warning_level=3',
6 'werror=true',
7 'cpp_std=c++20',
8 'buildtype=debugoptimized',
9 ]
10)
11
12conf_data = configuration_data()
13
14conf_data.set_quoted('USER_MANAGER_BUSNAME', 'xyz.openbmc_project.User.Manager',
15 description : 'The DBus busname to own.')
16
Ratan Guptaca039ca2022-01-09 12:22:27 +053017conf_data.set_quoted('DEFAULT_CRYPT_ALGO', '1',
18 description : 'The default crypt algorithm if one not found in shadow.')
19
20conf_data.set('CLASS_VERSION', 1,
21 description : 'Class version to register with Cereal.')
22
23conf_data.set_quoted('LDAP_CONFIG_FILE', '/etc/nslcd.conf',
24 description : 'Path of LDAP configuration file.')
25
26conf_data.set_quoted('TLS_CACERT_PATH', '/etc/ssl/certs/authority',
27 description : 'Path of LDAP server CA certificate.')
28
29conf_data.set_quoted('TLS_CERT_FILE', '/etc/nslcd/certs/cert.pem',
30 description : 'Path of LDAP client certificate.')
31
32conf_data.set_quoted('LDAP_CONFIG_ROOT', '/xyz/openbmc_project/user/ldap',
33 description : 'LDAP configuration root.')
34
35conf_data.set_quoted('LDAP_CONFIG_DBUS_OBJ_PATH', '/xyz/openbmc_project/user/ldap/config',
36 description : 'D-Bus path of LDAP config object.')
37
38conf_data.set_quoted('LDAP_CONFIG_BUSNAME', 'xyz.openbmc_project.Ldap.Config',
39 description : 'D-Bus busname of LDAP config service.')
40
41conf_data.set_quoted('LDAP_CONF_PERSIST_PATH', '/var/lib/phosphor-ldap-conf',
42 description : 'path of directory having persisted LDAP configuration enabled property.')
43
44conf_data.set_quoted('SYSTEMD_BUSNAME', 'org.freedesktop.systemd1',
45 description : 'systemd busname.')
46
47conf_data.set_quoted('SYSTEMD_PATH', '/org/freedesktop/systemd1',
Jiaqing Zhaof76fb882022-07-05 21:41:08 +080048 description : 'systemd path')
Ratan Guptaca039ca2022-01-09 12:22:27 +053049
50conf_data.set_quoted('SYSTEMD_INTERFACE', 'org.freedesktop.systemd1.Manager',
51 description : 'systemd interface.')
52
53conf_header = configure_file(output: 'config.h',
54 configuration: conf_data)
55
Patrick Williamscf53a942022-03-21 11:10:43 -050056phosphor_dbus_interfaces_dep = dependency('phosphor-dbus-interfaces')
57sdbusplus_dep = dependency('sdbusplus')
58phosphor_logging_dep = dependency('phosphor-logging')
Ratan Guptaca039ca2022-01-09 12:22:27 +053059systemd_dep = dependency('systemd')
60
61cpp = meson.get_compiler('cpp')
62
Patrick Williamscf53a942022-03-21 11:10:43 -050063# Get Cereal dependency.
64cereal_dep = dependency('cereal', required: false)
65has_cereal = cpp.has_header_symbol(
66 'cereal/cereal.hpp',
67 'cereal::specialize',
68 dependencies: cereal_dep,
69 required: false)
70if not has_cereal
71 cereal_opts = import('cmake').subproject_options()
72 cereal_opts.add_cmake_defines({'BUILD_TESTS': 'OFF'})
73 cereal_proj = import('cmake').subproject(
74 'cereal',
75 options: cereal_opts,
76 required: false)
77 assert(cereal_proj.found(), 'cereal is required')
78 cereal_dep = cereal_proj.dependency('cereal')
79endif
80
Ratan Guptaca039ca2022-01-09 12:22:27 +053081user_manager_src = [
82 'mainapp.cpp',
83 'user_mgr.cpp',
84 'users.cpp'
85]
86
87user_manager_deps = [
88 sdbusplus_dep,
89 phosphor_logging_dep,
90 phosphor_dbus_interfaces_dep
91]
92
93user_manager_lib = static_library(
94 'phosphor-user-manager',
95 [
96 'user_mgr.cpp',
97 'users.cpp',
98 ],
99 dependencies: user_manager_deps,
100)
101
102user_manager_dep = declare_dependency(
103 link_with: user_manager_lib,
104 dependencies: user_manager_deps
105)
106
107executable(
108 'phosphor-user-manager',
109 'mainapp.cpp',
110 dependencies: user_manager_dep,
111 link_args: ['-lcrypt', '-lstdc++fs'],
112 cpp_args: ['-DBOOST_ALL_NO_LIB', '-DBOOST_SYSTEM_NO_DEPRECATED', '-DBOOST_ERROR_CODE_HEADER_ONLY'],
113 install: true,
114)
115
116
117systemd_system_unit_dir = systemd_dep.get_variable(
118 pkgconfig: 'systemdsystemunitdir'
119)
120
121busconfig_dir = get_option('datadir') / 'dbus-1' / 'system.d'
122
123cert_manager_dir = get_option('datadir') / 'phosphor-certificate-manager'
124
125certs = []
126
127busconfig = []
128
129systemd_alias = []
130
131certs += 'nslcd'
132
133busconfig += 'phosphor-nslcd-cert-config.conf'
134
135systemd_alias += [[
136 '../phosphor-certificate-manager@.service',
137 'multi-user.target.wants/phosphor-certificate-manager@nslcd.service'
138]]
139
140
141install_data(
142 busconfig,
143 install_dir: busconfig_dir,
144)
145
146install_data(
147 certs,
148 install_dir: cert_manager_dir,
149)
150
151foreach service: systemd_alias
152 # Meson 0.61 will support this:
153 #install_symlink(
154 # service,
155 # install_dir: systemd_system_unit_dir,
156 # pointing_to: link,
157 # )
158 meson.add_install_script(
159 'sh', '-c',
160 'mkdir -p $(dirname $DESTDIR/@0@/@1@)'.format(systemd_system_unit_dir,
161 service[1]),
162 )
163 meson.add_install_script(
164 'sh', '-c',
165 'ln -s @0@ $DESTDIR/@1@/@2@'.format(service[0], systemd_system_unit_dir,
166 service[1]),
167 )
168endforeach
169
Ratan Guptaca039ca2022-01-09 12:22:27 +0530170subdir('phosphor-ldap-config')
171
172if get_option('tests').enabled()
173 subdir('test')
174endif