aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2013-06-20 14:43:23 -0500
committerCharles Kerr <charles.kerr@canonical.com>2013-06-20 14:43:23 -0500
commita5fb857ee48a9022eb1e6c9ea04e0aeff80f445b (patch)
tree39875a1ae2657e2a2a543150686347c769ddfb83
parent22e72bb60a789ba3a48aff737c8816908695b408 (diff)
downloadayatana-indicator-session-a5fb857ee48a9022eb1e6c9ea04e0aeff80f445b.tar.gz
ayatana-indicator-session-a5fb857ee48a9022eb1e6c9ea04e0aeff80f445b.tar.bz2
ayatana-indicator-session-a5fb857ee48a9022eb1e6c9ea04e0aeff80f445b.zip
cmake work: properly generate and install the .service file for dbus activation
-rw-r--r--CMakeLists.txt18
-rw-r--r--TODO4
-rwxr-xr-xbuild.sh2
-rw-r--r--data/CMakeLists.txt12
-rw-r--r--data/indicator-session.service.in2
5 files changed, 27 insertions, 11 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5f04214..f656cb4 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -10,9 +10,10 @@ set (GETTEXT_PACKAGE ${CMAKE_PROJECT_NAME})
option (enable_tests "Build the package's automatic tests." ON)
option (full_warnings "Full compiler warnings." ON)
option (enable_lcov "Generate lcov code coverage reports." ON)
-
+option (LOCAL_INSTALL "Support local installation." OFF)
find_package(PkgConfig REQUIRED)
+include (GNUInstallDirs)
include (FindPkgConfig)
include (GdbusCodegen)
include (GSettings)
@@ -44,6 +45,21 @@ add_custom_target (cppcheck COMMAND cppcheck --enable=all -q --error-exitcode=2
include_directories (${CMAKE_CURRENT_SOURCE_DIR}/src)
include_directories (${CMAKE_CURRENT_BINARY_DIR}/src)
+# Workaround for libexecdir on debian
+if (EXISTS "/etc/debian_version")
+ set(CMAKE_INSTALL_LIBEXECDIR ${CMAKE_INSTALL_LIBDIR})
+ set(CMAKE_INSTALL_FULL_LIBEXECDIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBEXECDIR}")
+endif()
+message("Installing libexec files to ${CMAKE_INSTALL_FULL_LIBEXECDIR}")
+
+if(${LOCAL_INSTALL})
+ set(DBUSSERVICEDIR "${CMAKE_INSTALL_DATADIR}/dbus-1/services/")
+else()
+ EXEC_PROGRAM(${PKG_CONFIG_EXECUTABLE} ARGS dbus-1 --variable session_bus_services_dir OUTPUT_VARIABLE DBUSSERVICEDIR )
+endif()
+message("Installing DBus services to ${DBUSSERVICEDIR}")
+
+
add_subdirectory (src)
add_subdirectory (data)
add_subdirectory (po)
diff --git a/TODO b/TODO
index f47802a..56c6a68 100644
--- a/TODO
+++ b/TODO
@@ -4,7 +4,7 @@ code
- fix deprecated/dead APIs use in backend
cmake
- - add cmake rule to install .indicator file
- - add cmake rule to install dbus service file
+ x add cmake rule to install .indicator file
+ x add cmake rule to install dbus service file
- icon installation
- test schema installation
diff --git a/build.sh b/build.sh
index 173ff8c..c98285e 100755
--- a/build.sh
+++ b/build.sh
@@ -13,6 +13,6 @@ fi
echo "Using $BUILD_COMMAND to build"
(
cd build
- cmake .. $EXTRA_ARGS -DCMAKE_INSTALL_PREFIX=../../install -Dlocal_install=ON
+ cmake .. $EXTRA_ARGS -DCMAKE_INSTALL_PREFIX=../../install -DLOCAL_INSTALL=ON -DCMAKE_BUILD_TYPE=Debug
$BUILD_COMMAND
)
diff --git a/data/CMakeLists.txt b/data/CMakeLists.txt
index c00b8db..84fe66c 100644
--- a/data/CMakeLists.txt
+++ b/data/CMakeLists.txt
@@ -5,18 +5,18 @@ include (GSettings)
add_schemas(clinica-schemas ${CMAKE_SOURCE_DIR}/data/com.canonical.indicator.session.gschema.xml)
# .service file
-include (GNUInstallDirs)
-configure_file (indicator-session.service.in indicator-session.service)
+set(SERVICE_NAME "indicator-session.service")
+set(SERVICE_PATH "${CMAKE_CURRENT_BINARY_DIR}/${SERVICE_NAME}")
+set(pkglibexecdir "${CMAKE_INSTALL_FULL_LIBEXECDIR}/indicator-session")
+configure_file ("${CMAKE_CURRENT_SOURCE_DIR}/${SERVICE_NAME}.in" "${SERVICE_PATH}")
+install (FILES ${SERVICE_PATH}
+ DESTINATION ${DBUSSERVICEDIR})
# .indicator file
install(FILES com.canonical.indicator.session
DESTINATION ${CMAKE_INSTALL_PREFIX}/share/unity/indicators)
# FIXME install files
-#install(FILES
-#${CMAKE_CURRENT_BINARY_DIR}/indicator-datetime.service
-#DESTINATION share/indicator-datetime # FIXME to be the real install dir.
-#)
#
#install(FILES
#datetime-dialog.ui
diff --git a/data/indicator-session.service.in b/data/indicator-session.service.in
index a4d10a1..e520e20 100644
--- a/data/indicator-session.service.in
+++ b/data/indicator-session.service.in
@@ -1,3 +1,3 @@
[D-BUS Service]
Name=com.canonical.indicator.session
-Exec=@libexecdir@/indicator-session-service
+Exec=@pkglibexecdir@/indicator-session-service