From 35ae84e72bf86544d55841a3fda9ed5e8707e0e2 Mon Sep 17 00:00:00 2001 From: Youngjae Cho Date: Fri, 17 Mar 2023 09:57:59 +0900 Subject: [PATCH] plugin-api: deviced: Add plugin-api-deviced Initialize plugin-api for deviced. It creates package plugin-api-deviced and the package contains empty library. Change-Id: I2a91b9185e4b9f0ffbe61c4d71801d20a15b0df2 Signed-off-by: Youngjae Cho --- CMakeLists.txt | 1 + packaging/libsyscommon.spec | 39 ++++++++++- src/plugin-api/deviced/CMakeLists.txt | 66 +++++++++++++++++++ .../plugin-deviced-display-interface.h | 36 ++++++++++ .../deviced/include/plugin-deviced-display.h | 36 ++++++++++ .../deviced/plugin-api-deviced.pc.in | 17 +++++ .../deviced/src/plugin-deviced-display.c | 23 +++++++ 7 files changed, 217 insertions(+), 1 deletion(-) create mode 100644 src/plugin-api/deviced/CMakeLists.txt create mode 100644 src/plugin-api/deviced/include/plugin-deviced-display-interface.h create mode 100644 src/plugin-api/deviced/include/plugin-deviced-display.h create mode 100644 src/plugin-api/deviced/plugin-api-deviced.pc.in create mode 100644 src/plugin-api/deviced/src/plugin-deviced-display.c diff --git a/CMakeLists.txt b/CMakeLists.txt index c6a6b54..d28713b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,6 +5,7 @@ INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/src) INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/src/shared) ADD_SUBDIRECTORY(src/plugin-api/common) ADD_SUBDIRECTORY(src/plugin-api/resourced) +ADD_SUBDIRECTORY(src/plugin-api/deviced) # ADD_SUBDIRECTORY(src/libgdbus) SET(PREFIX ${CMAKE_INSTALL_PREFIX}) diff --git a/packaging/libsyscommon.spec b/packaging/libsyscommon.spec index be70866..a7c8cb5 100644 --- a/packaging/libsyscommon.spec +++ b/packaging/libsyscommon.spec @@ -1,6 +1,7 @@ %define libsyscommon_version 5.0.0 %define plugin_api_common_version 0.1.0 %define plugin_api_resourced_version 0.1.0 +%define plugin_api_deviced_version 0.1.0 Name: libsyscommon Summary: System Libraries @@ -78,6 +79,26 @@ Requires: pkgconfig(dlog) %description -n plugin-api-resourced-devel Development header files for plugin APIs for the resourced. +%package -n plugin-api-deviced +Summary: Plugin APIs for the deviced +Version: %{plugin_api_deviced_version} +License: MIT + +%description -n plugin-api-deviced +Plugin APIs for the deviced. + +%package -n plugin-api-deviced-devel +Summary: Header files for plugin APIs for the deviced +Version: %{plugin_api_deviced_version} +License: MIT + +%description -n plugin-api-deviced-devel +Development header files for plugin APIs for the deviced. + + +###### + + %prep %setup -q cp %{SOURCE1001} . @@ -85,13 +106,17 @@ cp %{SOURCE1001} . %build PLUGIN_API_COMMON_MAJORVER=$(echo %{plugin_api_common_version} | cut -d'.' -f1) PLUGIN_API_RESOURCED_MAJORVER=$(echo %{plugin_api_resourced_version} | cut -d'.' -f1) +PLUGIN_API_DEVICED_MAJORVER=$(echo %{plugin_api_deviced_version} | cut -d'.' -f1) %cmake . -DFULLVER=%{libsyscommon_version} \ -DPLUGIN_API_COMMON_VERSION=%{plugin_api_common_version} \ -DPLUGIN_API_COMMON_MAJORVER=${PLUGIN_API_COMMON_MAJORVER} \ -DPLUGIN_API_RESOURCED_VERSION=%{plugin_api_resourced_version} \ -DPLUGIN_API_RESOURCED_MAJORVER=${PLUGIN_API_RESOURCED_MAJORVER} \ + -DPLUGIN_API_DEVICED_VERSION=%{plugin_api_deviced_version} \ + -DPLUGIN_API_DEVICED_MAJORVER=${PLUGIN_API_DEVICED_MAJORVER} \ -DPLUGIN_API_COMMON_ENABLE_DLOG=1 \ - -DPLUGIN_API_RESOURCED_ENABLE_DLOG=1 + -DPLUGIN_API_RESOURCED_ENABLE_DLOG=1 \ + -DPLUGIN_API_DEVICEDD_ENABLE_DLOG=1 make %{?_smp_mflags} %install @@ -158,3 +183,15 @@ popd %{_includedir}/plugin/plugin-resourced*.h %{_libdir}/pkgconfig/plugin-api-resourced.pc %{_libdir}/libplugin-api-resourced.so + +%files -n plugin-api-deviced +%defattr(-,root,root,-) +%license LICENSE.MIT +%{_libdir}/libplugin-api-deviced.so.* + +%files -n plugin-api-deviced-devel +%defattr(-,root,root,-) +%license LICENSE.MIT +%{_includedir}/plugin/plugin-deviced*.h +%{_libdir}/pkgconfig/plugin-api-deviced.pc +%{_libdir}/libplugin-api-deviced.so diff --git a/src/plugin-api/deviced/CMakeLists.txt b/src/plugin-api/deviced/CMakeLists.txt new file mode 100644 index 0000000..89ed42d --- /dev/null +++ b/src/plugin-api/deviced/CMakeLists.txt @@ -0,0 +1,66 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.6) +PROJECT(plugin-api-deviced) + +SET(PREFIX ${CMAKE_INSTALL_PREFIX}) +SET(EXEC_PREFIX "${PREFIX}/bin") +SET(LIBDIR ${LIB_INSTALL_DIR}) +SET(INCLUDEDIR "${PREFIX}/include/plugin") +SET(VERSION ${PLUGIN_API_DEVICED_VERSION}) + +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include) +# Including below should be removed if the repository of plugin-api-common is +# separated. +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../common/include) + +if (${PLUGIN_API_DEVICED_ENABLE_DLOG}) + SET(PKG_MODULES + glib-2.0 + dlog) + ADD_DEFINITIONS("-DENABLE_DLOG") + ADD_DEFINITIONS("-DLOG_TAG=\"PLUGIN_API_DEVICED\"") +else() + SET(PKG_MODULES + glib-2.0) +endif() + +INCLUDE(FindPkgConfig) +pkg_check_modules(pkgs REQUIRED ${PKG_MODULES}) +FOREACH(flag ${pkgs_CFLAGS}) + SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") +ENDFOREACH(flag) + +SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fvisibility=hidden -fPIC") +SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -g -fno-omit-frame-pointer -finstrument-functions") +SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -Wall -lrt") +SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl") +SET(CMAKE_C_FLAGS_DEBUG "-O0 -g") + +# plugin-api-common.c and plugin-api-conf.c are unnecessary if the repository of +# plugin-api-common is separated. +# Please remove them from SRCS and add 'plugin-api-common' to PKG_MODULES. +SET(SRCS src/plugin-deviced-display.c + ../common/src/plugin-api-common.c + ../common/src/plugin-api-conf.c) + +ADD_LIBRARY(${PROJECT_NAME} SHARED ${SRCS}) +TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs_LDFLAGS} + -ldl -Wl,-z,nodelete,--no-undefined) + +SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES VERSION ${PLUGIN_API_DEVICED_VERSION}) +SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES SOVERSION ${PLUGIN_API_DEVICED_MAJORVER}) + +INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${LIB_INSTALL_DIR}) +INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/ + DESTINATION ${INCLUDEDIR} + FILES_MATCHING PATTERN "*.h" +) + +# CONFIGURE .pc FILE +FOREACH(include_dirs ${pkgs_INCLUDE_DIRS}) + SET(PLUGIN_DEVICED_INCLUDEDIR "${PLUGIN_DEVICED_INCLUDEDIR} -I${include_dirs}") +ENDFOREACH(include_dirs) +FOREACH(libraries ${pkgs_LIBRARIES}) + SET(PLUGIN_DEVICED_LIBS "${PLUGIN_DEVICED_LIBS} -l${libraries}") +ENDFOREACH(libraries) +CONFIGURE_FILE(${PROJECT_NAME}.pc.in ${PROJECT_NAME}.pc @ONLY) +INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig) diff --git a/src/plugin-api/deviced/include/plugin-deviced-display-interface.h b/src/plugin-api/deviced/include/plugin-deviced-display-interface.h new file mode 100644 index 0000000..2a0c909 --- /dev/null +++ b/src/plugin-api/deviced/include/plugin-deviced-display-interface.h @@ -0,0 +1,36 @@ +/** + * MIT License + * + * Copyright (c) 2023 Samsung Electronics Co., Ltd. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is furnished + * to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#ifndef __PLUGIN_DEVICED_DISPLAY_INTERFACE_H__ +#define __PLUGIN_DEVICED_DISPLAY_INTERFACE_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef __cplusplus +} +#endif + +#endif //__PLUGIN_DEVICED_DISPLAY_INTERFACE_H__ diff --git a/src/plugin-api/deviced/include/plugin-deviced-display.h b/src/plugin-api/deviced/include/plugin-deviced-display.h new file mode 100644 index 0000000..14e5c6c --- /dev/null +++ b/src/plugin-api/deviced/include/plugin-deviced-display.h @@ -0,0 +1,36 @@ +/** + * MIT License + * + * Copyright (c) 2023 Samsung Electronics Co., Ltd. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is furnished + * to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#ifndef __PLUGIN_DEVICED_DISPLAY_H__ +#define __PLUGIN_DEVICED_DISPLAY_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef __cplusplus +} +#endif + +#endif //__PLUGIN_DEVICED_DISPLAY_H__ diff --git a/src/plugin-api/deviced/plugin-api-deviced.pc.in b/src/plugin-api/deviced/plugin-api-deviced.pc.in new file mode 100644 index 0000000..a328de4 --- /dev/null +++ b/src/plugin-api/deviced/plugin-api-deviced.pc.in @@ -0,0 +1,17 @@ +# Package Information for pkg-config +# +# Copyright (c) 2023 Samsung Electronics Co., Ltd. +# All rights reserved. +# + +prefix=@PREFIX@ +exec_prefix=@EXEC_PREFIX@ +libdir=@LIBDIR@ +includedir=@INCLUDEDIR@ + +Name: plugin-api-deviced +Description: Plugin APIs for the deviced +Version: @VERSION@ +Requires.private: plugin-api-common +Cflags: -I${includedir} @PLUGIN_DEVICED_INCLUDEDIR@ +Libs: -L${libdir} -lplugin-api-deviced @PLUGIN_DEVICED_LIBS@ diff --git a/src/plugin-api/deviced/src/plugin-deviced-display.c b/src/plugin-api/deviced/src/plugin-deviced-display.c new file mode 100644 index 0000000..f07bd13 --- /dev/null +++ b/src/plugin-api/deviced/src/plugin-deviced-display.c @@ -0,0 +1,23 @@ +/** + * MIT License + * + * Copyright (c) 2023 Samsung Electronics Co., Ltd. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is furnished + * to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ -- 2.34.1