Ratan Gupta | ca039ca | 2022-01-09 12:22:27 +0530 | [diff] [blame] | 1 | project('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 | |
| 12 | conf_data = configuration_data() |
| 13 | |
| 14 | conf_data.set_quoted('USER_MANAGER_BUSNAME', 'xyz.openbmc_project.User.Manager', |
| 15 | description : 'The DBus busname to own.') |
| 16 | |
Ratan Gupta | ca039ca | 2022-01-09 12:22:27 +0530 | [diff] [blame] | 17 | conf_data.set_quoted('DEFAULT_CRYPT_ALGO', '1', |
| 18 | description : 'The default crypt algorithm if one not found in shadow.') |
| 19 | |
| 20 | conf_data.set('CLASS_VERSION', 1, |
| 21 | description : 'Class version to register with Cereal.') |
| 22 | |
| 23 | conf_data.set_quoted('LDAP_CONFIG_FILE', '/etc/nslcd.conf', |
| 24 | description : 'Path of LDAP configuration file.') |
| 25 | |
| 26 | conf_data.set_quoted('TLS_CACERT_PATH', '/etc/ssl/certs/authority', |
| 27 | description : 'Path of LDAP server CA certificate.') |
| 28 | |
| 29 | conf_data.set_quoted('TLS_CERT_FILE', '/etc/nslcd/certs/cert.pem', |
| 30 | description : 'Path of LDAP client certificate.') |
| 31 | |
| 32 | conf_data.set_quoted('LDAP_CONFIG_ROOT', '/xyz/openbmc_project/user/ldap', |
| 33 | description : 'LDAP configuration root.') |
| 34 | |
| 35 | conf_data.set_quoted('LDAP_CONFIG_DBUS_OBJ_PATH', '/xyz/openbmc_project/user/ldap/config', |
| 36 | description : 'D-Bus path of LDAP config object.') |
| 37 | |
| 38 | conf_data.set_quoted('LDAP_CONFIG_BUSNAME', 'xyz.openbmc_project.Ldap.Config', |
| 39 | description : 'D-Bus busname of LDAP config service.') |
| 40 | |
| 41 | conf_data.set_quoted('LDAP_CONF_PERSIST_PATH', '/var/lib/phosphor-ldap-conf', |
| 42 | description : 'path of directory having persisted LDAP configuration enabled property.') |
| 43 | |
| 44 | conf_data.set_quoted('SYSTEMD_BUSNAME', 'org.freedesktop.systemd1', |
| 45 | description : 'systemd busname.') |
| 46 | |
| 47 | conf_data.set_quoted('SYSTEMD_PATH', '/org/freedesktop/systemd1', |
Jiaqing Zhao | f76fb88 | 2022-07-05 21:41:08 +0800 | [diff] [blame] | 48 | description : 'systemd path') |
Ratan Gupta | ca039ca | 2022-01-09 12:22:27 +0530 | [diff] [blame] | 49 | |
| 50 | conf_data.set_quoted('SYSTEMD_INTERFACE', 'org.freedesktop.systemd1.Manager', |
| 51 | description : 'systemd interface.') |
| 52 | |
| 53 | conf_header = configure_file(output: 'config.h', |
| 54 | configuration: conf_data) |
| 55 | |
Patrick Williams | cf53a94 | 2022-03-21 11:10:43 -0500 | [diff] [blame] | 56 | phosphor_dbus_interfaces_dep = dependency('phosphor-dbus-interfaces') |
| 57 | sdbusplus_dep = dependency('sdbusplus') |
| 58 | phosphor_logging_dep = dependency('phosphor-logging') |
Ratan Gupta | ca039ca | 2022-01-09 12:22:27 +0530 | [diff] [blame] | 59 | systemd_dep = dependency('systemd') |
| 60 | |
| 61 | cpp = meson.get_compiler('cpp') |
| 62 | |
Patrick Williams | cf53a94 | 2022-03-21 11:10:43 -0500 | [diff] [blame] | 63 | # Get Cereal dependency. |
| 64 | cereal_dep = dependency('cereal', required: false) |
| 65 | has_cereal = cpp.has_header_symbol( |
| 66 | 'cereal/cereal.hpp', |
| 67 | 'cereal::specialize', |
| 68 | dependencies: cereal_dep, |
| 69 | required: false) |
| 70 | if 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') |
| 79 | endif |
| 80 | |
Ratan Gupta | ca039ca | 2022-01-09 12:22:27 +0530 | [diff] [blame] | 81 | user_manager_src = [ |
| 82 | 'mainapp.cpp', |
| 83 | 'user_mgr.cpp', |
| 84 | 'users.cpp' |
| 85 | ] |
| 86 | |
| 87 | user_manager_deps = [ |
| 88 | sdbusplus_dep, |
| 89 | phosphor_logging_dep, |
| 90 | phosphor_dbus_interfaces_dep |
| 91 | ] |
| 92 | |
| 93 | user_manager_lib = static_library( |
| 94 | 'phosphor-user-manager', |
| 95 | [ |
| 96 | 'user_mgr.cpp', |
| 97 | 'users.cpp', |
| 98 | ], |
| 99 | dependencies: user_manager_deps, |
| 100 | ) |
| 101 | |
| 102 | user_manager_dep = declare_dependency( |
| 103 | link_with: user_manager_lib, |
| 104 | dependencies: user_manager_deps |
| 105 | ) |
| 106 | |
| 107 | executable( |
| 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 | |
| 117 | systemd_system_unit_dir = systemd_dep.get_variable( |
| 118 | pkgconfig: 'systemdsystemunitdir' |
| 119 | ) |
| 120 | |
| 121 | busconfig_dir = get_option('datadir') / 'dbus-1' / 'system.d' |
| 122 | |
| 123 | cert_manager_dir = get_option('datadir') / 'phosphor-certificate-manager' |
| 124 | |
| 125 | certs = [] |
| 126 | |
| 127 | busconfig = [] |
| 128 | |
| 129 | systemd_alias = [] |
| 130 | |
| 131 | certs += 'nslcd' |
| 132 | |
| 133 | busconfig += 'phosphor-nslcd-cert-config.conf' |
| 134 | |
| 135 | systemd_alias += [[ |
| 136 | '../phosphor-certificate-manager@.service', |
| 137 | 'multi-user.target.wants/phosphor-certificate-manager@nslcd.service' |
| 138 | ]] |
| 139 | |
| 140 | |
| 141 | install_data( |
| 142 | busconfig, |
| 143 | install_dir: busconfig_dir, |
| 144 | ) |
| 145 | |
| 146 | install_data( |
| 147 | certs, |
| 148 | install_dir: cert_manager_dir, |
| 149 | ) |
| 150 | |
| 151 | foreach 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 | ) |
| 168 | endforeach |
| 169 | |
Ratan Gupta | ca039ca | 2022-01-09 12:22:27 +0530 | [diff] [blame] | 170 | subdir('phosphor-ldap-config') |
| 171 | |
| 172 | if get_option('tests').enabled() |
| 173 | subdir('test') |
| 174 | endif |