Create libLogger, libSimpleDbus, libConfig packages. 55/38855/5
authorDariusz Michaluk <d.michaluk@samsung.com>
Mon, 20 Apr 2015 13:21:39 +0000 (15:21 +0200)
committerDariusz Michaluk <d.michaluk@samsung.com>
Wed, 6 May 2015 13:57:39 +0000 (15:57 +0200)
[Bug/Feature]  Create libLogger, libSimpleDbus, libConfig packages.
[Cause]        N/A
[Solution]     N/A
[Verification] Build, install, run tests, run server.

Change-Id: Iab8c507315f6534ffd11e9f664e017ab45d7e94e
Signed-off-by: Dariusz Michaluk <d.michaluk@samsung.com>
59 files changed:
CMakeLists.txt
client/CMakeLists.txt
libs/config/CMakeLists.txt [new file with mode: 0644]
libs/config/config.hpp [new file with mode: 0644]
libs/config/exception.hpp [moved from common/config/exception.hpp with 100% similarity]
libs/config/fdstore.cpp [moved from common/config/fdstore.cpp with 99% similarity]
libs/config/fdstore.hpp [moved from common/config/fdstore.hpp with 100% similarity]
libs/config/fields-union.hpp [moved from common/config/fields-union.hpp with 100% similarity]
libs/config/fields.hpp [moved from common/config/fields.hpp with 100% similarity]
libs/config/from-fdstore-visitor.hpp [moved from common/config/from-fdstore-visitor.hpp with 100% similarity]
libs/config/from-gvariant-visitor.hpp [moved from common/config/from-gvariant-visitor.hpp with 100% similarity]
libs/config/from-json-visitor.hpp [moved from common/config/from-json-visitor.hpp with 100% similarity]
libs/config/from-kvjson-visitor.hpp [moved from common/config/from-kvjson-visitor.hpp with 100% similarity]
libs/config/from-kvstore-visitor.hpp [moved from common/config/from-kvstore-visitor.hpp with 100% similarity]
libs/config/fs-utils.cpp [moved from common/config/fs-utils.cpp with 100% similarity]
libs/config/fs-utils.hpp [moved from common/config/fs-utils.hpp with 100% similarity]
libs/config/is-union.hpp [moved from common/config/is-union.hpp with 100% similarity]
libs/config/is-visitable.hpp [moved from common/config/is-visitable.hpp with 100% similarity]
libs/config/kvstore.cpp [moved from common/config/kvstore.cpp with 99% similarity]
libs/config/kvstore.hpp [moved from common/config/kvstore.hpp with 100% similarity]
libs/config/libConfig.pc.in [new file with mode: 0644]
libs/config/manager.hpp [moved from common/config/manager.hpp with 100% similarity]
libs/config/sqlite3/connection.cpp [moved from common/config/sqlite3/connection.cpp with 100% similarity]
libs/config/sqlite3/connection.hpp [moved from common/config/sqlite3/connection.hpp with 100% similarity]
libs/config/sqlite3/statement.cpp [moved from common/config/sqlite3/statement.cpp with 100% similarity]
libs/config/sqlite3/statement.hpp [moved from common/config/sqlite3/statement.hpp with 100% similarity]
libs/config/to-fdstore-visitor.hpp [moved from common/config/to-fdstore-visitor.hpp with 100% similarity]
libs/config/to-gvariant-visitor.hpp [moved from common/config/to-gvariant-visitor.hpp with 100% similarity]
libs/config/to-json-visitor.hpp [moved from common/config/to-json-visitor.hpp with 100% similarity]
libs/config/to-kvstore-visitor.hpp [moved from common/config/to-kvstore-visitor.hpp with 100% similarity]
libs/dbus/CMakeLists.txt [new file with mode: 0644]
libs/dbus/config.hpp [new file with mode: 0644]
libs/dbus/connection.cpp [moved from common/dbus/connection.cpp with 99% similarity]
libs/dbus/connection.hpp [moved from common/dbus/connection.hpp with 100% similarity]
libs/dbus/exception.hpp [moved from common/dbus/exception.hpp with 100% similarity]
libs/dbus/libSimpleDbus.pc.in [new file with mode: 0644]
libs/logger/CMakeLists.txt [new file with mode: 0644]
libs/logger/backend-journal.cpp [moved from common/logger/backend-journal.cpp with 98% similarity]
libs/logger/backend-journal.hpp [moved from common/logger/backend-journal.hpp with 100% similarity]
libs/logger/backend-null.hpp [moved from common/logger/backend-null.hpp with 100% similarity]
libs/logger/backend-stderr.cpp [moved from common/logger/backend-stderr.cpp with 98% similarity]
libs/logger/backend-stderr.hpp [moved from common/logger/backend-stderr.hpp with 100% similarity]
libs/logger/backend.hpp [moved from common/logger/backend.hpp with 100% similarity]
libs/logger/ccolor.cpp [moved from common/logger/ccolor.cpp with 97% similarity]
libs/logger/ccolor.hpp [moved from common/logger/ccolor.hpp with 100% similarity]
libs/logger/config.hpp [new file with mode: 0644]
libs/logger/formatter.cpp [moved from common/logger/formatter.cpp with 99% similarity]
libs/logger/formatter.hpp [moved from common/logger/formatter.hpp with 100% similarity]
libs/logger/level.cpp [moved from common/logger/level.cpp with 98% similarity]
libs/logger/level.hpp [moved from common/logger/level.hpp with 100% similarity]
libs/logger/libLogger.pc.in [new file with mode: 0644]
libs/logger/logger-scope.cpp [moved from common/logger/logger-scope.cpp with 100% similarity]
libs/logger/logger-scope.hpp [moved from common/logger/logger-scope.hpp with 100% similarity]
libs/logger/logger.cpp [moved from common/logger/logger.cpp with 98% similarity]
libs/logger/logger.hpp [moved from common/logger/logger.hpp with 100% similarity]
packaging/vasum.spec
server/CMakeLists.txt
tests/unit_tests/CMakeLists.txt
zone-daemon/CMakeLists.txt

