1project( 2 'phosphor-user-manager', 3 'cpp', 4 version: '0.1', 5 meson_version: '>=1.1.1', 6 default_options: [ 7 'warning_level=3', 8 'werror=true', 9 'cpp_std=c++23', 10 'buildtype=debugoptimized', 11 ], 12) 13 14if get_option('root_user_mgmt').allowed() 15 add_project_arguments('-DENABLE_ROOT_USER_MGMT', language: 'cpp') 16endif 17 18conf_data = configuration_data() 19 20conf_data.set_quoted( 21 'USER_MANAGER_BUSNAME', 22 'xyz.openbmc_project.User.Manager', 23 description: 'The DBus busname to own.', 24) 25 26conf_data.set( 27 'CLASS_VERSION', 28 1, 29 description: 'Class version to register with Cereal.', 30) 31 32conf_data.set_quoted( 33 'LDAP_CONFIG_FILE', 34 '/etc/nslcd.conf', 35 description: 'Path of LDAP configuration file.', 36) 37 38conf_data.set_quoted( 39 'TLS_CACERT_PATH', 40 '/etc/ssl/certs/authority', 41 description: 'Path of LDAP server CA certificate.', 42) 43 44conf_data.set_quoted( 45 'TLS_CERT_FILE', 46 '/etc/nslcd/certs/cert.pem', 47 description: 'Path of LDAP client certificate.', 48) 49 50conf_data.set_quoted( 51 'LDAP_CONFIG_ROOT', 52 '/xyz/openbmc_project/user/ldap', 53 description: 'LDAP configuration root.', 54) 55 56conf_data.set_quoted( 57 'LDAP_CONFIG_DBUS_OBJ_PATH', 58 '/xyz/openbmc_project/user/ldap/config', 59 description: 'D-Bus path of LDAP config object.', 60) 61 62conf_data.set_quoted( 63 'LDAP_CONFIG_BUSNAME', 64 'xyz.openbmc_project.Ldap.Config', 65 description: 'D-Bus busname of LDAP config service.', 66) 67 68conf_data.set_quoted( 69 'LDAP_CONF_PERSIST_PATH', 70 '/var/lib/phosphor-ldap-conf', 71 description: 'path of directory having persisted LDAP configuration enabled property.', 72) 73 74conf_data.set( 75 'MAX_PASSWORD_LENGTH', 76 get_option('MAX_PASSWORD_LENGTH'), 77 description: 'Maximum password length', 78) 79 80conf_header = configure_file(output: 'config.h', configuration: conf_data) 81 82cpp = meson.get_compiler('cpp') 83 84boost_dep = dependency('boost') 85ldap_dep = cpp.find_library('ldap', required: get_option('ldap')) 86nlohmann_json_dep = dependency('nlohmann_json', include_type: 'system') 87pam_dep = dependency('pam') 88phosphor_dbus_interfaces_dep = dependency('phosphor-dbus-interfaces') 89phosphor_logging_dep = dependency('phosphor-logging') 90sdbusplus_dep = dependency('sdbusplus') 91systemd_dep = dependency('systemd') 92 93# Get Cereal dependency. 94cereal_dep = dependency('cereal', required: false) 95has_cereal = cpp.has_header_symbol( 96 'cereal/cereal.hpp', 97 'cereal::specialize', 98 dependencies: cereal_dep, 99 required: false, 100) 101if not has_cereal 102 cereal_opts = import('cmake').subproject_options() 103 cereal_opts.add_cmake_defines( 104 {'BUILD_TESTS': 'OFF', 'SKIP_PERFORMANCE_COMPARISON': 'ON'}, 105 ) 106 cereal_proj = import('cmake').subproject( 107 'cereal', 108 options: cereal_opts, 109 required: false, 110 ) 111 assert(cereal_proj.found(), 'cereal is required') 112 cereal_dep = cereal_proj.dependency('cereal') 113endif 114user_manager_src = ['mainapp.cpp', 'user_mgr.cpp', 'users.cpp'] 115 116 117user_manager_deps = [ 118 boost_dep, 119 nlohmann_json_dep, 120 pam_dep, 121 phosphor_dbus_interfaces_dep, 122 phosphor_logging_dep, 123 sdbusplus_dep, 124] 125 126user_manager_lib = static_library( 127 'phosphor-user-manager', 128 ['user_mgr.cpp', 'users.cpp'], 129 dependencies: user_manager_deps, 130) 131 132user_manager_dep = declare_dependency( 133 link_with: user_manager_lib, 134 dependencies: user_manager_deps, 135) 136 137executable( 138 'phosphor-user-manager', 139 'mainapp.cpp', 140 dependencies: user_manager_dep, 141 link_args: ['-lcrypt'], 142 cpp_args: [ 143 '-DBOOST_ALL_NO_LIB', 144 '-DBOOST_SYSTEM_NO_DEPRECATED', 145 '-DBOOST_ERROR_CODE_HEADER_ONLY', 146 ], 147 install: true, 148) 149 150 151systemd_system_unit_dir = systemd_dep.get_variable('systemd_system_unit_dir') 152 153install_data( 154 'phosphor-nslcd-cert-config.conf', 155 install_dir: get_option('datadir') / 'dbus-1' / 'system.d', 156) 157 158install_data( 159 'nslcd', 160 install_dir: get_option('datadir') / 'phosphor-certificate-manager', 161) 162 163install_data('mfa_pam', install_dir: '/etc/pam.d/') 164 165# Figure out how to use install_symlink to install symlink to a file of another 166# recipe 167#install_symlink( 168# 'phosphor-certificate-manager@nslcd.service', 169# install_dir: systemd_system_unit_dir / 'multi-user.target.wants', 170# pointing_to: systemd_system_unit_dir / 'phosphor-certificate-manager@.service', 171# ) 172meson.add_install_script( 173 'sh', 174 '-c', 175 'mkdir -p $(dirname $DESTDIR/@0@/@1@)'.format( 176 systemd_system_unit_dir, 177 'multi-user.target.wants/phosphor-certificate-manager@nslcd.service', 178 ), 179) 180meson.add_install_script( 181 'sh', 182 '-c', 183 'ln -s @0@ $DESTDIR/@1@/@2@'.format( 184 '../phosphor-certificate-manager@.service', 185 systemd_system_unit_dir, 186 'multi-user.target.wants/phosphor-certificate-manager@nslcd.service', 187 ), 188) 189 190if get_option('ldap').allowed() and ldap_dep.found() 191 subdir('phosphor-ldap-config') 192endif 193 194if get_option('tests').allowed() 195 subdir('test') 196endif 197