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