]> git.ipfire.org Git - thirdparty/dbus.git/commitdiff
cmake: make support for traditional activation optional
authorRalf Habacker <ralf.habacker@freenet.de>
Wed, 23 Sep 2020 14:32:54 +0000 (16:32 +0200)
committerRalf Habacker <ralf.habacker@freenet.de>
Wed, 23 Sep 2020 15:21:40 +0000 (17:21 +0200)
Traditional activation is enabled/disabled with the cmake configure
parameter -DENABLE_TRADITIONAL_ACTIVATION, which is enabled by default.

This was added to the Autotools build system as part of dbus/dbus!107
but until now was not possible to disable when building with CMake.

CMakeLists.txt
bus/CMakeLists.txt
cmake/config.h.cmake
dbus/CMakeLists.txt
test/CMakeLists.txt
test/name-test/CMakeLists.txt

index caef7384052e8ed88e63ee8cb0effacb2264ceab..d86b8ac46081148161693e9f5a2a5933186ea060 100644 (file)
@@ -138,6 +138,7 @@ option(DBUS_DISABLE_ASSERT "Disable assertion checking" OFF)
 
 option(DBUS_ENABLE_STATS "enable bus daemon usage statistics" OFF)
 option(DBUS_ENABLE_CONTAINERS "enable restricted servers for app-containers" OFF)
+option(ENABLE_TRADITIONAL_ACTIVATION "Enable traditional activation (without using systemd)" ON)
 
 if(DBUS_LINUX)
     add_auto_option(ENABLE_SYSTEMD "build with systemd at_console support" AUTO)
@@ -177,6 +178,13 @@ if(DBUS_LINUX)
     endif()
 endif()
 
+if(NOT ENABLE_TRADITIONAL_ACTIVATION AND NOT (DBUS_LINUX AND DBUS_BUS_ENABLE_SYSTEMD))
+    message(WARNING "\
+Traditional activation and systemd activation are both disabled, so service \
+activation (automatically starting services that receive messages) will not work. \
+    ")
+endif()
+
 if(WIN32)
     set(FD_SETSIZE "8192" CACHE STRING "The maximum number of connections that can be handled at once")
 endif()
@@ -618,6 +626,7 @@ message("                                                                      "
 message("        install prefix:           ${prefix}                           ")
 message("        install exec_prefix:      ${exec_prefix}                      ")
 message("        install libdir:           ${CMAKE_INSTALL_FULL_LIBDIR}        ")
+message("        install libexecdir:       ${CMAKE_INSTALL_FULL_LIBEXECDIR}    ")
 message("        install bindir:           ${CMAKE_INSTALL_FULL_BINDIR}        ")
 message("        install sysconfdir:       ${CMAKE_INSTALL_FULL_SYSCONFDIR}    ")
 message("        install datadir:          ${CMAKE_INSTALL_FULL_DATADIR}       ")
@@ -654,6 +663,7 @@ message("        Building kqueue support:  ${DBUS_BUS_ENABLE_KQUEUE}           "
 message("        Building systemd support: ${DBUS_BUS_ENABLE_SYSTEMD}          ")
 message("        systemd system install dir:${DBUS_SYSTEMD_SYSTEMUNITDIR}      ")
 message("        systemd user install dir: ${DBUS_SYSTEMD_USERUNITDIR}         ")
+message("        Traditional activation:   ${ENABLE_TRADITIONAL_ACTIVATION}    ")
 message("        Building Doxygen docs:    ${DBUS_ENABLE_DOXYGEN_DOCS}         ")
 message("        Building Qt help docs:    ${DBUS_ENABLE_QTHELP_DOCS}          ")
 message("        Building XML docs:        ${DBUS_ENABLE_XML_DOCS}             ")
index a52c1bfb6efa46158b12ef12daf271a8ddf7225e..26f07dd2e10bd9ffb27e099d0dcd365b264f8411 100644 (file)
@@ -143,15 +143,18 @@ set(LAUNCH_HELPER_SOURCES
 )
 
 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})
 
-    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'\")")
+    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)
index cbffcfa91c9a6f2761cee52eb97db362542c7eae..f45a8fb3b2a7b464be364fc46b0b086f0270253a 100644 (file)
@@ -39,6 +39,7 @@
 
 #cmakedefine DBUS_ENABLE_STATS
 #cmakedefine DBUS_ENABLE_CONTAINERS
+#cmakedefine ENABLE_TRADITIONAL_ACTIVATION
 
 #define TEST_LISTEN       "@TEST_LISTEN@"
 
