From 00b36108f48cd19525dd711b5cd44c72b7da9f93 Mon Sep 17 00:00:00 2001 From: Ralf Habacker Date: Mon, 15 Aug 2011 20:27:04 +0200 Subject: [PATCH 2/5] Include selinux code only when enabled (cmake parts) --- cmake/CMakeLists.txt | 8 +++++--- cmake/bus/CMakeLists.txt | 13 +++++++++++-- cmake/bus/session.conf.cmake | 6 ++---- cmake/bus/system.conf.cmake | 4 +--- 4 files changed, 19 insertions(+), 12 deletions(-) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 750e3f1..8f45296 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -274,8 +274,10 @@ endif(NOT MSVC) #AC_ARG_ENABLE(abstract-sockets, AS_HELP_STRING([--enable-abstract-sockets],[use abstract socket namespace (linux only)]),enable_abstract_sockets=$enableval,enable_abstract_sockets=auto) # -> moved before include(ConfigureChecks.cmake) -#AC_ARG_ENABLE(selinux, AS_HELP_STRING([--enable-selinux],[build with SELinux support]),enable_selinux=$enableval,enable_selinux=auto) -#selinux missing +OPTION(DBUS_ENABLE_SELINUX "build with SELinux support" OFF) +if (DBUS_ENABLE_SELINUX ) + add_definitions(-DHAVE_SELINUX) +endif (DBUS_ENABLE_SELINUX) #AC_ARG_ENABLE(dnotify, AS_HELP_STRING([--enable-dnotify],[build with dnotify support (linux only)]),enable_dnotify=$enableval,enable_dnotify=auto) if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux") @@ -564,7 +566,7 @@ message(" Building w/o assertions: ${DBUS_DISABLE_ASSERTS} " message(" Building w/o checks: ${DBUS_DISABLE_CHECKS} ") message(" Building bus stats API: ${DBUS_ENABLE_STATS} ") message(" installing system libs: ${DBUS_INSTALL_SYSTEM_LIBS} ") -#message(" Building SELinux support: ${have_selinux} ") +message(" Building SELinux support: ${DBUS_ENABLE_SELINUX} ") #message(" Building dnotify support: ${have_dnotify} ") message(" Building Doxygen docs: ${DBUS_ENABLE_DOXYGEN_DOCS} ") message(" Building XML docs: ${DBUS_ENABLE_XML_DOCS} ") diff --git a/cmake/bus/CMakeLists.txt b/cmake/bus/CMakeLists.txt index 1db519f..2ecbd58 100644 --- a/cmake/bus/CMakeLists.txt +++ b/cmake/bus/CMakeLists.txt @@ -4,6 +4,10 @@ add_definitions(-DDBUS_COMPILATION) SET(EFENCE "") SET(BUS_DIR ${CMAKE_SOURCE_DIR}/../bus) +if (DBUS_ENABLE_SELINUX) + set (DBUS_CONF_INCLUDE_SELINUX "contexts/dbus_contexts\n\n") +endif (DBUS_ENABLE_SELINUX) + set (config_DATA session.conf @@ -61,8 +65,6 @@ set (BUS_SOURCES ${BUS_DIR}/expirelist.h ${BUS_DIR}/policy.c ${BUS_DIR}/policy.h - ${BUS_DIR}/selinux.h - ${BUS_DIR}/selinux.c ${BUS_DIR}/services.c ${BUS_DIR}/services.h ${BUS_DIR}/signals.c @@ -74,6 +76,13 @@ set (BUS_SOURCES ${XML_SOURCES} ${DIR_WATCH_SOURCE} ) +if (DBUS_ENABLE_SELINUX) + list(APPEND BUS_SOURCES + ${BUS_DIR}/selinux.h + ${BUS_DIR}/selinux.c + ) +endif (DBUS_ENABLE_SELINUX) + if(DBUS_ENABLE_STATS) list(APPEND BUS_SOURCES ${BUS_DIR}/stats.c diff --git a/cmake/bus/session.conf.cmake b/cmake/bus/session.conf.cmake index 6bba91e..68c9a14 100644 --- a/cmake/bus/session.conf.cmake +++ b/cmake/bus/session.conf.cmake @@ -24,7 +24,5 @@ session-local.conf - - contexts/dbus_contexts - - + @DBUS_CONF_INCLUDE_SELINUX@ + \ No newline at end of file diff --git a/cmake/bus/system.conf.cmake b/cmake/bus/system.conf.cmake index ee85ecc..224396f 100644 --- a/cmake/bus/system.conf.cmake +++ b/cmake/bus/system.conf.cmake @@ -56,7 +56,5 @@ system-local.conf - - contexts/dbus_contexts - + @DBUS_CONF_INCLUDE_SELINUX@ -- 1.7.4.msysgit.0