blob: dafee5937930c5b6d874e1ee72aadd057696ce93 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
|
add_definitions(-DDBUS_COMPILATION)
set(EFENCE "")
# config files for installation
configure_file( "session.conf.in" "${CMAKE_CURRENT_BINARY_DIR}/session.conf" IMMEDIATE @ONLY)
configure_file( "legacy-config/session.conf.in" "${CMAKE_CURRENT_BINARY_DIR}/legacy-config/session.conf" IMMEDIATE @ONLY)
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/session.d)
if(NOT WIN32)
configure_file( "system.conf.in" "${CMAKE_CURRENT_BINARY_DIR}/system.conf" IMMEDIATE @ONLY)
configure_file( "legacy-config/system.conf.in" "${CMAKE_CURRENT_BINARY_DIR}/legacy-config/system.conf" IMMEDIATE @ONLY)
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/system.d)
endif()
# copy services for local daemon start to local service dir data/dbus-1/services
set(SERVICE_FILES test/data/valid-service-files)
file(GLOB FILES "${SERVICE_FILES}/*.service.in" )
foreach(FILE ${FILES})
get_filename_component(FILENAME ${FILE} NAME_WE)
set(TARGET ${CMAKE_BINARY_DIR}/data/dbus-1/services/${FILENAME}.service)
if(CONFIG_VERBOSE)
message("FROM: ${FILE}\nTO: ${TARGET}\n")
endif()
configure_file(${FILE} ${TARGET} )
endforeach()
if(DBUS_BUS_ENABLE_INOTIFY)
set(DIR_WATCH_SOURCE dir-watch-inotify.c)
elseif(DBUS_BUS_ENABLE_KQUEUE)
set(DIR_WATCH_SOURCE dir-watch-kqueue.c)
else(DBUS_BUS_ENABLE_INOTIFY)
set(DIR_WATCH_SOURCE dir-watch-default.c)
endif()
set(BUS_SOURCES
activation.c
activation.h
apparmor.c
apparmor.h
audit.c
audit.h
bus.c
bus.h
config-loader-expat.c
config-parser.c
config-parser.h
config-parser-common.c
config-parser-common.h
# config-parser-trivial.c
connection.c
connection.h
containers.c
containers.h
desktop-file.c
desktop-file.h
dir-watch.h
dispatch.c
dispatch.h
driver.c
driver.h
expirelist.c
expirelist.h
policy.c
policy.h
selinux.h
selinux.c
services.c
services.h
signals.c
signals.h
test.c
test.h
utils.c
utils.h
${DIR_WATCH_SOURCE}
)
if(DBUS_ENABLE_STATS)
list(APPEND BUS_SOURCES
stats.c
stats.h
)
endif()
include_directories(
${CMAKE_BINARY_DIR}
${EXPAT_INCLUDE_DIR}
)
set(DBUS_DAEMON_SOURCES
main.c
)
if(WIN32)
add_executable_version_info(DBUS_DAEMON_SOURCES "dbus-daemon")
endif()
add_library(dbus-daemon-internal STATIC ${BUS_SOURCES})
target_link_libraries(dbus-daemon-internal ${DBUS_INTERNAL_LIBRARIES} ${EXPAT_LIBRARIES})
add_executable(dbus-daemon ${DBUS_DAEMON_SOURCES})
target_link_libraries(dbus-daemon dbus-daemon-internal)
set_target_properties(dbus-daemon PROPERTIES OUTPUT_NAME ${DBUS_DAEMON_NAME})
set_target_properties(dbus-daemon PROPERTIES COMPILE_FLAGS ${DBUS_INTERNAL_CLIENT_DEFINITIONS})
install(TARGETS dbus-daemon ${INSTALL_TARGETS_DEFAULT_ARGS})
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/session.conf DESTINATION ${CMAKE_INSTALL_DATADIR}/dbus-1)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/legacy-config/session.conf DESTINATION ${CMAKE_INSTALL_FULL_SYSCONFDIR}/dbus-1)
install(DIRECTORY DESTINATION ${CMAKE_INSTALL_DATADIR}/dbus-1/session.d)
install(DIRECTORY DESTINATION ${CMAKE_INSTALL_DATADIR}/dbus-1/services)
if(NOT WIN32)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/system.conf DESTINATION ${CMAKE_INSTALL_DATADIR}/dbus-1)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/legacy-config/system.conf DESTINATION ${CMAKE_INSTALL_FULL_SYSCONFDIR}/dbus-1)
install(DIRECTORY DESTINATION ${CMAKE_INSTALL_DATADIR}/dbus-1/system.d)
install(DIRECTORY DESTINATION ${CMAKE_INSTALL_DATADIR}/dbus-1/system-services)
install(DIRECTORY DESTINATION ${CMAKE_INSTALL_FULL_LOCALSTATEDIR}/run/dbus)
endif()
if(DBUS_SERVICE)
set(dbus_service_SOURCES
bus-service-win.c
# TODO: add additional files
# service-main.c
# ${BUS_SOURCES}
)
add_executable_version_info(dbus_service_SOURCES "dbus-service")
add_executable(dbus-service ${dbus_service_SOURCES} )
target_link_libraries(dbus-service ${DBUS_INTERNAL_LIBRARIES} ${EXPAT_LIBRARIES})
set_target_properties(dbus-service PROPERTIES COMPILE_FLAGS ${DBUS_INTERNAL_CLIENT_DEFINITIONS})
install(TARGETS dbus-service ${INSTALL_TARGETS_DEFAULT_ARGS})
endif()
set(LAUNCH_HELPER_SOURCES
config-loader-expat.c
config-parser-common.c
config-parser-trivial.c
desktop-file.c
utils.c
)
if(NOT WIN32)
# test-bus-system depends on this library
add_library(launch-helper-internal STATIC ${LAUNCH_HELPER_SOURCES})
target_link_libraries(launch-helper-internal ${DBUS_INTERNAL_LIBRARIES} ${EXPAT_LIBRARIES})
if(ENABLE_TRADITIONAL_ACTIVATION)
add_executable(dbus-daemon-launch-helper activation-helper.c activation-helper-bin.c )
target_link_libraries(dbus-daemon-launch-helper launch-helper-internal)
install(TARGETS dbus-daemon-launch-helper RUNTIME DESTINATION ${CMAKE_INSTALL_LIBEXECDIR})
# It is intended not to check here that uid is 0 - see https://gitlab.freedesktop.org/dbus/dbus/-/merge_requests/154#note_478876
install(CODE "message(\"-- Note: Not installing \$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBEXECDIR}/dbus-daemon-launch-helper binary setuid!\")")
install(CODE "message(\"-- Note: You'll need to manually set permissions to 'root:${DBUS_USER}' and permissions '4750'\")")
endif()
endif()
if(MSVC)
project_source_group(${GROUP_CODE} bus_test_SOURCES dummy)
endif()
macro(install_example_in_file a)
configure_file(${a}.in ${CMAKE_CURRENT_BINARY_DIR}/${a})
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${a} DESTINATION ${CMAKE_INSTALL_DATADIR}/doc/dbus/examples)
endmacro()
macro(install_example_file a)
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${a} DESTINATION ${CMAKE_INSTALL_DATADIR}/doc/dbus/examples)
endmacro()
install_example_in_file(example-session-disable-stats.conf)
if(NOT WIN32)
install_example_in_file(example-system-enable-stats.conf)
install_example_file(example-system-hardening-without-traditional-activation.conf)
endif()
if(DBUS_BUS_ENABLE_SYSTEMD)
configure_file(dbus.socket.in ${CMAKE_CURRENT_BINARY_DIR}/dbus.socket)
configure_file(dbus.service.in ${CMAKE_CURRENT_BINARY_DIR}/dbus.service)
add_systemd_service(${CMAKE_CURRENT_BINARY_DIR}/dbus.socket PATH ${DBUS_SYSTEMD_SYSTEMUNITDIR} LINKS sockets.target.wants)
add_systemd_service(${CMAKE_CURRENT_BINARY_DIR}/dbus.service PATH ${DBUS_SYSTEMD_SYSTEMUNITDIR} LINKS multi-user.target.wants)
endif()
if(DBUS_ENABLE_USER_SESSION)
configure_file(systemd-user/dbus.socket.in ${CMAKE_CURRENT_BINARY_DIR}/systemd-user/dbus.socket)
configure_file(systemd-user/dbus.service.in ${CMAKE_CURRENT_BINARY_DIR}/systemd-user/dbus.service)
add_systemd_service(${CMAKE_CURRENT_BINARY_DIR}/systemd-user/dbus.socket PATH ${DBUS_SYSTEMD_USERUNITDIR} LINKS sockets.target.wants)
add_systemd_service(${CMAKE_CURRENT_BINARY_DIR}/systemd-user/dbus.service PATH ${DBUS_SYSTEMD_USERUNITDIR})
endif()
## mop up the gcov files
#clean-local:
# /bin/rm *.bb *.bbg *.da *.gcov || true
#install-data-hook:
# $(mkinstalldirs) $(DESTDIR)/$(localstatedir)/run/dbus
# $(mkinstalldirs) $(DESTDIR)/$(configdir)/system.d
# $(mkinstalldirs) $(DESTDIR)/$(datadir)/dbus-1/services
##install_file(${configdir}/system.d FILE
#### Init scripts fun
#SCRIPT_IN_FILES=messagebus.in
# rc.messagebus.in
## Red Hat start
#if DBUS_INIT_SCRIPTS_RED_HAT
#initddir=$(sysconfdir)/rc.d/init.d
#initd_SCRIPTS=
# messagebus
#endif
# ## Red Hat end
## Slackware start
#if DBUS_INIT_SCRIPTS_SLACKWARE
#initddir=$(sysconfdir)/rc.d/
#initd_SCRIPTS=
# rc.messagebus
#endif
## Slackware end
#MAN_IN_FILES=dbus-daemon.1.in
#man_MANS = dbus-daemon.1
#### Extra dist
#EXTRA_DIST=$(CONFIG_IN_FILES) $(SCRIPT_IN_FILES) $(man_MANS) $(MAN_IN_FILES)
|