index 308fb45..9b61793 100644 (file)
@@ -133,6 +133,10 @@ ENDIF(NOT DEFINED PYTHON_SITELIB)
 
 ## Subdirectories ##############################################################
 SET(COMMON_FOLDER ${PROJECT_SOURCE_DIR}/common)
+SET(LIBS_FOLDER ${PROJECT_SOURCE_DIR}/libs)
+SET(LOGGER_FOLDER ${PROJECT_SOURCE_DIR}/libs/logger)
+SET(DBUS_FOLDER ${PROJECT_SOURCE_DIR}/libs/dbus)
+SET(CONFIG_FOLDER ${PROJECT_SOURCE_DIR}/libs/config)
 SET(CLIENT_FOLDER ${PROJECT_SOURCE_DIR}/client)
 SET(SERVER_FOLDER ${PROJECT_SOURCE_DIR}/server)
 SET(ZONE_SUPPORT_FOLDER ${PROJECT_SOURCE_DIR}/zone-support)
@@ -172,6 +176,9 @@ SET(VSM_CONFIG_INSTALL_DIR ${SYSCONF_INSTALL_DIR}/vasum)
 SET(VSM_SERVER_IPC_SOCKET_PATH /var/run/vasum-ipc.socket)
 SET(VSM_UNIT_TESTS_IPC_SOCKET_PATH /var/run/vasum-ipc-unit-tests.socket)
 
+ADD_SUBDIRECTORY(${LOGGER_FOLDER})
+ADD_SUBDIRECTORY(${DBUS_FOLDER})
+ADD_SUBDIRECTORY(${CONFIG_FOLDER})
 ADD_SUBDIRECTORY(${CLIENT_FOLDER})
 ADD_SUBDIRECTORY(${SERVER_FOLDER})
 ADD_SUBDIRECTORY(${ZONE_SUPPORT_FOLDER})
index afe609f..753b7c4 100644 (file)
 MESSAGE(STATUS "")
 MESSAGE(STATUS "Generating makefile for the Client...")
 FILE(GLOB project_SRCS *.cpp *.hpp *.h)
