From 2de4cf4a1b3878d96dcebfa04d17b6ce0ac4c774 Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Thu, 11 Apr 2024 11:08:22 +0900 Subject: [PATCH] Add a dependency of aul-blink library to aul library This patch adds a missing dependency of the libaul-blink. Currently, if the library is not used, the library is not loaded forcedly by '--wl,--as-needed' option. Change-Id: Ic3939dcc096e8f2c14ab4aa3eca7cd9f3d986f3a Signed-off-by: Hwankyu Jhun --- packaging/aul.spec | 7 +++++-- src/aul/aul_launch.c | 12 +++++++----- src/blink/CMakeLists.txt | 14 ++++++++++++++ src/blink/aul-blink.pc.in | 13 +++++++++++++ src/blink/aul_blink.cc | 10 ++++++++++ src/blink/include/aul_blink.h | 30 ++++++++++++++++++++++++++++++ 6 files changed, 79 insertions(+), 7 deletions(-) create mode 100644 src/blink/aul-blink.pc.in create mode 100644 src/blink/include/aul_blink.h diff --git a/packaging/aul.spec b/packaging/aul.spec index 4e8cfc9..67044a4 100644 --- a/packaging/aul.spec +++ b/packaging/aul.spec @@ -177,7 +177,7 @@ sqlite3 .appsvc.db < ./data/appsvc_db.sql sqlite3 .component.db < ./src/parser/component/data/component_db.sql %check -export LD_LIBRARY_PATH="../../src/aul" +export LD_LIBRARY_PATH="../../src/aul:../../src/blink" ctest -V %if 0%{?gcov:1} @@ -272,7 +272,7 @@ chsmack -a 'User::Home' %{TZ_SYS_DB}/.component.db-journal %license LICENSE %manifest %{name}.manifest %attr(0644,root,root) %{_libdir}/libaul.so.* -%attr(0644,root,root) %{_libdir}/libaul-blink.so +%attr(0644,root,root) %{_libdir}/libaul-blink.so.* %config %{_sysconfdir}/dbus-1/system.d/aul.conf %{_bindir}/aulctl %{_bindir}/aul_test @@ -315,8 +315,11 @@ chsmack -a 'User::Home' %{TZ_SYS_DB}/.component.db-journal %files devel %{_includedir}/aul/*.h %{_includedir}/aul/api/*.h +%{_includedir}/aul/blink/*.h %{_libdir}/libaul.so +%{_libdir}/libaul-blink.so %{_libdir}/pkgconfig/aul.pc +%{_libdir}/pkgconfig/aul-blink.pc ################################################# # aul-gcov diff --git a/src/aul/aul_launch.c b/src/aul/aul_launch.c index fea5991..010609f 100644 --- a/src/aul/aul_launch.c +++ b/src/aul/aul_launch.c @@ -18,15 +18,16 @@ #define _GNU_SOURCE #endif -#include +#include +#include +#include +#include #include +#include #include #include -#include #include -#include -#include -#include +#include #include "aul_api.h" #include "aul_cmd.h" @@ -743,6 +744,7 @@ API int aul_launch_worker_init(void) if (__context.worker == NULL) return AUL_R_ERROR; + aul_blink_initialize(); return AUL_R_OK; } diff --git a/src/blink/CMakeLists.txt b/src/blink/CMakeLists.txt index 4fe5d30..59c5578 100644 --- a/src/blink/CMakeLists.txt +++ b/src/blink/CMakeLists.txt @@ -4,9 +4,13 @@ ADD_LIBRARY(${TARGET_AUL_BLINK} SHARED ${SRCS}) TARGET_INCLUDE_DIRECTORIES(${TARGET_AUL_BLINK} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/include ${CMAKE_CURRENT_SOURCE_DIR}/../ ) +SET_TARGET_PROPERTIES(${TARGET_AUL_BLINK} PROPERTIES SOVERSION ${MAJORVER}) +SET_TARGET_PROPERTIES(${TARGET_AUL_BLINK} PROPERTIES VERSION ${FULLVER}) + APPLY_PKG_CONFIG(${TARGET_AUL_BLINK} PUBLIC CAPI_SYSTEM_RESOURCE_DEPS DLOG_DEPS @@ -16,3 +20,13 @@ APPLY_PKG_CONFIG(${TARGET_AUL_BLINK} PUBLIC INSTALL(TARGETS ${TARGET_AUL_BLINK} DESTINATION ${LIB_INSTALL_DIR} COMPONENT RuntimeLibraries) + +CONFIGURE_FILE(aul-blink.pc.in aul-blink.pc @ONLY) +INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/aul-blink.pc + DESTINATION ${LIB_INSTALL_DIR}/pkgconfig) + +INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/ + DESTINATION include/aul/blink + FILES_MATCHING + PATTERN "*.h" +) diff --git a/src/blink/aul-blink.pc.in b/src/blink/aul-blink.pc.in new file mode 100644 index 0000000..5e9c95a --- /dev/null +++ b/src/blink/aul-blink.pc.in @@ -0,0 +1,13 @@ +# Package Information for pkg-config + +prefix=@PREFIX@ +exec_prefix=@EXEC_PREFIX@ +libdir=@LIB_INSTALL_DIR@ +includedir=@INCLUDE_INSTALL_DIR@ + +Name: libaul-blink +Description: AUL blink library +Version: @VERSION@ +Requires: dlog capi-system-resource glib-2.0 +Libs: -L${libdir} -laul-blink +Cflags: -I${includedir} -I${includedir}/aul-blink diff --git a/src/blink/aul_blink.cc b/src/blink/aul_blink.cc index 13d8e76..8b60676 100644 --- a/src/blink/aul_blink.cc +++ b/src/blink/aul_blink.cc @@ -14,6 +14,8 @@ * limitations under the License. */ +#include "aul_blink.h" + #include #include #include @@ -23,6 +25,12 @@ #include "blink/log_private.hh" +#undef EXPORT +#define EXPORT __attribute__ ((visibility("default"))) + +#undef API +#define API extern "C" EXPORT + namespace aul { constexpr const char kAulBlink[] = "AUL_BLINK"; @@ -100,3 +108,5 @@ class Blink { Blink blink; } // namespace aul + +API int aul_blink_initialize(void) { return 0; } diff --git a/src/blink/include/aul_blink.h b/src/blink/include/aul_blink.h new file mode 100644 index 0000000..8cd3610 --- /dev/null +++ b/src/blink/include/aul_blink.h @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2024 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. + */ + +#ifndef __AUL_BLINK_H__ +#define __AUL_BLINK_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +int aul_blink_initialize(void); + +#ifdef __cplusplus +} +#endif + +#endif /* __AUL_BLINK_H__ */ -- 2.7.4