diff options
author | Jiyoung Yun <jy910.yun@samsung.com> | 2015-07-16 21:34:24 +0900 |
---|---|---|
committer | Jiyoung Yun <jy910.yun@samsung.com> | 2015-07-17 15:32:42 +0900 |
commit | d24fec5a9710c5d9b59e0ff244f4dc6f7a9c6fe4 (patch) | |
tree | 2741363dbe1c2278e202bc406a426bc1aa6511d8 | |
parent | e7e90889c685290267e16b4781be8d1d993679b5 (diff) | |
download | deviced-d24fec5a9710c5d9b59e0ff244f4dc6f7a9c6fe4.tar.gz deviced-d24fec5a9710c5d9b59e0ff244f4dc6f7a9c6fe4.tar.bz2 deviced-d24fec5a9710c5d9b59e0ff244f4dc6f7a9c6fe4.zip |
deviced: Add cmake macro to add source file and install conf file
It will be useful for deviced developers to manage source code and conf file.
ADD_SOURCE macro will contain whole source code in a specificed directory
except for other profile's files.
INSTALL_CONF macro will install a proper conf file as per profile.
Change-Id: I57bcc7c3f423f8564dcb92f2ad5a19d808b7a957
Signed-off-by: Jiyoung Yun <jy910.yun@samsung.com>
-rwxr-xr-x | CMakeLists.txt | 204 | ||||
-rw-r--r--[-rwxr-xr-x] | packaging/deviced.spec | 123 | ||||
-rwxr-xr-x | src/CMakeLists.txt | 3 | ||||
-rw-r--r-- | src/display/dpms-wayland-none.c (renamed from src/display/dpms-wayland.c) | 0 | ||||
-rw-r--r-- | src/display/dpms-x-none.c (renamed from src/display/dpms-x.c) | 0 | ||||
-rw-r--r-- | src/fsck-msdos/CMakeLists.txt | 1 | ||||
-rw-r--r-- | src/usbhost/usb-host.c (renamed from src/usb/usb-host.c) | 0 |
7 files changed, 183 insertions, 148 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 28a17197..9bad1bca 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,6 +11,39 @@ ELSEIF("${ARCH}" STREQUAL "arm") ENDIF() ######################################################## +# Deviced Macros +######################################################## +MACRO(ADD_SOURCE DIR OUT) + FILE(GLOB ALL_SRCS "${DIR}/*.c") + FOREACH(SRC ${ALL_SRCS}) + IF(NOT ${SRC} MATCHES "ivi|mobile|wearable|tv|none") + SET(D_SRCS ${D_SRCS} ${SRC}) + ENDIF() + ENDFOREACH() + FILE(GLOB S_SRCS "${DIR}/*-${PROFILE}.c") + IF(DEFINED S_SRCS) + SET(D_SRCS ${D_SRCS} ${S_SRCS}) + ENDIF() + SET(${OUT} ${D_SRCS}) +ENDMACRO() + +MACRO(INSTALL_CONF DIR CONF) + SET(T_CONF ${DIR}/${CONF}-${PROFILE}.conf) + SET(E_CONF ${DIR}/${CONF}-emul-${PROFILE}.conf) + IF(USE_EMULATOR AND EXISTS ${E_CONF}) + SET(T_CONF ${E_CONF}) + ENDIF() + IF(NOT EXISTS ${T_CONF}) + SET(T_CONF ${DIR}/${CONF}.conf) + ENDIF() + IF(DEFINED T_CONF) + INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${T_CONF} + DESTINATION /etc/deviced + RENAME ${CONF}.conf) + ENDIF() +ENDMACRO() + +######################################################## # Deviced CMakeLists.txt ######################################################## SET(PREFIX ${CMAKE_INSTALL_PREFIX}) @@ -21,12 +54,9 @@ SET(CONFDIR "/etc/${PROJECT_NAME}") SET(VERSION 0.1.0) SET(SRCS - src/block/block.c - src/block/ext4.c - src/block/vfat.c + src/control/control.c src/core/common.c src/core/config-parser.c - src/control/control.c src/core/device-idler.c src/core/device-notifier.c src/core/devices.c @@ -37,83 +67,63 @@ SET(SRCS src/core/main.c src/core/sig-handler.c src/core/udev.c - src/extcon/cradle.c - src/extcon/earjack.c - src/extcon/extcon.c - src/extcon/hdmi.c - src/gpio/gpio.c - src/power/power-handler.c src/proc/cpu-info.c src/proc/proc-handler.c src/time/time-handler.c ) -SET(SRCS ${SRCS} - src/usb/usb.c - src/usb/usb-default.c - src/usb/usb-host.c -) +IF(BATTERY_MODULE STREQUAL on) + ADD_SOURCE(src/battery BATTERY_SRCS) + SET(SRCS ${SRCS} ${BATTERY_SRCS}) +ENDIF() -IF(TIZEN_BUZZER) -SET(SRCS ${SRCS} - src/gpio/buzzer.c) -ENDIF(TIZEN_BUZZER) - -SET(SRCS ${SRCS} - src/battery/battery-time.c - src/battery/config.c - src/battery/lowbat-handler.c - src/battery/power-supply.c - ) - -IF(TIZEN_HALL) -SET(SRCS ${SRCS} - src/gpio/hall.c) -ENDIF(TIZEN_HALL) - -IF(TIZEN_SIM) -SET(SRCS ${SRCS} - src/gpio/sim.c) -ENDIF(TIZEN_SIM) - -IF(TIZEN_DISPLAY) -SET(SRCS ${SRCS} - src/display/auto-brightness.c - src/display/brightness.c - src/display/core.c - src/display/device-interface.c - src/display/display-actor.c - src/display/display-dbus.c - src/display/display-ops.c - src/display/key-filter.c - src/display/lock-detector.c - src/display/poll.c - src/display/setting.c - src/display/input.c -) +IF(BLOCK_MODULE STREQUAL on) + ADD_SOURCE(src/block BLOCK_SRCS) + SET(SRCS ${SRCS} ${BLOCK_SRCS}) +ENDIF() -IF("${DPMS}" STREQUAL "x") -SET(SRCS ${SRCS} - src/display/dpms-x.c) -ELSEIF("${DPMS}" STREQUAL "wayland") -SET(SRCS ${SRCS} - src/display/dpms-wayland.c) +IF(EXTCON_MODULE STREQUAL on) + ADD_SOURCE(src/extcon EXTCON_SRCS) + SET(SRCS ${SRCS} ${EXTCON_SRCS}) ENDIF() -ENDIF(TIZEN_DISPLAY) +IF(HAPTIC_MODULE STREQUAL on) + ADD_SOURCE(src/haptic HAPTIC_SRCS) + SET(SRCS ${SRCS} ${HAPTIC_SRCS}) +ENDIF() -SET(SRCS ${SRCS} - src/led/ir.c - src/led/noti.c - src/led/torch.c - src/led/touch-key.c -) +IF(LED_MODULE STREQUAL on) + ADD_SOURCE(src/led LED_SRCS) + SET(SRCS ${SRCS} ${LED_SRCS}) +ENDIF() -SET(SRCS ${SRCS} - src/haptic/haptic.c - src/haptic/external.c - src/haptic/standard.c - src/haptic/emulator.c) +IF(POWER_MODULE STREQUAL on) + ADD_SOURCE(src/power POWER_SRCS) + SET(SRCS ${SRCS} ${POWER_SRCS}) +ENDIF() + +IF(DISPLAY_MODULE STREQUAL on) + ADD_SOURCE(src/display DISPLAY_SRCS) + SET(SRCS ${SRCS} ${DISPLAY_SRCS}) + + IF("${DPMS}" STREQUAL "x") + SET(SRCS ${SRCS} src/display/dpms-x-none.c) + ELSEIF("${DPMS}" STREQUAL "wayland") + SET(SRCS ${SRCS} src/display/dpms-wayland-none.c) + ENDIF() +ENDIF() + +# usb client +IF(${USB_MODULE} STREQUAL on) + ADD_SOURCE(src/usb USB_SRCS) + SET(SRCS ${SRCS} ${USB_SRCS}) +ENDIF() + +# usb host +IF(${USBHOST_MODULE} STREQUAL on) + ADD_SOURCE(src/usbhost USBHOST_SRCS) + SET(SRCS ${SRCS} ${USBHOST_SRCS}) +ENDIF() INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}) INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/src) @@ -124,21 +134,22 @@ SET(PKG_MODULES edbus vconf dlog + libudev device-node capi-base-common - sensor - tapi libtzplatform-config notification hwcommon - libinput ) -IF("${DPMS}" STREQUAL "x") -SET(PKG_MODULES ${PKG_MODULES} - x11 - xext -) +IF(DISPLAY_MODULE STREQUAL on) + IF("${DPMS}" STREQUAL "x") + SET(PKG_MODULES ${PKG_MODULES} x11 xext) + ENDIF() + SET(PKG_MODULES ${PKG_MODULES} libinput sensor) +ENDIF() +IF(TELEPHONY_MODULE STREQUAL on) + SET(PKG_MODULES ${PKG_MODULES} tapi) ENDIF() INCLUDE(FindPkgConfig) @@ -151,7 +162,6 @@ ENDFOREACH(flag) 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} -lrt") -MESSAGE("FLAGS: ${CMAKE_C_FLAGS}") ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"") ADD_DEFINITIONS("-DFACTORYFS=\"$ENV{FACTORYFS}\"") @@ -167,7 +177,7 @@ ENDIF() ADD_DEFINITIONS("-DDEBUG") ADD_EXECUTABLE(${PROJECT_NAME} ${SRCS}) -TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs_LDFLAGS} "-ldl" "-lm" "-ludev" "-ledbus" shared) +TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs_LDFLAGS} "-ldl" "-lm" shared) INSTALL(TARGETS ${PROJECT_NAME} DESTINATION bin) INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/src/deviced/ DESTINATION include/${PROJECT_NAME} @@ -175,31 +185,39 @@ INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/src/deviced/ DESTINATION include/$ PATTERN "*_doc.h" EXCLUDE PATTERN "*.h") -CONFIGURE_FILE(${PROJECT_NAME}.pc.in ${PROJECT_NAME}.pc @ONLY) -INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig) +IF(BLOCK_MODULE STREQUAL on) + INSTALL_CONF(src/block block) + INSTALL(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/scripts/mmc-smack-label DESTINATION bin) +ENDIF() + +# USB connection +IF(${USB_MODULE} STREQUAL on) + INSTALL_CONF(src/usb usb-setting) + INSTALL_CONF(src/usb usb-operation) + + # USB (Manual setting) + INSTALL(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/scripts/direct_set_debug.sh DESTINATION bin) +ENDIF() INSTALL(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/scripts/deviced-pre.sh DESTINATION bin) +INSTALL(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/scripts/movi_format.sh DESTINATION bin) INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/scripts/deviced.conf DESTINATION /etc/dbus-1/system.d) -INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/scripts/movi_format.sh DESTINATION bin) -INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/block/block.conf DESTINATION /etc/deviced) -INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/usb/usb-setting.conf DESTINATION /etc/deviced) -INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/usb/usb-operation.conf DESTINATION /etc/deviced) -INSTALL(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/scripts/mmc-smack-label DESTINATION bin) -INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/fsck-msdos/LICENSE DESTINATION share/license RENAME fsck_msdosfs) -# USB (Manual setting) -INSTALL(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/scripts/direct_set_debug.sh DESTINATION bin) +CONFIGURE_FILE(${PROJECT_NAME}.pc.in ${PROJECT_NAME}.pc @ONLY) +INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig) INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/systemd/ DESTINATION lib/systemd/system FILES_MATCHING PATTERN "*.service" PATTERN "*.socket") -ADD_SUBDIRECTORY(src) +ADD_SUBDIRECTORY(src/shared) ADD_SUBDIRECTORY(src/libdeviced) -ADD_SUBDIRECTORY(src/fsck-msdos) -ADD_SUBDIRECTORY(src/newfs-msdos) ADD_SUBDIRECTORY(src/devicectl) +IF(BLOCK_MODULE STREQUAL on) + ADD_SUBDIRECTORY(src/fsck-msdos) + ADD_SUBDIRECTORY(src/newfs-msdos) +ENDIF() ADD_SUBDIRECTORY(src/libsysman) ADD_SUBDIRECTORY(src/libslp-pm) ADD_SUBDIRECTORY(src/libhaptic) diff --git a/packaging/deviced.spec b/packaging/deviced.spec index bdf92092..62989f7c 100755..100644 --- a/packaging/deviced.spec +++ b/packaging/deviced.spec @@ -1,21 +1,41 @@ -#These options are ACTIVATED by default. -%bcond_without display - #These options are DEACTIVATED by default. %bcond_with x %bcond_with wayland -%bcond_with buzzer -%bcond_with hall -%bcond_with sim -%bcond_with usb +# display, extcon, power, usb are always enable +%define battery_module off +%define block_module off +%define display_module on +%define extcon_module on +%define haptic_module off +%define led_module off +%define power_module on +%define telephony_module off +%define usb_module on +%define usbhost_module off + +%if "%{?profile}" == "mobile" +%define battery_module on +%define block_module on +%define haptic_module on +%define led_module on +%define telephony_module on +%endif +%if "%{?profile}" == "wearable" +%define battery_module on +%define haptic_module on +%define telephony_module on +%endif +%if "%{?profile}" == "tv" +%define block_module on +%endif Name: deviced Summary: Deviced Version: 1.0.0 Release: 1 -Group: Framework/system +Group: System/Management License: Apache-2.0 Source0: %{name}-%{version}.tar.gz Source1: deviced.manifest @@ -27,34 +47,31 @@ Source6: devman.manifest BuildRequires: cmake BuildRequires: libattr-devel +BuildRequires: gettext-devel BuildRequires: pkgconfig(ecore) BuildRequires: pkgconfig(vconf) -BuildRequires: pkgconfig(tapi) -BuildRequires: pkgconfig(edbus) BuildRequires: pkgconfig(dlog) -BuildRequires: pkgconfig(syspopup-caller) -%if %{with x} -BuildRequires: pkgconfig(x11) -BuildRequires: pkgconfig(xext) -%endif -BuildRequires: pkgconfig(udev) BuildRequires: pkgconfig(device-node) -BuildRequires: pkgconfig(libsmack) -BuildRequires: pkgconfig(sensor) -BuildRequires: gettext -BuildRequires: pkgconfig(libsystemd-daemon) +BuildRequires: pkgconfig(edbus) BuildRequires: pkgconfig(capi-base-common) -BuildRequires: pkgconfig(dbus-1) +BuildRequires: pkgconfig(libudev) BuildRequires: pkgconfig(libtzplatform-config) BuildRequires: pkgconfig(notification) BuildRequires: pkgconfig(hwcommon) +%if %{?display_module} == on +%if %{with x} +BuildRequires: pkgconfig(x11) +BuildRequires: pkgconfig(xext) +%endif BuildRequires: pkgconfig(libinput) +BuildRequires: pkgconfig(sensor) +%endif +%if %{?telephony_module} == on +BuildRequires: pkgconfig(tapi) +%endif %{?systemd_requires} -Requires(preun): /usr/bin/systemctl -Requires(post): /usr/bin/systemctl Requires(post): /usr/bin/vconftool -Requires(postun): /usr/bin/systemctl %description deviced @@ -67,7 +84,7 @@ Group: main deviced daemon. %package tools -Summary: deviced tools +Summary: Deviced tools Group: System/Utilities Requires: %{name} = %{version}-%{release} @@ -188,7 +205,7 @@ Haptic Device manager library for device control (devel) %define ARCH emulator %endif -%define DPMS +%define DPMS none %if %{with x} %define DPMS x %endif @@ -201,21 +218,17 @@ Haptic Device manager library for device control (devel) -DCMAKE_INSTALL_PREFIX=%{_prefix} \ -DARCH=%{ARCH} \ -DDPMS=%{DPMS} \ -%if %{with buzzer} - -DTIZEN_BUZZER:BOOL=ON \ -%endif -%if %{with display} - -DTIZEN_DISPLAY:BOOL=ON \ -%endif -%if %{with hall} - -DTIZEN_HALL:BOOL=ON \ -%endif -%if %{with sim} - -DTIZEN_SIM:BOOL=ON \ -%endif -%if %{with usb} - -DTIZEN_USB:BOOL=ON \ -%endif + -DPROFILE=%{profile} \ + -DBATTERY_MODULE=%{battery_module} \ + -DBLOCK_MODULE=%{block_module} \ + -DDISPLAY_MODULE=%{display_module} \ + -DEXTCON_MODULE=%{extcon_module} \ + -DHAPTIC_MODULE=%{haptic_module} \ + -DLED_MODULE=%{led_module} \ + -DPOWER_MODULE=%{power_module} \ + -DTELEPHONY_MODULE=%{telephony_module} \ + -DUSB_MODULE=%{usb_module} \ + -DUSBHOST_MODULE=%{usbhost_module} \ #eol %build @@ -266,13 +279,13 @@ vconftool set -t int memory/pm/current_brt 60 -i -g "$users_gid" systemctl daemon-reload if [ "$1" == "1" ]; then systemctl restart deviced.service - systemctl restart zbooting-done.service + systemctl restart zbooting-done.service fi %preun if [ "$1" == "0" ]; then systemctl stop deviced.service - systemctl stop zbooting-done.service + systemctl stop zbooting-done.service fi %postun @@ -305,14 +318,6 @@ systemctl daemon-reload %{_bindir}/deviced-pre.sh %{_bindir}/deviced %{_bindir}/movi_format.sh -%{_sysconfdir}/deviced/block.conf -%{_sysconfdir}/deviced/usb-setting.conf -%{_sysconfdir}/deviced/usb-operation.conf -%{_bindir}/mmc-smack-label -%{_bindir}/fsck_msdosfs -%{_bindir}/newfs_msdos -%{_datadir}/license/fsck_msdosfs -%{_datadir}/license/newfs_msdos %{_unitdir}/multi-user.target.wants/deviced.service %{_unitdir}/sockets.target.wants/deviced.socket %{_unitdir}/graphical.target.wants/zbooting-done.service @@ -320,16 +325,30 @@ systemctl daemon-reload %{_unitdir}/deviced.socket %{_unitdir}/deviced-pre.service %{_unitdir}/zbooting-done.service +%if %{?block_module} == on +%{_bindir}/mmc-smack-label +%{_bindir}/fsck_msdosfs +%{_bindir}/newfs_msdos +%{_datadir}/license/fsck_msdosfs +%{_datadir}/license/newfs_msdos +%config %{_sysconfdir}/deviced/block.conf +%endif +%if %{?usb_module} == on +%config %{_sysconfdir}/deviced/usb-setting.conf +%config %{_sysconfdir}/deviced/usb-operation.conf +%endif %files tools %manifest %{name}.manifest %{_bindir}/devicectl +%if %{?usb_module} == on %{_bindir}/direct_set_debug.sh +%endif %files -n libdeviced +%manifest deviced.manifest %defattr(-,root,root,-) %{_libdir}/libdeviced.so.* -%manifest deviced.manifest %files -n libdeviced-devel %defattr(-,root,root,-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt deleted file mode 100755 index c17e8b81..00000000 --- a/src/CMakeLists.txt +++ /dev/null @@ -1,3 +0,0 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 2.6) - -ADD_SUBDIRECTORY(shared) diff --git a/src/display/dpms-wayland.c b/src/display/dpms-wayland-none.c index 52b0ea66..52b0ea66 100644 --- a/src/display/dpms-wayland.c +++ b/src/display/dpms-wayland-none.c diff --git a/src/display/dpms-x.c b/src/display/dpms-x-none.c index 5acdd2ec..5acdd2ec 100644 --- a/src/display/dpms-x.c +++ b/src/display/dpms-x-none.c diff --git a/src/fsck-msdos/CMakeLists.txt b/src/fsck-msdos/CMakeLists.txt index 86d35f53..c1169340 100644 --- a/src/fsck-msdos/CMakeLists.txt +++ b/src/fsck-msdos/CMakeLists.txt @@ -35,3 +35,4 @@ ADD_EXECUTABLE(${PROJECT_NAME} ${SRCS}) TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs_LDFLAGS}) INSTALL(TARGETS ${PROJECT_NAME} DESTINATION bin) +INSTALL(FILES LICENSE DESTINATION share/license RENAME ${PROJECT_NAME}) diff --git a/src/usb/usb-host.c b/src/usbhost/usb-host.c index 201db1f4..201db1f4 100644 --- a/src/usb/usb-host.c +++ b/src/usbhost/usb-host.c |