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