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