blob: c48a93024509de085fc29fcefa5f572f4be45928 [file] [log] [blame]
Ratan Guptaca039ca2022-01-09 12:22:27 +05301project('phosphor-user-manager',
2 'cpp',
Patrick Williams9046e632023-08-23 06:30:59 -05003 version: '0.1', meson_version: '>=1.1.1',
Ratan Guptaca039ca2022-01-09 12:22:27 +05304 default_options: [
5 'warning_level=3',
6 'werror=true',
Patrick Williams9046e632023-08-23 06:30:59 -05007 'cpp_std=c++23',
Ratan Guptaca039ca2022-01-09 12:22:27 +05308 'buildtype=debugoptimized',
9 ]
10)
11
Patrick Williams90b84ad2023-11-29 06:44:34 -060012if get_option('root_user_mgmt').allowed()
Nan Zhou0076afe2022-08-29 17:52:10 +000013 add_project_arguments('-DENABLE_ROOT_USER_MGMT', language:'cpp')
14endif
15
Ratan Guptaca039ca2022-01-09 12:22:27 +053016conf_data = configuration_data()
17
18conf_data.set_quoted('USER_MANAGER_BUSNAME', 'xyz.openbmc_project.User.Manager',
19 description : 'The DBus busname to own.')
20
Ratan Guptaca039ca2022-01-09 12:22:27 +053021conf_data.set_quoted('DEFAULT_CRYPT_ALGO', '1',
22 description : 'The default crypt algorithm if one not found in shadow.')
23
24conf_data.set('CLASS_VERSION', 1,
25 description : 'Class version to register with Cereal.')
26
27conf_data.set_quoted('LDAP_CONFIG_FILE', '/etc/nslcd.conf',
28 description : 'Path of LDAP configuration file.')
29
30conf_data.set_quoted('TLS_CACERT_PATH', '/etc/ssl/certs/authority',
31 description : 'Path of LDAP server CA certificate.')
32
33conf_data.set_quoted('TLS_CERT_FILE', '/etc/nslcd/certs/cert.pem',
34 description : 'Path of LDAP client certificate.')
35
36conf_data.set_quoted('LDAP_CONFIG_ROOT', '/xyz/openbmc_project/user/ldap',
37 description : 'LDAP configuration root.')
38
39conf_data.set_quoted('LDAP_CONFIG_DBUS_OBJ_PATH', '/xyz/openbmc_project/user/ldap/config',
40 description : 'D-Bus path of LDAP config object.')
41
42conf_data.set_quoted('LDAP_CONFIG_BUSNAME', 'xyz.openbmc_project.Ldap.Config',
43 description : 'D-Bus busname of LDAP config service.')
44
45conf_data.set_quoted('LDAP_CONF_PERSIST_PATH', '/var/lib/phosphor-ldap-conf',
46 description : 'path of directory having persisted LDAP configuration enabled property.')
47
48conf_data.set_quoted('SYSTEMD_BUSNAME', 'org.freedesktop.systemd1',
49 description : 'systemd busname.')
50
51conf_data.set_quoted('SYSTEMD_PATH', '/org/freedesktop/systemd1',
Jiaqing Zhaof76fb882022-07-05 21:41:08 +080052 description : 'systemd path')
Ratan Guptaca039ca2022-01-09 12:22:27 +053053
54conf_data.set_quoted('SYSTEMD_INTERFACE', 'org.freedesktop.systemd1.Manager',
55 description : 'systemd interface.')
56
57conf_header = configure_file(output: 'config.h',
58 configuration: conf_data)
59
Patrick Williamscf53a942022-03-21 11:10:43 -050060phosphor_dbus_interfaces_dep = dependency('phosphor-dbus-interfaces')
61sdbusplus_dep = dependency('sdbusplus')
62phosphor_logging_dep = dependency('phosphor-logging')
Ratan Guptaca039ca2022-01-09 12:22:27 +053063systemd_dep = dependency('systemd')
64
65cpp = meson.get_compiler('cpp')
66
Konstantin Aladyshevc992c262024-04-02 16:54:35 +030067boost_dep = dependency('boost')
68
Patrick Williamscf53a942022-03-21 11:10:43 -050069# Get Cereal dependency.
70cereal_dep = dependency('cereal', required: false)
71has_cereal = cpp.has_header_symbol(
72 'cereal/cereal.hpp',
73 'cereal::specialize',
74 dependencies: cereal_dep,
75 required: false)
76if not has_cereal
77 cereal_opts = import('cmake').subproject_options()
Konstantin Aladyshev8ffe3752024-04-02 16:40:45 +030078 cereal_opts.add_cmake_defines({'BUILD_TESTS': 'OFF', 'SKIP_PERFORMANCE_COMPARISON': 'ON'})
Patrick Williamscf53a942022-03-21 11:10:43 -050079 cereal_proj = import('cmake').subproject(
80 'cereal',
81 options: cereal_opts,
82 required: false)
83 assert(cereal_proj.found(), 'cereal is required')
84 cereal_dep = cereal_proj.dependency('cereal')
85endif
86
Ratan Guptaca039ca2022-01-09 12:22:27 +053087user_manager_src = [
88 'mainapp.cpp',
89 'user_mgr.cpp',
90 'users.cpp'
91]
92
93user_manager_deps = [
Konstantin Aladyshevc992c262024-04-02 16:54:35 +030094 boost_dep,
Ratan Guptaca039ca2022-01-09 12:22:27 +053095 sdbusplus_dep,
96 phosphor_logging_dep,
97 phosphor_dbus_interfaces_dep
98]
99
100user_manager_lib = static_library(
101 'phosphor-user-manager',
102 [
103 'user_mgr.cpp',
104 'users.cpp',
105 ],
106 dependencies: user_manager_deps,
107)
108
109user_manager_dep = declare_dependency(
110 link_with: user_manager_lib,
111 dependencies: user_manager_deps
112)
113
114executable(
115 'phosphor-user-manager',
116 'mainapp.cpp',
117 dependencies: user_manager_dep,
Patrick Williamscf7aedd2023-06-01 06:59:02 -0500118 link_args: ['-lcrypt' ],
Ratan Guptaca039ca2022-01-09 12:22:27 +0530119 cpp_args: ['-DBOOST_ALL_NO_LIB', '-DBOOST_SYSTEM_NO_DEPRECATED', '-DBOOST_ERROR_CODE_HEADER_ONLY'],
120 install: true,
121)
122
123
124systemd_system_unit_dir = systemd_dep.get_variable(
Patrick Williams6ceeb4c2023-04-12 08:01:18 -0500125 'systemdsystemunitdir'
Ratan Guptaca039ca2022-01-09 12:22:27 +0530126)
127
Ratan Guptaca039ca2022-01-09 12:22:27 +0530128install_data(
Nan Zhou0076afe2022-08-29 17:52:10 +0000129 'phosphor-nslcd-cert-config.conf',
130 install_dir: get_option('datadir') / 'dbus-1' / 'system.d',
Ratan Guptaca039ca2022-01-09 12:22:27 +0530131)
132
133install_data(
Nan Zhou0076afe2022-08-29 17:52:10 +0000134 'nslcd',
135 install_dir: get_option('datadir') / 'phosphor-certificate-manager',
Ratan Guptaca039ca2022-01-09 12:22:27 +0530136)
137
Nan Zhou0076afe2022-08-29 17:52:10 +0000138# Figure out how to use install_symlink to install symlink to a file of another
139# recipe
140#install_symlink(
141# 'phosphor-certificate-manager@nslcd.service',
142# install_dir: systemd_system_unit_dir / 'multi-user.target.wants',
143# pointing_to: systemd_system_unit_dir / 'phosphor-certificate-manager@.service',
144# )
145meson.add_install_script(
146 'sh', '-c',
147 'mkdir -p $(dirname $DESTDIR/@0@/@1@)'.format(systemd_system_unit_dir,
148 'multi-user.target.wants/phosphor-certificate-manager@nslcd.service'),
149)
150meson.add_install_script(
151 'sh', '-c',
152 'ln -s @0@ $DESTDIR/@1@/@2@'.format('../phosphor-certificate-manager@.service',
153 systemd_system_unit_dir,
154 'multi-user.target.wants/phosphor-certificate-manager@nslcd.service'),
155)
Ratan Guptaca039ca2022-01-09 12:22:27 +0530156
Ratan Guptaca039ca2022-01-09 12:22:27 +0530157subdir('phosphor-ldap-config')
158
Patrick Williams90b84ad2023-11-29 06:44:34 -0600159if get_option('tests').allowed()
Ratan Guptaca039ca2022-01-09 12:22:27 +0530160 subdir('test')
161endif