-FILE(GLOB common_SRCS ${COMMON_FOLDER}/config/*.hpp             ${COMMON_FOLDER}/config/*.cpp
-                      ${COMMON_FOLDER}/config/sqlite3/*.hpp     ${COMMON_FOLDER}/config/sqlite3/*.cpp
-                      ${COMMON_FOLDER}/dbus/*.hpp               ${COMMON_FOLDER}/dbus/*.cpp
-                      ${COMMON_FOLDER}/epoll/*.hpp              ${COMMON_FOLDER}/epoll/*.cpp
+FILE(GLOB common_SRCS ${COMMON_FOLDER}/epoll/*.hpp              ${COMMON_FOLDER}/epoll/*.cpp
                       ${COMMON_FOLDER}/ipc/*.hpp                ${COMMON_FOLDER}/ipc/*.cpp
                       ${COMMON_FOLDER}/ipc/internals/*.hpp      ${COMMON_FOLDER}/ipc/internals/*.cpp
-                      ${COMMON_FOLDER}/logger/*.hpp             ${COMMON_FOLDER}/logger/*.cpp
                       ${COMMON_FOLDER}/utils/*.hpp              ${COMMON_FOLDER}/utils/*.cpp
                       ${COMMON_FOLDER}/*.hpp                    ${COMMON_FOLDER}/*.cpp)
 
@@ -47,14 +43,15 @@ SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES
         VERSION ${_LIB_VERSION_}
         COMPILE_DEFINITIONS HOST_IPC_SOCKET="${VSM_SERVER_IPC_SOCKET_PATH}")
 
-
 ## Link libraries ##############################################################
 FIND_PACKAGE(Boost COMPONENTS system filesystem)
-PKG_CHECK_MODULES(LIB_DEPS REQUIRED gio-2.0 libsystemd-daemon libsystemd-journal libcap-ng sqlite3)
+PKG_CHECK_MODULES(LIB_DEPS REQUIRED gio-2.0 libsystemd-daemon libcap-ng)
 INCLUDE_DIRECTORIES(SYSTEM ${LIB_DEPS_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS})
 INCLUDE_DIRECTORIES(${COMMON_FOLDER})
+INCLUDE_DIRECTORIES(${LIBS_FOLDER})
 INCLUDE_DIRECTORIES(${SERVER_FOLDER})
-TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${LIB_DEPS_LIBRARIES} ${Boost_LIBRARIES})
+TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${LIB_DEPS_LIBRARIES} ${Boost_LIBRARIES}
+                      Config SimpleDbus)
 
 ## Generate the pc file ########################################################
 CONFIGURE_FILE(${PC_FILE}.in ${CMAKE_BINARY_DIR}/${PC_FILE} @ONLY)
diff --git a/libs/config/CMakeLists.txt b/libs/config/CMakeLists.txt
new file mode 100644 (file)
index 0000000..377b734
--- /dev/null
@@ -0,0 +1,60 @@
+# Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+#
+#    Licensed under the Apache License, Version 2.0 (the "License");
+#    you may not use this file except in compliance with the License.
+#    You may obtain a copy of the License at
+#
+#        http://www.apache.org/licenses/LICENSE-2.0
+#
+#    Unless required by applicable law or agreed to in writing, software
+#    distributed under the License is distributed on an "AS IS" BASIS,
+#    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#    See the License for the specific language governing permissions and
+#    limitations under the License.
+#
+#
+# @file   CMakeLists.txt
+# @author Dariusz Michaluk (d.michaluk@samsung.com)
+#
+
+PROJECT(Config)
+
+MESSAGE(STATUS "")
+MESSAGE(STATUS "Generating makefile for the libConfig...")
+FILE(GLOB HEADERS           *.hpp)
+FILE(GLOB HEADERS_SQLITE3   ${CMAKE_CURRENT_BINARY_DIR}/sqlite3/*.hpp)
+FILE(GLOB_RECURSE SRCS      *.cpp *.hpp)
+
+SET(_LIB_VERSION_ "0.0.1")
+SET(_LIB_SOVERSION_ "0")
+SET(PC_FILE "lib${PROJECT_NAME}.pc")
+
+## Setup target ################################################################
+ADD_LIBRARY(${PROJECT_NAME} SHARED ${SRCS})
+SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES
+    SOVERSION   ${_LIB_SOVERSION_}
+    VERSION     ${_LIB_VERSION_}
+)
+
+## Link libraries ##############################################################
+PKG_CHECK_MODULES(CONFIG_DEPS REQUIRED sqlite3 glib-2.0)
+INCLUDE_DIRECTORIES(${LIBS_FOLDER})
+INCLUDE_DIRECTORIES(SYSTEM ${CONFIG_DEPS_INCLUDE_DIRS})
+TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs_LDFLAGS} ${CONFIG_DEPS_LIBRARIES})
+
+## Generate the pc file ########################################################
+CONFIGURE_FILE(${PC_FILE}.in ${CMAKE_CURRENT_BINARY_DIR}/${PC_FILE} @ONLY)
+
+## Install #####################################################################
+INSTALL(FILES       ${CMAKE_CURRENT_BINARY_DIR}/${PC_FILE}
+        DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
+
+INSTALL(TARGETS     ${PROJECT_NAME}
+        DESTINATION ${LIB_INSTALL_DIR}
+        COMPONENT   RuntimeLibraries)
+
+INSTALL(FILES       ${HEADERS}
+        DESTINATION ${INCLUDE_INSTALL_DIR}/vasum-tools/config)
+
+INSTALL(FILES       ${HEADERS_SQLITE3}
+        DESTINATION ${INCLUDE_INSTALL_DIR}/vasum-tools/config/sqlite3)
diff --git a/libs/config/config.hpp b/libs/config/config.hpp
new file mode 100644 (file)
index 0000000..753430e
--- /dev/null
@@ -0,0 +1,78 @@
+/*
+ *  Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ *  Contact: Lukasz Pawelczyk (l.pawelczyk@partner.samsung.com)
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License
+ */
+
+/**
+ * @file
+ * @author  Lukasz Pawelczyk (l.pawelczyk@partner.samsung.com)
+ * @brief   Configuration file for the code
+ */
+
+
+#ifndef COMMON_CONFIG_HPP
+#define COMMON_CONFIG_HPP
+
+
+#ifdef __clang__
+#define CLANG_VERSION (__clang__major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__)
+#endif // __clang__
+
+#if defined __GNUC__ && !defined __clang__  // clang also defines GCC versions
+#define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
+#endif // __GNUC__
+
+
+#ifdef GCC_VERSION
+
+#if GCC_VERSION < 40800
+// GCC 4.8 is the first where those defines are not required for
+// std::this_thread::sleep_for() and ::yield(). They might exist though
+// in previous versions depending on the build configuration of the GCC.
+#ifndef _GLIBCXX_USE_NANOSLEEP
+#define _GLIBCXX_USE_NANOSLEEP
+#endif // _GLIBCXX_USE_NANOSLEEP
+#ifndef _GLIBCXX_USE_SCHED_YIELD
+#define _GLIBCXX_USE_SCHED_YIELD
+#endif // _GLIBCXX_USE_SCHED_YIELD
+#endif // GCC_VERSION < 40800
+
+#if GCC_VERSION < 40700
+// Those appeared in 4.7 with full c++11 support
+#define final
+#define override
+#define thread_local __thread  // use GCC extension instead of C++11
+#define steady_clock monotonic_clock
+#endif // GCC_VERSION < 40700
+
+#endif // GCC_VERSION
+
+// Variadic macros support for boost preprocessor should be enabled
+// manually for clang since they are marked as untested feature
+// (boost trunk if fixed but the latest 1.55 version is not,
+// see boost/preprocessor/config/config.hpp)
+#ifdef __clang__
+#define BOOST_PP_VARIADICS 1
+#endif
+
+// This has to be defined always when the boost has not been compiled
+// using C++11. Headers detect that you are compiling using C++11 and
+// blindly and wrongly assume that boost has been as well.
+#ifndef BOOST_NO_CXX11_SCOPED_ENUMS
+#define BOOST_NO_CXX11_SCOPED_ENUMS 1
+#endif
+
+#endif // COMMON_CONFIG_HPP
similarity index 99%
rename from common/config/fdstore.cpp
rename to libs/config/fdstore.cpp
index c1cedfe..2b761eb 100644 (file)
@@ -22,7 +22,7 @@
  * @brief  Definition of a class for writing and reading data from a file descriptor
  */
 
-#include "config.hpp"
+#include "config/config.hpp"
 
 #include "config/fdstore.hpp"
 #include "config/exception.hpp"
similarity index 99%
rename from common/config/kvstore.cpp
rename to libs/config/kvstore.cpp
index 49656ae..b6d922e 100644 (file)
@@ -22,7 +22,7 @@
  * @brief  Definition of a class for key-value storage in a sqlite3 database
  */
 
-#include "config.hpp"
+#include "config/config.hpp"
 
 #include "config/kvstore.hpp"
 #include "config/exception.hpp"
diff --git a/libs/config/libConfig.pc.in b/libs/config/libConfig.pc.in
new file mode 100644 (file)
index 0000000..82f4559
--- /dev/null
@@ -0,0 +1,12 @@
+# Package Information for pkg-config
+
+prefix=@CMAKE_INSTALL_PREFIX@
+exec_prefix=@CMAKE_INSTALL_PREFIX@
+libdir=@LIB_INSTALL_DIR@
+includedir=@INCLUDE_INSTALL_DIR@
+
+Name: libConfig
+Description: Config library
+Version: @_LIB_VERSION_@
+Libs: -L${libdir} -lConfig
+Cflags: -I${includedir}/vasum-tools
diff --git a/libs/dbus/CMakeLists.txt b/libs/dbus/CMakeLists.txt
new file mode 100644 (file)
index 0000000..cd2c06c
--- /dev/null
@@ -0,0 +1,68 @@
+# Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+#
+#    Licensed under the Apache License, Version 2.0 (the "License");
+#    you may not use this file except in compliance with the License.
+#    You may obtain a copy of the License at
+#
+#        http://www.apache.org/licenses/LICENSE-2.0
+#
+#    Unless required by applicable law or agreed to in writing, software
+#    distributed under the License is distributed on an "AS IS" BASIS,
+#    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#    See the License for the specific language governing permissions and
+#    limitations under the License.
+#
+#
+# @file   CMakeLists.txt
+# @author Dariusz Michaluk (d.michaluk@samsung.com)
+#
+
+PROJECT(SimpleDbus)
+
+MESSAGE(STATUS "")
+MESSAGE(STATUS "Generating makefile for the libSimpleDbus...")
+FILE(GLOB HEADERS       *.hpp)
+FILE(GLOB HEADERS_UTILS ${COMMON_FOLDER}/utils/callback-guard.hpp
+                        ${COMMON_FOLDER}/utils/scoped-gerror.hpp
+                        ${COMMON_FOLDER}/utils/glib-utils.hpp
+                        ${COMMON_FOLDER}/utils/callback-wrapper.hpp)
+FILE(GLOB SRCS_UTILS    ${COMMON_FOLDER}/utils/callback-guard.cpp
+                        ${COMMON_FOLDER}/utils/scoped-gerror.cpp
+                        ${COMMON_FOLDER}/utils/glib-utils.cpp
+                        ${COMMON_FOLDER}/utils/callback-wrapper.cpp)
+FILE(GLOB SRCS          *.cpp *.hpp)
+
+SET(_LIB_VERSION_ "0.0.1")
+SET(_LIB_SOVERSION_ "0")
+SET(PC_FILE "lib${PROJECT_NAME}.pc")
+
+## Setup target ################################################################
+ADD_LIBRARY(${PROJECT_NAME} SHARED ${SRCS} ${SRCS_UTILS})
+SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES
+    SOVERSION   ${_LIB_SOVERSION_}
+    VERSION     ${_LIB_VERSION_}
+)
+
+## Link libraries ##############################################################
+PKG_CHECK_MODULES(DBUS_DEPS REQUIRED glib-2.0 gio-2.0)
+INCLUDE_DIRECTORIES(${COMMON_FOLDER})
+INCLUDE_DIRECTORIES(${LIBS_FOLDER})
+INCLUDE_DIRECTORIES(SYSTEM ${DBUS_DEPS_INCLUDE_DIRS})
+TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs_LDFLAGS} ${DBUS_DEPS_LIBRARIES} Logger)
+
+## Generate the pc file ########################################################
+CONFIGURE_FILE(${PC_FILE}.in ${CMAKE_CURRENT_BINARY_DIR}/${PC_FILE} @ONLY)
+
+## Install #####################################################################
+INSTALL(FILES       ${CMAKE_CURRENT_BINARY_DIR}/${PC_FILE}
+        DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
+
+INSTALL(TARGETS     ${PROJECT_NAME}
+        DESTINATION ${LIB_INSTALL_DIR}
+        COMPONENT   RuntimeLibraries)
+
+INSTALL(FILES       ${HEADERS}
+        DESTINATION ${INCLUDE_INSTALL_DIR}/vasum-tools/dbus)
+
+INSTALL(FILES       ${HEADERS_UTILS}
+        DESTINATION ${INCLUDE_INSTALL_DIR}/vasum-tools/dbus/utils)
diff --git a/libs/dbus/config.hpp b/libs/dbus/config.hpp
new file mode 100644 (file)
index 0000000..753430e
--- /dev/null
@@ -0,0 +1,78 @@
+/*
+ *  Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ *  Contact: Lukasz Pawelczyk (l.pawelczyk@partner.samsung.com)
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License
+ */
+
+/**
+ * @file
+ * @author  Lukasz Pawelczyk (l.pawelczyk@partner.samsung.com)
+ * @brief   Configuration file for the code
+ */
+
+
+#ifndef COMMON_CONFIG_HPP
+#define COMMON_CONFIG_HPP
+
+
+#ifdef __clang__
+#define CLANG_VERSION (__clang__major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__)
+#endif // __clang__
+
+#if defined __GNUC__ && !defined __clang__  // clang also defines GCC versions
+#define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
+#endif // __GNUC__
+
+
+#ifdef GCC_VERSION
+
+#if GCC_VERSION < 40800
+// GCC 4.8 is the first where those defines are not required for
+// std::this_thread::sleep_for() and ::yield(). They might exist though
+// in previous versions depending on the build configuration of the GCC.
+#ifndef _GLIBCXX_USE_NANOSLEEP
+#define _GLIBCXX_USE_NANOSLEEP
+#endif // _GLIBCXX_USE_NANOSLEEP
+#ifndef _GLIBCXX_USE_SCHED_YIELD
+#define _GLIBCXX_USE_SCHED_YIELD
+#endif // _GLIBCXX_USE_SCHED_YIELD
+#endif // GCC_VERSION < 40800
+
+#if GCC_VERSION < 40700
+// Those appeared in 4.7 with full c++11 support
+#define final
+#define override
+#define thread_local __thread  // use GCC extension instead of C++11
+#define steady_clock monotonic_clock
+#endif // GCC_VERSION < 40700
+
+#endif // GCC_VERSION
+
+// Variadic macros support for boost preprocessor should be enabled
+// manually for clang since they are marked as untested feature
+// (boost trunk if fixed but the latest 1.55 version is not,
+// see boost/preprocessor/config/config.hpp)
+#ifdef __clang__
+#define BOOST_PP_VARIADICS 1
+#endif
+
+// This has to be defined always when the boost has not been compiled
+// using C++11. Headers detect that you are compiling using C++11 and
+// blindly and wrongly assume that boost has been as well.
+#ifndef BOOST_NO_CXX11_SCOPED_ENUMS
+#define BOOST_NO_CXX11_SCOPED_ENUMS 1
+#endif
+
+#endif // COMMON_CONFIG_HPP
similarity index 99%
rename from common/dbus/connection.cpp
rename to libs/dbus/connection.cpp
index 12544be..441174b 100644 (file)
@@ -22,7 +22,7 @@
  * @brief   Dbus connection class
  */
 
-#include "config.hpp"
+#include "dbus/config.hpp"
 #include "dbus/connection.hpp"
 #include "dbus/exception.hpp"
 #include "utils/callback-wrapper.hpp"
diff --git a/libs/dbus/libSimpleDbus.pc.in b/libs/dbus/libSimpleDbus.pc.in
new file mode 100644 (file)
index 0000000..b3adec3
--- /dev/null
@@ -0,0 +1,12 @@
+# Package Information for pkg-config
+
+prefix=@CMAKE_INSTALL_PREFIX@
+exec_prefix=@CMAKE_INSTALL_PREFIX@
+libdir=@LIB_INSTALL_DIR@
+includedir=@INCLUDE_INSTALL_DIR@
+
+Name: libSimpleDbus
+Description: Simple Dbus library
+Version: @_LIB_VERSION_@
+Libs: -L${libdir} -lSimpleDbus
+Cflags: -I${includedir}/vasum-tools
diff --git a/libs/logger/CMakeLists.txt b/libs/logger/CMakeLists.txt
new file mode 100644 (file)
index 0000000..786f8bc
--- /dev/null
@@ -0,0 +1,56 @@
+# Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+#
+#    Licensed under the Apache License, Version 2.0 (the "License");
+#    you may not use this file except in compliance with the License.
+#    You may obtain a copy of the License at
+#
+#        http://www.apache.org/licenses/LICENSE-2.0
+#
+#    Unless required by applicable law or agreed to in writing, software
+#    distributed under the License is distributed on an "AS IS" BASIS,
+#    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#    See the License for the specific language governing permissions and
+#    limitations under the License.
+#
+#
+# @file   CMakeLists.txt
+# @author Dariusz Michaluk (d.michaluk@samsung.com)
+#
+
+PROJECT(Logger)
+
+MESSAGE(STATUS "")
+MESSAGE(STATUS "Generating makefile for the libLogger...")
+FILE(GLOB HEADERS   *.hpp)
+FILE(GLOB SRCS      *.cpp *.hpp)
+
+SET(_LIB_VERSION_ "0.0.1")
+SET(_LIB_SOVERSION_ "0")
+SET(PC_FILE "lib${PROJECT_NAME}.pc")
+
+## Setup target ################################################################
+ADD_LIBRARY(${PROJECT_NAME} SHARED ${SRCS})
+SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES
+    SOVERSION   ${_LIB_SOVERSION_}
+    VERSION     ${_LIB_VERSION_}
+)
+
+## Link libraries ##############################################################
+PKG_CHECK_MODULES(LOGGER_DEPS REQUIRED libsystemd-journal)
+INCLUDE_DIRECTORIES(${LIBS_FOLDER})
+INCLUDE_DIRECTORIES(SYSTEM ${LOGGER_DEPS_INCLUDE_DIRS})
+TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs_LDFLAGS} ${LOGGER_DEPS_LIBRARIES})
+
+## Generate the pc file ########################################################
+CONFIGURE_FILE(${PC_FILE}.in ${CMAKE_CURRENT_BINARY_DIR}/${PC_FILE} @ONLY)
+
+## Install #####################################################################
+INSTALL(FILES       ${CMAKE_CURRENT_BINARY_DIR}/${PC_FILE}
+        DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
+
+INSTALL(TARGETS     ${PROJECT_NAME}
+        DESTINATION ${LIB_INSTALL_DIR}
+        COMPONENT   RuntimeLibraries)
+
+INSTALL(FILES       ${HEADERS}
+        DESTINATION ${INCLUDE_INSTALL_DIR}/vasum-tools/logger)
similarity index 98%
rename from common/logger/backend-journal.cpp
rename to libs/logger/backend-journal.cpp
index 12c4eff..74fc581 100644 (file)
@@ -22,7 +22,7 @@
  * @brief   Systemd journal backend for logger
  */
 
-#include "config.hpp"
+#include "logger/config.hpp"
 #include "logger/backend-journal.hpp"
 
 #define SD_JOURNAL_SUPPRESS_LOCATION
similarity index 98%
rename from common/logger/backend-stderr.cpp
rename to libs/logger/backend-stderr.cpp
index d4e36b1..c0d3a3c 100644 (file)
@@ -22,7 +22,7 @@
  * @brief   Stderr backend for logger
  */
 
-#include "config.hpp"
+#include "logger/config.hpp"
 #include "logger/backend-stderr.hpp"
 #include "logger/formatter.hpp"
 
similarity index 97%
rename from common/logger/ccolor.cpp
rename to libs/logger/ccolor.cpp
index e5e71b0..7424044 100644 (file)
@@ -22,7 +22,7 @@
  * @brief   Console color for StderrBackend logger
  */
 
-#include "config.hpp"
+#include "logger/config.hpp"
 #include "logger/ccolor.hpp"
 
 #include <stdio.h>
diff --git a/libs/logger/config.hpp b/libs/logger/config.hpp
new file mode 100644 (file)
index 0000000..753430e
--- /dev/null
@@ -0,0 +1,78 @@
+/*
+ *  Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ *  Contact: Lukasz Pawelczyk (l.pawelczyk@partner.samsung.com)
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License
+ */
+
+/**
+ * @file
+ * @author  Lukasz Pawelczyk (l.pawelczyk@partner.samsung.com)
+ * @brief   Configuration file for the code
+ */
+
+
+#ifndef COMMON_CONFIG_HPP
+#define COMMON_CONFIG_HPP
+
+
+#ifdef __clang__
+#define CLANG_VERSION (__clang__major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__)
+#endif // __clang__
+
+#if defined __GNUC__ && !defined __clang__  // clang also defines GCC versions
+#define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
+#endif // __GNUC__
+
+
+#ifdef GCC_VERSION
+
+#if GCC_VERSION < 40800
+// GCC 4.8 is the first where those defines are not required for
+// std::this_thread::sleep_for() and ::yield(). They might exist though
+// in previous versions depending on the build configuration of the GCC.
+#ifndef _GLIBCXX_USE_NANOSLEEP
+#define _GLIBCXX_USE_NANOSLEEP
+#endif // _GLIBCXX_USE_NANOSLEEP
+#ifndef _GLIBCXX_USE_SCHED_YIELD
+#define _GLIBCXX_USE_SCHED_YIELD
+#endif // _GLIBCXX_USE_SCHED_YIELD
+#endif // GCC_VERSION < 40800
+
+#if GCC_VERSION < 40700
+// Those appeared in 4.7 with full c++11 support
+#define final
+#define override
+#define thread_local __thread  // use GCC extension instead of C++11
+#define steady_clock monotonic_clock
+#endif // GCC_VERSION < 40700
+
+#endif // GCC_VERSION
+
+// Variadic macros support for boost preprocessor should be enabled
+// manually for clang since they are marked as untested feature
+// (boost trunk if fixed but the latest 1.55 version is not,
+// see boost/preprocessor/config/config.hpp)
+#ifdef __clang__
+#define BOOST_PP_VARIADICS 1
+#endif
+
+// This has to be defined always when the boost has not been compiled
+// using C++11. Headers detect that you are compiling using C++11 and
+// blindly and wrongly assume that boost has been as well.
+#ifndef BOOST_NO_CXX11_SCOPED_ENUMS
+#define BOOST_NO_CXX11_SCOPED_ENUMS 1
+#endif
+
+#endif // COMMON_CONFIG_HPP
similarity index 99%
rename from common/logger/formatter.cpp
rename to libs/logger/formatter.cpp
index 529cd14..815a111 100644 (file)
@@ -22,7 +22,7 @@
  * @brief   Helper formatter for logger
  */
 
-#include "config.hpp"
+#include "logger/config.hpp"
 #include "logger/formatter.hpp"
 #include "logger/ccolor.hpp"
 
similarity index 98%
rename from common/logger/level.cpp
rename to libs/logger/level.cpp
index bf46561..3b74205 100644 (file)
@@ -22,7 +22,7 @@
  * @brief   Functions to handle LogLevel
  */
 
-#include "config.hpp"
+#include "logger/config.hpp"
 #include "logger/level.hpp"
 
 #include <stdexcept>
diff --git a/libs/logger/libLogger.pc.in b/libs/logger/libLogger.pc.in
new file mode 100644 (file)
index 0000000..f4acc69
--- /dev/null
@@ -0,0 +1,12 @@
+# Package Information for pkg-config
+
+prefix=@CMAKE_INSTALL_PREFIX@
+exec_prefix=@CMAKE_INSTALL_PREFIX@
+libdir=@LIB_INSTALL_DIR@
+includedir=@INCLUDE_INSTALL_DIR@
+
+Name: libLogger
+Description: Logger library
+Version: @_LIB_VERSION_@
+Libs: -L${libdir} -lLogger
+Cflags: -I${includedir}/vasum-tools
similarity index 98%
rename from common/logger/logger.cpp
rename to libs/logger/logger.cpp
index aa2dccd..ec0855b 100644 (file)
@@ -22,7 +22,7 @@
  * @brief   Logger
  */
 
-#include "config.hpp"
+#include "logger/config.hpp"
 #include "logger/logger.hpp"
 #include "logger/formatter.hpp"
 #include "logger/backend-null.hpp"
index bd31d68..55567c7 100644 (file)
@@ -147,11 +147,10 @@ Development package including the header files for the client library
 %defattr(644,root,root,755)
 %{_libdir}/libvasum.so
 %{_includedir}/vasum
-%{_libdir}/pkgconfig/*.pc
+%{_libdir}/pkgconfig/vasum.pc
 
 
 ## Zone Support Package ###################################################
-# TODO move to a separate repository
 %package zone-support
 Summary:          Vasum Support
 Group:            Security/Other
@@ -166,7 +165,6 @@ Zones support installed inside every zone.
 
 
 ## Zone Daemon Package ####################################################
-# TODO move to a separate repository
 %package zone-daemon
 Summary:          Vasum Zones Daemon
 Group:            Security/Other
@@ -247,3 +245,108 @@ systemctl daemon-reload
 %config /etc/dbus-1/system.d/org.tizen.vasum.tests.conf
 %{_unitdir}/vasum-socket-test.socket
 %{_unitdir}/vasum-socket-test.service
+
+## libLogger Package ###########################################################
+%package -n libLogger
+Summary:            Logger library
+Group:              Security/Other
+Requires(post):     /sbin/ldconfig
+Requires(postun):   /sbin/ldconfig
+
+%description -n libLogger
+The package provides libLogger library.
+
+%post -n libLogger -p /sbin/ldconfig
+
+%postun -n libLogger -p /sbin/ldconfig
+
+%files -n libLogger
+%defattr(644,root,root,755)
+%{_libdir}/libLogger.so.0
+%attr(755,root,root) %{_libdir}/libLogger.so.0.0.1
+
+%package -n libLogger-devel
+Summary:        Development logger library
+Group:          Development/Libraries
+Requires:       libLogger = %{version}-%{release}
+
+%description -n libLogger-devel
+The package provides libLogger development tools and libs.
+
+%files -n libLogger-devel
+%defattr(644,root,root,755)
+%{_libdir}/libLogger.so
+%{_includedir}/vasum-tools/logger
+%{_libdir}/pkgconfig/libLogger.pc
+
+## libSimpleDbus Package #######################################################
+%package -n libSimpleDbus
+Summary:            Simple dbus library
+Group:              Security/Other
+Requires(post):     /sbin/ldconfig
+Requires(postun):   /sbin/ldconfig
+
+%description -n libSimpleDbus
+The package provides libSimpleDbus library.
+
+%post -n libSimpleDbus -p /sbin/ldconfig
+
+%postun -n libSimpleDbus -p /sbin/ldconfig
+
+%files -n libSimpleDbus
+%defattr(644,root,root,755)
+%{_libdir}/libSimpleDbus.so.0
+%attr(755,root,root) %{_libdir}/libSimpleDbus.so.0.0.1
+
+%package -n libSimpleDbus-devel
+Summary:        Development Simple dbus library
+Group:          Development/Libraries
+Requires:       libSimpleDbus = %{version}-%{release}
+Requires:       pkgconfig(libLogger)
+
+%description -n libSimpleDbus-devel
+The package provides libSimpleDbus development tools and libs.
+
+%files -n libSimpleDbus-devel
+%defattr(644,root,root,755)
+%{_libdir}/libSimpleDbus.so
+%{_includedir}/vasum-tools/dbus
+%{_libdir}/pkgconfig/libSimpleDbus.pc
+
+## libConfig Package ##########################################################
+%package -n libConfig
+Summary:            Config library
+Group:              Security/Other
+Requires(post):     /sbin/ldconfig
+Requires(postun):   /sbin/ldconfig
+
+%description -n libConfig
+The package provides libConfig library.
+
+%post -n libConfig -p /sbin/ldconfig
+
+%postun -n libConfig -p /sbin/ldconfig
+
+%files -n libConfig
+%defattr(644,root,root,755)
+%{_libdir}/libConfig.so.0
+%attr(755,root,root) %{_libdir}/libConfig.so.0.0.1
+
+%package -n libConfig-devel
+Summary:        Development Config library
+Group:          Development/Libraries
+Requires:       libConfig = %{version}-%{release}
+Requires:       boost-devel
+Requires:       pkgconfig(libLogger)
+Requires:       libjson-devel
+
+%description -n libConfig-devel
+The package provides libConfig development tools and libs.
+
+%files -n libConfig-devel
+%defattr(644,root,root,755)
+%{_libdir}/libConfig.so
+%{_includedir}/vasum-tools/config
+%{_libdir}/pkgconfig/libConfig.pc
+
+
index 2dbc322..c4e0d8f 100644 (file)
@@ -30,10 +30,10 @@ ADD_EXECUTABLE(${SERVER_CODENAME} ${project_SRCS} ${common_SRCS})
 
 ## Link libraries ##############################################################
 FIND_PACKAGE(Boost COMPONENTS program_options system filesystem regex)
-PKG_CHECK_MODULES(SERVER_DEPS REQUIRED lxc json gio-2.0 libsystemd-journal libsystemd-daemon
-                  libcap-ng sqlite3)
+PKG_CHECK_MODULES(SERVER_DEPS REQUIRED lxc json gio-2.0 libsystemd-journal libsystemd-daemon libcap-ng)
 
 INCLUDE_DIRECTORIES(${COMMON_FOLDER})
+INCLUDE_DIRECTORIES(${LIBS_FOLDER})
 INCLUDE_DIRECTORIES(${CLIENT_FOLDER})
 INCLUDE_DIRECTORIES(SYSTEM ${SERVER_DEPS_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS})
 
@@ -43,7 +43,8 @@ SET_TARGET_PROPERTIES(${SERVER_CODENAME} PROPERTIES
     LINK_FLAGS "-pthread"
 )
 
-TARGET_LINK_LIBRARIES(${SERVER_CODENAME} ${SERVER_DEPS_LIBRARIES} ${Boost_LIBRARIES})
+TARGET_LINK_LIBRARIES(${SERVER_CODENAME} ${SERVER_DEPS_LIBRARIES} ${Boost_LIBRARIES}
+                      Logger Config SimpleDbus)
 
 ## Subdirectories ##############################################################
 ADD_SUBDIRECTORY(configs)
index bed7d37..20ae2f9 100644 (file)
@@ -48,9 +48,9 @@ ADD_EXECUTABLE(${SOCKET_TEST_CODENAME} ${socket_test_SRCS} ${common_SRCS})
 FIND_PACKAGE (Boost COMPONENTS unit_test_framework system filesystem regex)
 
 PKG_CHECK_MODULES(UT_SERVER_DEPS REQUIRED lxc json gio-2.0 libsystemd-daemon
-                  libsystemd-journal libcap-ng sqlite3)
+                  libsystemd-journal libcap-ng)
 INCLUDE_DIRECTORIES(${COMMON_FOLDER} ${SERVER_FOLDER} ${UNIT_TESTS_FOLDER} ${CLIENT_FOLDER}
-                    ${SOCKET_TEST_FOLDER})
+                    ${LIBS_FOLDER} ${SOCKET_TEST_FOLDER})
 INCLUDE_DIRECTORIES(SYSTEM ${UT_SERVER_DEPS_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS})
 
 SET_TARGET_PROPERTIES(${UT_SERVER_CODENAME} PROPERTIES
@@ -65,8 +65,10 @@ SET_TARGET_PROPERTIES(${SOCKET_TEST_CODENAME} PROPERTIES
     LINK_FLAGS "-pthread"
 )
 
-TARGET_LINK_LIBRARIES(${UT_SERVER_CODENAME} ${UT_SERVER_DEPS_LIBRARIES} ${Boost_LIBRARIES})
-TARGET_LINK_LIBRARIES(${SOCKET_TEST_CODENAME} ${UT_SERVER_DEPS_LIBRARIES} ${Boost_LIBRARIES})
+TARGET_LINK_LIBRARIES(${UT_SERVER_CODENAME} ${UT_SERVER_DEPS_LIBRARIES} ${Boost_LIBRARIES}
+                      Logger Config SimpleDbus)
+TARGET_LINK_LIBRARIES(${SOCKET_TEST_CODENAME} ${UT_SERVER_DEPS_LIBRARIES} ${Boost_LIBRARIES}
+                      Logger Config SimpleDbus)
 
 ## Subdirectories ##############################################################
 SET(VSM_TEST_CONFIG_INSTALL_DIR ${VSM_CONFIG_INSTALL_DIR}/tests)
index 7e7bfba..e721dbf 100644 (file)
@@ -20,9 +20,7 @@
 MESSAGE(STATUS "")
 MESSAGE(STATUS "Generating makefile for the Zone Daemon...")
 FILE(GLOB project_SRCS *.cpp *.hpp)
-FILE(GLOB common_SRCS ${COMMON_FOLDER}/dbus/*.cpp   ${COMMON_FOLDER}/dbus/*.hpp
-                      ${COMMON_FOLDER}/logger/*.cpp ${COMMON_FOLDER}/logger/*.hpp
-                      ${COMMON_FOLDER}/utils/*.cpp  ${COMMON_FOLDER}/utils/*.hpp
+FILE(GLOB common_SRCS ${COMMON_FOLDER}/utils/*.cpp  ${COMMON_FOLDER}/utils/*.hpp
                       ${COMMON_FOLDER}/*.cpp)
 
 ## Setup target ################################################################
@@ -36,6 +34,7 @@ FIND_PACKAGE (Boost COMPONENTS program_options system filesystem)
 PKG_CHECK_MODULES(ZONE_DAEMON_DEPS REQUIRED gio-2.0 libsystemd-journal libcap-ng)
 
 INCLUDE_DIRECTORIES(${COMMON_FOLDER})
+INCLUDE_DIRECTORIES(${LIBS_FOLDER})
 INCLUDE_DIRECTORIES(SYSTEM ${ZONE_DAEMON_DEPS_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS})
 
 SET_TARGET_PROPERTIES(${ZONE_DAEMON_CODENAME} PROPERTIES
@@ -43,7 +42,8 @@ SET_TARGET_PROPERTIES(${ZONE_DAEMON_CODENAME} PROPERTIES
     LINK_FLAGS "-pthread"
 )
 
-TARGET_LINK_LIBRARIES(${ZONE_DAEMON_CODENAME} ${ZONE_DAEMON_DEPS_LIBRARIES} ${Boost_LIBRARIES})
+TARGET_LINK_LIBRARIES(${ZONE_DAEMON_CODENAME} ${ZONE_DAEMON_DEPS_LIBRARIES}
+                      ${Boost_LIBRARIES} Logger SimpleDbus)
 
 
 ## Install #####################################################################