CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
PROJECT(system_server C)
+# deviced
+SET(DEVICED_NAME deviced)
+SET(VERSION 0.1.0)
+
SET(SRCS
ss_main.c
ss_sysnoti.c
ss_vibrator.c
)
+# libdeviced
+SET(DEVICED_SRCS
+ src/shared/battery.c)
+
+SET(DEVICED_HEADERS
+ src/deviced/dd-battery.h)
+
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
+# libdeviced
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/src/deviced)
+
SET(MOVINAND_FORMAT movi_format.sh)
INCLUDE(FindPkgConfig)
SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
ENDFOREACH(flag)
+# libdeviced
+SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fvisibility=hidden")
+
SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -g -fno-omit-frame-pointer -finstrument-functions")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"")
ADD_DEFINITIONS("-DFACTORYFS=\"$ENV{FACTORYFS}\"")
-IF( $ENV{ARCH} MATCHES "arm" )
+IF( $ENV{ARCH} MATCHES "arm" )
ADD_DEFINITIONS("-DTARGET")
ENDIF()
ADD_DEFINITIONS("-DDEBUG -DENABLE_DLOG_OUT")
CONFIGURE_FILE(${UDEV_RULES}.in ${UDEV_RULES} @ONLY)
+# libdeviced
+ADD_LIBRARY(${DEVICED_NAME} SHARED ${DEVICED_SRCS})
+TARGET_LINK_LIBRARIES(${DEVICED_NAME} ${pkgs_LDFLAGS})
+SET_TARGET_PROPERTIES(${DEVICED_NAME} PROPERTIES VERSION ${VERSION})
+INSTALL(TARGETS ${DEVICED_NAME} DESTINATION lib COMPONENT RuntimeLibraries)
+
+FOREACH(hfile ${DEVICED_HEADERS})
+ INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${hfile} DESTINATION include/${DEVICED_NAME})
+ENDFOREACH(hfile)
+
+CONFIGURE_FILE(${DEVICED_NAME}.pc.in ${DEVICED_NAME}.pc @ONLY)
+INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${DEVICED_NAME}.pc DESTINATION lib/pkgconfig)
+
ADD_EXECUTABLE(${PROJECT_NAME} ${SRCS})
TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs_LDFLAGS} "-ldl")
-
INSTALL(TARGETS ${PROJECT_NAME} DESTINATION bin)
+
INSTALL(FILES ${MOVINAND_FORMAT} DESTINATION bin)
INSTALL(FILES ${UDEV_RULES} DESTINATION ${UDEV_RULES_PATH})
INSTALL(PROGRAMS ${CMAKE_BINARY_DIR}/system_server.sh DESTINATION /etc/rc.d/init.d)
Source0: system-server-%{version}.tar.gz
Source1: system-server.service
Source2: system-server.manifest
+Source3: deviced.manifest
BuildRequires: cmake
BuildRequires: libattr-devel
BuildRequires: pkgconfig(ecore)
%description
Description: System server
+%package -n libdeviced
+Summary: Deviced library
+Group: Development/Libraries
+
+%description -n libdeviced
+Deviced library for device control
+
+%package -n libdeviced-devel
+Summary: Deviced library for (devel)
+Group: Development/Libraries
+Requires: libdeviced = %{version}-%{release}
+
+%description -n libdeviced-devel
+Deviced library for device control (devel)
+
%prep
%setup -q
cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix}
%build
cp %{SOURCE2} .
+cp %{SOURCE3} .
make %{?jobs:-j%jobs}
%install
%{_datadir}/system-server/udev-rules/91-system-server.rules
%{_datadir}/system-server/sys_device_noti/res/locale/*/LC_MESSAGES/*.mo
%{_datadir}/system-server/sys_pci_noti/res/locale/*/LC_MESSAGES/*.mo
+
+%files -n libdeviced
+%defattr(-,root,root,-)
+%{_libdir}/libdeviced.so.*
+%manifest deviced.manifest
+
+%files -n libdeviced-devel
+%defattr(-,root,root,-)
+%{_includedir}/deviced/dd-battery.h
+%{_libdir}/libdeviced.so
+%{_libdir}/pkgconfig/deviced.pc
\ No newline at end of file
--- /dev/null
+/*
+ * deviced
+ * Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd.
+ *
+ * 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.
+ */
+
+
+#ifndef __LOG_H__
+#define __LOG_H__
+
+#include <stdio.h>
+
+#if defined(ENABLE_DLOG_OUT)
+#define LOG_TAG "DEVICED"
+#include <dlog.h>
+#define DLOG_ERR DLOG_ERROR
+#define __LOG(prio, fmt, arg...) \
+ do { SLOG(prio, LOG_TAG, fmt, ##arg); } while (0)
+#define __LOGD(prio, fmt, arg...) \
+ do { SLOG(prio, LOG_TAG, "%s: %s(%d) > " fmt, __MODULE__, __func__, __LINE__, ##arg); } while (0)
+#define __PRT(prio, fmt, arg...) \
+ do { fprintf(((D##prio) == DLOG_ERR ? stderr : stdout), fmt"\n", ##arg); } while (0)
+#define __PRTD(prio, fmt, arg...) \
+ do { \
+ fprintf(((D##prio) == DLOG_ERR ? stderr : stdout), \
+ "%s: %s(%d) > "fmt"\n", __MODULE__, __func__, __LINE__, ##arg); \
+ } while (0)
+#else
+#include <syslog.h>
+#define __LOG(prio, fmt, arg...) \
+ do { syslog(prio, fmt, ##arg); } while (0)
+#define __LOGD(prio, fmt, arg...) \
+ do { syslog(prio, "%s: %s(%d) > "fmt"\n", __MODULE__, __func__, __LINE__, ##arg); } while (0)
+#define __PRT(prio, fmt, arg...) \
+ do { fprintf(((prio) == LOG_ERR ? stderr : stdout), fmt"\n", ##arg); } while (0)
+#define __PRTD(prio, fmt, arg...) \
+ do { \
+ fprintf(((prio) == LOG_ERR ? stderr : stdout), \
+ "%s: %s(%d) > "fmt"\n", __MODULE__, __func__, __LINE__, ##arg); \
+ } while (0)
+#endif
+
+#ifdef DEBUG
+extern int g_trace_depth;
+#define __PRT_TRACE(prio, fmt, arg...) \
+ do { __LOGD(prio, fmt, ##arg); } while (0)
+/* do { \
+ int ___i;\
+ for(___i=0;___i<g_trace_depth;___i++)\
+ {\
+ fprintf(stdout, " "); \
+ }\
+ fprintf(stdout,\
+ "[%s:%d] "fmt"\n", __FUNCTION__, __LINE__,##arg); \
+ __LOGD(prio, fmt, ##arg); \
+ } while (0) */
+#define __PRT_TRACE_ERR(prio, fmt, arg...) \
+ do { __LOGD(prio, fmt, ##arg); } while (0)
+/* do { \
+ int ___i;\
+ for(___i=0;___i<g_trace_depth;___i++)\
+ {\
+ fprintf(stdout, " "); \
+ }\
+ printf(\
+ "%c[1;31m[%s:%d] "fmt"%c[0m\n",27, __FUNCTION__, __LINE__,##arg,27); \
+ __LOGD(prio, fmt, ##arg); \
+ } while (0)*/
+#define __PRT_TRACE_EM(prio, fmt, arg...) \
+ do { __LOGD(prio, fmt, ##arg); } while (0)
+/* do { \
+ int ___i;\
+ for(___i=0;___i<g_trace_depth;___i++)\
+ {\
+ fprintf(stdout, " "); \
+ }\
+ printf(\
+ "%c[1;34m[%s:%d] "fmt"%c[0m\n",27, __FUNCTION__, __LINE__,##arg,27); \
+ __LOGD(prio, fmt, ##arg); \
+ } while (0)*/
+#endif
+
+#define _NOUT(prio, fmt, arg...) do { } while (0)
+
+#ifdef DEBUG
+# define _LOGD __LOGD
+# define _LOG __LOGD
+# define _PRTD __PRTD
+# define _PRT __PRTD
+# define _PRT_TRACE __PRT_TRACE
+# define _PRT_TRACE_ERR __PRT_TRACE_ERR
+# define _PRT_TRACE_EM __PRT_TRACE_EM
+#else
+# define _LOGD _NOUT
+# define _LOG __LOG
+# define _PRTD _NOUT
+# define _PRT __PRT
+# define _PRT_TRACE _NOUT
+# define _PRT_TRACE_ERR _NOUT
+# define _PRT_TRACE_EM _NOUT
+#endif
+
+#define PRT_INFO(fmt, arg...) _PRT(LOG_INFO, fmt, ##arg)
+#define PRT_ERR(fmt, arg...) _PRT(LOG_ERR, fmt, ##arg)
+#define PRT_DBG(fmt, arg...) _PRTD(LOG_DEBUG, fmt, ##arg)
+#define PRT_TRACE(fmt, arg...) _PRT_TRACE(LOG_DEBUG, fmt, ##arg)
+#define PRT_TRACE_ERR(fmt, arg...) _PRT_TRACE_ERR(LOG_ERR, fmt, ##arg)
+#define PRT_TRACE_EM(fmt, arg...) _PRT_TRACE_EM(LOG_DEBUG, fmt, ##arg)
+
+#if defined(SYSLOG_OUT)
+# define SYSLOG_INFO(fmt, arg...) _LOG(LOG_INFO, fmt, ##arg)
+# define SYSLOG_ERR(fmt, arg...) _LOG(LOG_ERR, fmt, ##arg)
+# define SYSLOG_DBG(fmt, arg...) _LOGD(LOG_DEBUG, fmt, ##arg)
+# define INFO SYSLOG_INFO
+# define ERR SYSLOG_ERR
+# define DBG SYSLOG_DBG
+#elif defined(ENABLE_DLOG_OUT)
+# define INFO SLOGI
+# define ERR SLOGE
+# define DBG SLOGD
+#else
+# define INFO PRT_INFO
+# define ERR PRT_ERR
+# define DBG PRT_DBG
+#endif
+
+#endif