index 63070b69b5af9fa0f059d37749c5525111ba9920..a603a1aa15d534a69f9110cc8d586c8455b0096c 100644 (file)
@@ -214,10 +214,14 @@ else(WIN32)
         dbus-userdb.h
     )
     set(DBUS_UTIL_SOURCES ${DBUS_UTIL_SOURCES}
-        dbus-spawn-unix.c
         dbus-userdb-util.c
         dbus-sysdeps-util-unix.c
     )
+    if(ENABLE_TRADITIONAL_ACTIVATION)
+        set(DBUS_UTIL_SOURCES ${DBUS_UTIL_SOURCES}
+            dbus-spawn-unix.c
+        )
+    endif()
 endif()
 
 if(DBUS_HAVE_LINUX_EPOLL)
index 00042000ecb2d7dc4717a90b1117aa74aa30586d..20e75d85c78c8a9cd8f3f5b1c4988078621db59f 100644 (file)
@@ -81,10 +81,12 @@ add_test_executable(test-shell ${test-shell_SOURCES} ${DBUS_INTERNAL_LIBRARIES})
 add_test_executable(test-printf internals/printf.c dbus-testutils)
 add_helper_executable(test-privserver test-privserver.c dbus-testutils)
 add_helper_executable(test-shell-service ${test-shell-service_SOURCES} dbus-testutils)
-add_helper_executable(test-spawn ${test-spawn_SOURCES} ${DBUS_INTERNAL_LIBRARIES})
-if(NOT WINCE)
+if(NOT WINCE AND ENABLE_TRADITIONAL_ACTIVATION)
     add_test_executable(test-spawn-oom internals/spawn-oom.c dbus-testutils)
 endif()
+if(ENABLE_TRADITIONAL_ACTIVATION)
+    add_helper_executable(test-spawn ${test-spawn_SOURCES} ${DBUS_INTERNAL_LIBRARIES})
+endif()
 add_helper_executable(test-exit ${test-exit_SOURCES} ${DBUS_INTERNAL_LIBRARIES})
 # the second argument of add_helper_executable() is a whitespace-separated
 # list of source files and the third and subsequent arguments are libraries
@@ -156,8 +158,10 @@ if(DBUS_ENABLE_EMBEDDED_TESTS)
 
     if(NOT WIN32)
         add_test_executable(test-bus-system bus/system.c launch-helper-internal dbus-testutils)
-        add_test_executable(test-bus-launch-helper-oom bus/launch-helper-oom.c launch-helper-internal dbus-testutils)
-        add_helper_executable(dbus-daemon-launch-helper-for-tests bus/launch-helper-for-tests.c launch-helper-internal)
+        if(ENABLE_TRADITIONAL_ACTIVATION)
+            add_test_executable(test-bus-launch-helper-oom bus/launch-helper-oom.c launch-helper-internal dbus-testutils)
+            add_helper_executable(dbus-daemon-launch-helper-for-tests bus/launch-helper-for-tests.c launch-helper-internal)
+        endif()
     endif()
 endif()
 
index 7058d6967adea007c9deb3416e5632cf7457284d..e7c62587ab360eecba8f9738311a06c03ca2e383 100644 (file)
@@ -1,14 +1,16 @@
 add_definitions(${DBUS_INTERNAL_CLIENT_DEFINITIONS})
 
 add_helper_executable(test-autolaunch test-autolaunch.c dbus-testutils)
-add_helper_executable(test-privserver-client test-privserver-client.c dbus-testutils)
 
 add_session_test_executable(test-ids test-ids.c ${DBUS_INTERNAL_LIBRARIES})
-if (ENABLE_TRADITIONAL_ACTIVATION)
+add_session_test_executable(test-pending-call-disconnected test-pending-call-disconnected.c ${DBUS_INTERNAL_LIBRARIES})
+
+if(ENABLE_TRADITIONAL_ACTIVATION)
     add_session_test_executable(test-pending-call-dispatch test-pending-call-dispatch.c ${DBUS_INTERNAL_LIBRARIES})
     add_session_test_executable(test-pending-call-timeout test-pending-call-timeout.c ${DBUS_INTERNAL_LIBRARIES})
 endif()
 add_session_test_executable(test-shutdown test-shutdown.c dbus-testutils)
 if (ENABLE_TRADITIONAL_ACTIVATION)
-   add_session_test_executable(test-thread-init test-threads-init.c ${DBUS_INTERNAL_LIBRARIES})
+    add_session_test_executable(test-privserver-client test-privserver-client.c dbus-testutils)
+    add_session_test_executable(test-thread-init test-threads-init.c ${DBUS_INTERNAL_LIBRARIES})
 endif()