Add a dependency of aul-blink library to aul library 48/309448/1
authorHwankyu Jhun <h.jhun@samsung.com>
Thu, 11 Apr 2024 02:08:22 +0000 (11:08 +0900)
committerHwankyu Jhun <h.jhun@samsung.com>
Thu, 11 Apr 2024 02:08:22 +0000 (11:08 +0900)
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 <h.jhun@samsung.com>
packaging/aul.spec
src/aul/aul_launch.c
src/blink/CMakeLists.txt
src/blink/aul-blink.pc.in [new file with mode: 0644]
src/blink/aul_blink.cc
src/blink/include/aul_blink.h [new file with mode: 0644]

index 4e8cfc9..67044a4 100644 (file)
@@ -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
index fea5991..010609f 100644 (file)
 #define _GNU_SOURCE
 #endif
 
-#include <stdio.h>
+#include <aul_blink.h>
+#include <bundle_internal.h>
+#include <ctype.h>
+#include <glib.h>
 #include <stdbool.h>
+#include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <sys/types.h>
 #include <sys/time.h>
-#include <ctype.h>
-#include <glib.h>
-#include <bundle_internal.h>
+#include <sys/types.h>
 
 #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;
 }
 
index 4fe5d30..59c5578 100644 (file)
@@ -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 (file)
index 0000000..5e9c95a
--- /dev/null
@@ -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
index 13d8e76..8b60676 100644 (file)
@@ -14,6 +14,8 @@
  * limitations under the License.
  */
 
+#include "aul_blink.h"
+
 #include <cpu-boosting.h>
 #include <glib.h>
 #include <sys/types.h>
 
 #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 (file)
index 0000000..8cd3610
--- /dev/null
@@ -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__ */