From 967463983c504940fca928338c99f245f148f23c Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Fri, 7 Aug 2020 15:49:46 +0900 Subject: [PATCH 01/16] Release version 0.15.15 Changes: - Fix client pid check Change-Id: I75c21585d3379a59be25e9e2b732f1422a217f33 Signed-off-by: Hwankyu Jhun --- packaging/launchpad.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/launchpad.spec b/packaging/launchpad.spec index 41af01e..8b02454 100644 --- a/packaging/launchpad.spec +++ b/packaging/launchpad.spec @@ -1,6 +1,6 @@ Name: launchpad Summary: Launchpad for launching applications -Version: 0.15.14 +Version: 0.15.15 Release: 1 Group: Application Framework/Daemons License: Apache-2.0 -- 2.7.4 From ade3ffee277cf050df19c4aa2524fe7c3e202062 Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Mon, 10 Aug 2020 09:34:05 +0900 Subject: [PATCH 02/16] Add worker thread for cleanup app To avoid blocking launchpad, a new worker thread is added for calling security_manager_cleanup_app(). While installing / uninstalling / updating the package, security-manager daemon can be blocked. If launchpad calls security_manager_cleanup_app() at that time, launchpad will be blocked. Change-Id: I1e88ec38f61eabe21afa754f39f511606c85f148 Signed-off-by: Hwankyu Jhun --- src/launchpad/inc/launchpad_worker.h | 38 +++++++++ src/launchpad/src/launchpad.c | 69 ++++++++++++++- src/launchpad/src/launchpad_worker.c | 161 +++++++++++++++++++++++++++++++++++ 3 files changed, 265 insertions(+), 3 deletions(-) create mode 100644 src/launchpad/inc/launchpad_worker.h create mode 100644 src/launchpad/src/launchpad_worker.c diff --git a/src/launchpad/inc/launchpad_worker.h b/src/launchpad/inc/launchpad_worker.h new file mode 100644 index 0000000..cee3000 --- /dev/null +++ b/src/launchpad/inc/launchpad_worker.h @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2020 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 __LAUNCHPAD_WORKER_H__ +#define __LAUNCHPAD_WORKER_H__ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef bool (*worker_job_cb)(void *user_data); + +int _worker_add_job(worker_job_cb callback, void *user_data); + +int _worker_init(void); + +void _worker_fini(void); + +#ifdef __cplusplus +} +#endif + +#endif /* __LAUNCHPAD_WORKER_H__ */ diff --git a/src/launchpad/src/launchpad.c b/src/launchpad/src/launchpad.c index 804aa23..b74dbb2 100644 --- a/src/launchpad/src/launchpad.c +++ b/src/launchpad/src/launchpad.c @@ -54,6 +54,7 @@ #include "launchpad_proc.h" #include "launchpad_signal.h" #include "launchpad_types.h" +#include "launchpad_worker.h" #include "loader_info.h" #include "perf.h" @@ -159,6 +160,11 @@ struct app_info { bool exists; }; +struct cleanup_info_s { + char *appid; + int pid; +}; + static int __sys_hwacc; static GList *loader_info_list; static GList *app_defined_loader_info_list; @@ -1510,16 +1516,68 @@ static bool __handle_hydra_event(int fd, io_condition_e cond, void *data) return true; } +static void __destroy_cleanup_info(struct cleanup_info_s *info) +{ + if (!info) + return; + + free(info->appid); + free(info); +} + +static struct cleanup_info_s *__create_cleanup_info(const char *appid, int pid) +{ + struct cleanup_info_s *info; + + info = malloc(sizeof(struct cleanup_info_s)); + if (!info) { + _E("Out of memory"); + return NULL; + } + + info->appid = strdup(appid); + if (!info->appid) { + _E("strdup(%s) is failed", appid); + __destroy_cleanup_info(info); + return NULL; + } + + info->pid = pid; + + return info; +} + +static bool __cleanup_app_cb(void *user_data) +{ + struct cleanup_info_s *info = (struct cleanup_info_s *)user_data; + + _W("security_manager_cleanup_app() ++"); + security_manager_cleanup_app(info->appid, getuid(), info->pid); + _W("security_manager_cleanup_app() --"); + __destroy_cleanup_info(info); + return false; +} + static void __handle_sigchild(int pid, void *user_data) { candidate_process_context_t *cpc; + struct cleanup_info_s *info; char *appid; + int ret = -1; appid = g_hash_table_lookup(__pid_table, GINT_TO_POINTER(pid)); if (appid) { - _W("security_manager_cleanup_app() ++"); - security_manager_cleanup_app(appid, getuid(), pid); - _W("security_manager_cleanup_app() --"); + info = __create_cleanup_info(appid, pid); + if (info) + ret = _worker_add_job(__cleanup_app_cb, info); + + if (ret != 0) { + __destroy_cleanup_info(info); + _W("security_manager_cleanup_app() ++"); + security_manager_cleanup_app(appid, getuid(), pid); + _W("security_manager_cleanup_app() --"); + } + g_hash_table_remove(__pid_table, GINT_TO_POINTER(pid)); } @@ -3077,6 +3135,10 @@ static int __before_loop(int argc, char **argv) return -1; } + ret = _worker_init(); + if (ret < 0) + return ret; + __register_vconf_events(); __init_app_defined_loader_monitor(); _memory_monitor_init(); @@ -3091,6 +3153,7 @@ static void __after_loop(void) _log_fini(); _memory_monitor_fini(); __unregister_vconf_events(); + _worker_fini(); if (__pid_table) g_hash_table_destroy(__pid_table); diff --git a/src/launchpad/src/launchpad_worker.c b/src/launchpad/src/launchpad_worker.c new file mode 100644 index 0000000..3f600d7 --- /dev/null +++ b/src/launchpad/src/launchpad_worker.c @@ -0,0 +1,161 @@ +/* + * Copyright (c) 2020 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. + */ + +#define _GNU_SOURCE +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "launchpad_worker.h" +#include "log_private.h" + +struct job_s { + worker_job_cb callback; + void *user_data; +}; + +struct worker_s { + GThread *thread; + GMutex mutex; + GCond cond; + GQueue *queue; +}; + +static struct worker_s __worker; + +int _worker_add_job(worker_job_cb callback, void *user_data) +{ + struct job_s *job; + + if (!callback) { + _E("Invalid parameter"); + return -EINVAL; + } + + job = malloc(sizeof(struct job_s)); + if (!job) { + _E("Out of memory"); + return -ENOMEM; + } + + job->callback = callback; + job->user_data = user_data; + + g_mutex_lock(&__worker.mutex); + g_queue_push_tail(__worker.queue, job); + g_cond_signal(&__worker.cond); + g_mutex_unlock(&__worker.mutex); + + return 0; +} + +static int __set_comm(const char *name) +{ + int fd; + ssize_t bytes_written; + char path[PATH_MAX]; + pid_t tid = syscall(__NR_gettid); + + _I("[%s] TID(%d)", name, tid); + snprintf(path, sizeof(path), "/proc/%d/comm", tid); + fd = open(path, O_WRONLY); + if (fd < 0) { + _E("Failed to open %s. error(%d)", path, errno); + return -1; + } + + bytes_written = write(fd, name, strlen(name) + 1); + if (bytes_written < 0) { + _E("Failed to write name(%s)", name); + close(fd); + return -1; + } + + close(fd); + return 0; +} + +static gpointer __worker_thread_cb(gpointer data) +{ + struct worker_s *worker = (struct worker_s *)data; + struct job_s *job; + bool done = false; + + __set_comm("worker"); + do { + g_mutex_lock(&worker->mutex); + if (g_queue_is_empty(worker->queue)) + g_cond_wait(&worker->cond, &worker->mutex); + + job = (struct job_s *)g_queue_pop_head(worker->queue); + g_mutex_unlock(&worker->mutex); + done = job->callback(job->user_data); + free(job); + } while (!done); + + return NULL; +} + +int _worker_init(void) +{ + _W("WORKER_INIT"); + + g_mutex_init(&__worker.mutex); + g_cond_init(&__worker.cond); + + __worker.queue = g_queue_new(); + if (!__worker.queue) { + _E("g_queue_new() is failed"); + return -ENOMEM; + } + + __worker.thread = g_thread_new("worker", __worker_thread_cb, &__worker); + if (!__worker.thread) { + _E("g_thread_new() is failed"); + return -ENOMEM; + } + + return 0; +} + +static bool __worker_done_cb(void *user_data) +{ + _W("Done"); + return true; +} + +void _worker_fini(void) +{ + _W("WORKER_FINI"); + + if (__worker.thread) { + _worker_add_job(__worker_done_cb, NULL); + g_thread_join(__worker.thread); + } + + if (__worker.queue) + g_queue_free_full(__worker.queue, (GDestroyNotify)free); + + g_cond_clear(&__worker.cond); + g_mutex_clear(&__worker.mutex); +} -- 2.7.4 From 595f745eb89b3e890e741c44d6f736e506755b83 Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Mon, 10 Aug 2020 10:58:39 +0900 Subject: [PATCH 03/16] Release version 0.15.16 Changes: - Add worker thread for cleanup app Change-Id: I4df5b28af75beffc299bb80fa140acc87b43ca87 Signed-off-by: Hwankyu Jhun --- packaging/launchpad.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/launchpad.spec b/packaging/launchpad.spec index 8b02454..233d3e8 100644 --- a/packaging/launchpad.spec +++ b/packaging/launchpad.spec @@ -1,6 +1,6 @@ Name: launchpad Summary: Launchpad for launching applications -Version: 0.15.15 +Version: 0.15.16 Release: 1 Group: Application Framework/Daemons License: Apache-2.0 -- 2.7.4 From b38769af5376cf46e3bdb329d184a815216ad5fb Mon Sep 17 00:00:00 2001 From: Changgyu Choi Date: Thu, 13 Aug 2020 19:03:10 +0900 Subject: [PATCH 04/16] Fix memory leak Change-Id: Iacde7fe8fe768c39def208e017a89e619b635ab2 Signed-off-by: Changgyu Choi --- src/launchpad/src/launchpad.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/launchpad/src/launchpad.c b/src/launchpad/src/launchpad.c index 6e9864d..0c7bc85 100644 --- a/src/launchpad/src/launchpad.c +++ b/src/launchpad/src/launchpad.c @@ -1805,11 +1805,11 @@ static int __dispatch_cmd_add_app_defined_loader(bundle *kb) return -EINVAL; } - bundle_encode(info->extra, &extra, &len); cpc = __find_slot_from_loader_name(loader_name); if (cpc == NULL) { lid = __make_loader_id(); + bundle_encode(info->extra, &extra, &len); cpc = __add_slot(LAUNCHPAD_LOADER_TYPE_DYNAMIC, lid, 0, loader_name, "/usr/bin/app-defined-loader", (const char *)extra, METHOD_TIMEOUT | METHOD_VISIBILITY, @@ -1823,6 +1823,8 @@ static int __dispatch_cmd_add_app_defined_loader(bundle *kb) true, false, true); + + free(extra); if (cpc == NULL) { _E("cpc is NULL"); bundle_free_encoded_rawdata(&extra); @@ -2689,6 +2691,8 @@ static void __add_slot_from_info(gpointer data, gpointer user_data) info->app_exists, info->is_hydra, info->app_check); + + free(extra); if (cpc == NULL) return; -- 2.7.4 From 3c3fe16905321cd744c4b2f397d4daf38cc9e94b Mon Sep 17 00:00:00 2001 From: Changgyu Choi Date: Fri, 14 Aug 2020 09:19:11 +0900 Subject: [PATCH 05/16] Fix double free Change-Id: I42d55f853c852d73667de28d7665341023f9103c Signed-off-by: Changgyu Choi --- src/launchpad/src/launchpad.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/launchpad/src/launchpad.c b/src/launchpad/src/launchpad.c index c3ec424..ef73a44 100644 --- a/src/launchpad/src/launchpad.c +++ b/src/launchpad/src/launchpad.c @@ -1882,10 +1882,9 @@ static int __dispatch_cmd_add_app_defined_loader(bundle *kb) false, true); - free(extra); + bundle_free_encoded_rawdata(&extra); if (cpc == NULL) { _E("cpc is NULL"); - bundle_free_encoded_rawdata(&extra); return -ENOMEM; } } else { @@ -2750,7 +2749,7 @@ static void __add_slot_from_info(gpointer data, gpointer user_data) info->is_hydra, info->app_check); - free(extra); + bundle_free_encoded_rawdata(&extra); if (cpc == NULL) return; -- 2.7.4 From b04752a3e03b2babd60af81e5d6a3a66cf03a1fa Mon Sep 17 00:00:00 2001 From: Changgyu Choi Date: Fri, 14 Aug 2020 09:36:21 +0900 Subject: [PATCH 06/16] Release version 0.15.17 Changes: - Fix memory leak - Fix double free Change-Id: I28896bfe7c58075e384c4ca70d6a03a5f531f72b Signed-off-by: Changgyu Choi --- packaging/launchpad.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/launchpad.spec b/packaging/launchpad.spec index 233d3e8..924bdae 100644 --- a/packaging/launchpad.spec +++ b/packaging/launchpad.spec @@ -1,6 +1,6 @@ Name: launchpad Summary: Launchpad for launching applications -Version: 0.15.16 +Version: 0.15.17 Release: 1 Group: Application Framework/Daemons License: Apache-2.0 -- 2.7.4 From c74a60463c77c7edc9649407d4c8d9bfd2eb765b Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Fri, 14 Aug 2020 10:39:54 +0900 Subject: [PATCH 07/16] Remove unused codes Change-Id: I55b92d53e6824866d3cf0143c514407c924faf4e Signed-off-by: Hwankyu Jhun --- src/common/inc/launchpad_common.h | 1 - src/launchpad/src/launchpad.c | 1 - 2 files changed, 2 deletions(-) diff --git a/src/common/inc/launchpad_common.h b/src/common/inc/launchpad_common.h index 0850aed..2b1d41c 100644 --- a/src/common/inc/launchpad_common.h +++ b/src/common/inc/launchpad_common.h @@ -53,7 +53,6 @@ #define LAUNCHPAD_LAUNCH_SIGNAL 83 #define LAUNCHPAD_DEAD_SIGNAL 61 #define APP_STARTUP_SIGNAL 89 -#define LAUNCHPAD_CHILD_PROCESS 130 #define PAD_LOADER_ID_STATIC 0 #define PAD_LOADER_ID_DIRECT 1 diff --git a/src/launchpad/src/launchpad.c b/src/launchpad/src/launchpad.c index ef73a44..55d3e39 100644 --- a/src/launchpad/src/launchpad.c +++ b/src/launchpad/src/launchpad.c @@ -806,7 +806,6 @@ static int __exec_loader_process(void *arg) char **argv = arg; char err_buf[1024]; - _send_cmd_to_amd(LAUNCHPAD_CHILD_PROCESS); _signal_unblock_sigchld(); _close_all_fds(); _setup_stdio(basename(argv[LOADER_ARG_PATH])); -- 2.7.4 From ffbb3a33fbb2e269b137901d4327a9651157665d Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Wed, 19 Aug 2020 14:35:06 +0900 Subject: [PATCH 08/16] Release version 0.15.18 Changes: - Remove unused codes Change-Id: I1122f248c13d322c622f8185d1594e86b09c45ac Signed-off-by: Hwankyu Jhun --- packaging/launchpad.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/launchpad.spec b/packaging/launchpad.spec index 924bdae..3ebc2ca 100644 --- a/packaging/launchpad.spec +++ b/packaging/launchpad.spec @@ -1,6 +1,6 @@ Name: launchpad Summary: Launchpad for launching applications -Version: 0.15.17 +Version: 0.15.18 Release: 1 Group: Application Framework/Daemons License: Apache-2.0 -- 2.7.4 From 3830285fbae06a02f8e127b64d8b38f723a24c15 Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Wed, 19 Aug 2020 15:59:37 +0900 Subject: [PATCH 09/16] Add hwc logs for performance check Change-Id: I77dcd11e86967cead7b6199812dca6ae8cdb872d Signed-off-by: Hwankyu Jhun --- src/launchpad/src/launchpad.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/launchpad/src/launchpad.c b/src/launchpad/src/launchpad.c index 55d3e39..c506541 100644 --- a/src/launchpad/src/launchpad.c +++ b/src/launchpad/src/launchpad.c @@ -3079,6 +3079,7 @@ static int __before_loop(int argc, char **argv) { int ret; + _print_hwc_log("%s(%d): START", __FUNCTION__, __LINE__); ret = __sequencer_init(); if (ret < 0) { _E("Failed to initialize sequencer"); @@ -3146,6 +3147,7 @@ static int __before_loop(int argc, char **argv) _memory_monitor_init(); _memory_monitor_set_event_cb(__memory_monitor_cb, NULL); _log_init(); + _print_hwc_log("%s(%d): END", __FUNCTION__, __LINE__); return 0; } @@ -3190,12 +3192,14 @@ int main(int argc, char **argv) { GMainLoop *mainloop = NULL; + _print_hwc_log("%s(%d): START", __FUNCTION__, __LINE__); mainloop = g_main_loop_new(NULL, FALSE); if (!mainloop) { _E("Failed to create glib main loop"); return -1; } + _print_hwc_log("%s(%d): __before_loop()", __FUNCTION__, __LINE__); if (__before_loop(argc, argv) != 0) { _E("process-pool Initialization failed!"); return -1; @@ -3204,6 +3208,7 @@ int main(int argc, char **argv) #ifdef TIZEN_FEATURE_PRIORITY_CHANGE _set_priority(-12); #endif + _print_hwc_log("%s(%d): g_main_loop_run()", __FUNCTION__, __LINE__); g_main_loop_run(mainloop); __after_loop(); -- 2.7.4 From 92c5e0eb9d7e0c0507ba7dc070cae643c867eff1 Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Wed, 19 Aug 2020 16:46:17 +0900 Subject: [PATCH 10/16] Release version 0.15.19 Changes: - Add hwc logs for performance check Change-Id: I212357fc657369556622a76f898a3699218c0a28 Signed-off-by: Hwankyu Jhun --- packaging/launchpad.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/launchpad.spec b/packaging/launchpad.spec index 3ebc2ca..2994a02 100644 --- a/packaging/launchpad.spec +++ b/packaging/launchpad.spec @@ -1,6 +1,6 @@ Name: launchpad Summary: Launchpad for launching applications -Version: 0.15.18 +Version: 0.15.19 Release: 1 Group: Application Framework/Daemons License: Apache-2.0 -- 2.7.4 From 2b863d740b7b4391d20877dc3296721fefafb7de Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Thu, 20 Aug 2020 09:33:21 +0900 Subject: [PATCH 11/16] Adjust coding style Change-Id: I7848355cc6498aad5c243c2d99665abca082366d Signed-off-by: Hwankyu Jhun --- src/parser/launchpad_parser_plugin.hh | 1 - .../launchpad_parser_plugin_pkgmgr_interface.cc | 33 ++++++++++------------ 2 files changed, 15 insertions(+), 19 deletions(-) diff --git a/src/parser/launchpad_parser_plugin.hh b/src/parser/launchpad_parser_plugin.hh index 091e50c..35a2e8f 100644 --- a/src/parser/launchpad_parser_plugin.hh +++ b/src/parser/launchpad_parser_plugin.hh @@ -42,4 +42,3 @@ class LaunchpadParser { } // namespace launchpad_parser_plugin #endif // LAUNCHPAD_PARSER_PLUGIN_LAUNCHPAD_PARSER_PLUGIN_HH_ - diff --git a/src/parser/launchpad_parser_plugin_pkgmgr_interface.cc b/src/parser/launchpad_parser_plugin_pkgmgr_interface.cc index 34d16ba..c986af7 100644 --- a/src/parser/launchpad_parser_plugin_pkgmgr_interface.cc +++ b/src/parser/launchpad_parser_plugin_pkgmgr_interface.cc @@ -22,47 +22,44 @@ using namespace launchpad_parser_plugin; -extern "C" EXPORT_API int PKGMGR_PARSER_PLUGIN_INSTALL(xmlDocPtr doc, const char *package) -{ +extern "C" EXPORT_API int PKGMGR_PARSER_PLUGIN_INSTALL(xmlDocPtr doc, + const char* package) { LaunchpadParser parser; - LOGI("install"); + LOGI("Install package(%s)", package); return parser.Install(doc, package); } -extern "C" EXPORT_API int PKGMGR_PARSER_PLUGIN_UNINSTALL(xmlDocPtr doc, const char *package) -{ - LOGI("uninstall"); +extern "C" EXPORT_API int PKGMGR_PARSER_PLUGIN_UNINSTALL(xmlDocPtr doc, + const char* package) { + LOGI("Uninstall package(%s)", package); LaunchpadParser parser; return parser.UnInstall(doc, package); } -extern "C" EXPORT_API int PKGMGR_PARSER_PLUGIN_UPGRADE(xmlDocPtr doc, const char *package) -{ - LOGI("upgrade"); +extern "C" EXPORT_API int PKGMGR_PARSER_PLUGIN_UPGRADE(xmlDocPtr doc, + const char* package) { + LOGI("Upgrade package(%s)", package); LaunchpadParser parser; return parser.Upgrade(doc, package); } extern "C" EXPORT_API int PKGMGR_PARSER_PLUGIN_RECOVERINSTALL(xmlDocPtr doc, - const char *package) -{ - LOGW("recover install"); + const char* package) { + LOGW("Recover install package(%s)", package); LaunchpadParser parser; return parser.UnInstall(doc, package); } extern "C" EXPORT_API int PKGMGR_PARSER_PLUGIN_RECOVERUNINSTALL(xmlDocPtr doc, - const char *package) -{ - LOGW("recover uninstall"); + const char* package) { + LOGW("Recover uninstall package(%s)", package); LaunchpadParser parser; return parser.UnInstall(doc, package); } extern "C" EXPORT_API int PKGMGR_PARSER_PLUGIN_RECOVERUPGRADE(xmlDocPtr doc, - const char *package) -{ - LOGW("recover upgrade"); + const char* package) { + LOGW("Recover upgrade package(%s)", package); LaunchpadParser parser; return parser.Upgrade(doc, package); } -- 2.7.4 From e8fdcd2c341c8329850f2f2a75e37d2ad96e5107 Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Thu, 20 Aug 2020 09:53:06 +0900 Subject: [PATCH 12/16] Add privilege level check for plugin parser App-defined loader feature is only for platform developers. Change-Id: Icbb87b3835bf3e4b866aeb9f8e66896256bc9e71 Signed-off-by: Hwankyu Jhun --- packaging/launchpad.spec | 1 + src/parser/CMakeLists.txt | 1 + src/parser/launchpad_parser_plugin.cc | 15 ++++++++++++--- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/packaging/launchpad.spec b/packaging/launchpad.spec index 2994a02..83a9da1 100644 --- a/packaging/launchpad.spec +++ b/packaging/launchpad.spec @@ -31,6 +31,7 @@ BuildRequires: pkgconfig(dbus-1) BuildRequires: pkgconfig(iniparser) BuildRequires: pkgconfig(libxml-2.0) BuildRequires: pkgconfig(libsmack) +BuildRequires: pkgconfig(pkgmgr-installer) Requires(post): /sbin/ldconfig Requires(post): /usr/bin/systemctl diff --git a/src/parser/CMakeLists.txt b/src/parser/CMakeLists.txt index f98579f..29374bd 100644 --- a/src/parser/CMakeLists.txt +++ b/src/parser/CMakeLists.txt @@ -5,6 +5,7 @@ INCLUDE(FindPkgConfig) pkg_check_modules(PKGS REQUIRED dlog libxml-2.0 + pkgmgr-installer ) FOREACH(FLAGS ${PKGS_CFLAGS}) diff --git a/src/parser/launchpad_parser_plugin.cc b/src/parser/launchpad_parser_plugin.cc index 9abaeb2..b7734c0 100644 --- a/src/parser/launchpad_parser_plugin.cc +++ b/src/parser/launchpad_parser_plugin.cc @@ -14,12 +14,14 @@ * limitations under the License. */ -#include -#include - +#include +#include #include #include +#include +#include + #include "launchpad_parser_plugin.hh" #include "log_private.hh" @@ -85,6 +87,13 @@ bool LaunchpadParser::IsValidId(string loader_id, string pkgid) { } int LaunchpadParser::Install(xmlDocPtr doc, string pkgid) { + pkgmgr_privilege_level level; + pkgmgr_installer_info_get_privilege_level(&level); + if (level != PM_PRIVILEGE_PLATFORM) { + LOGE("Privilege level(%d) is not platform", static_cast(level)); + return -1; + } + xmlNode* root = xmlDocGetRootElement(doc); for (xmlNode* node = root->children; node; node = node->next) { if (!node->name) -- 2.7.4 From 60648c05194fabf46c690cb89544e41e0c2d9409 Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Tue, 25 Aug 2020 07:51:02 +0900 Subject: [PATCH 13/16] Separate default loader In 64bit environment(Tizen 64bit IoT), default_arch64.loader.in will be installed to reduce memory usage. Change-Id: Ie1201593968541655736cbca4085818dfb982fd1 Signed-off-by: Hwankyu Jhun --- packaging/launchpad.spec | 4 ++- src/loader/CMakeLists.txt | 8 ++++-- .../loader/conf/default_arch32.loader.in | 0 src/loader/conf/default_arch64.loader.in | 32 ++++++++++++++++++++++ 4 files changed, 41 insertions(+), 3 deletions(-) rename packaging/default.loader.in => src/loader/conf/default_arch32.loader.in (100%) create mode 100644 src/loader/conf/default_arch64.loader.in diff --git a/packaging/launchpad.spec b/packaging/launchpad.spec index 83a9da1..3a1af93 100644 --- a/packaging/launchpad.spec +++ b/packaging/launchpad.spec @@ -50,7 +50,6 @@ Obsoletes: amd-mod-launchpad %define tizen_arch32 0 %endif - %if "%{?_prelink_enable}" == "y" %define tizen_feature_prelink 1 %else @@ -118,6 +117,8 @@ _TIZEN_FEATURE_LOADER_PRIORITY=ON %endif %if 0%{?tizen_arch32} _TIZEN_FEATURE_SET_PERSONALITY_32=ON +%else +_TIZEN_FEATURE_LOADER_ARCH64=ON %endif %if 0%{?tizen_feature_prelink} _TIZEN_FEATURE_PRELINK=ON @@ -130,6 +131,7 @@ MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'` -D_TIZEN_FEATURE_LOADER_PRIORITY:BOOL=${_TIZEN_FEATURE_LOADER_PRIORITY} \ -D_TIZEN_FEATURE_SET_PERSONALITY_32:BOOL=${_TIZEN_FEATURE_SET_PERSONALITY_32} \ -D_TIZEN_FEATURE_PRELINK:BOOL=${_TIZEN_FEATURE_PRELINK} \ + -D_TIZEN_FEATURE_LOADER_ARCH64:BOOL=${_TIZEN_FEATURE_LOADER_ARCH64} \ . %__make %{?_smp_mflags} diff --git a/src/loader/CMakeLists.txt b/src/loader/CMakeLists.txt index 997f034..1dff6be 100644 --- a/src/loader/CMakeLists.txt +++ b/src/loader/CMakeLists.txt @@ -70,5 +70,9 @@ SET_TARGET_PROPERTIES(${LAUNCHPAD_LOADER} ) # remove rpath option that is automatically generated by cmake. INSTALL(TARGETS ${LAUNCHPAD_LOADER} DESTINATION bin) -CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/packaging/default.loader.in ${CMAKE_SOURCE_DIR}/packaging/default.loader @ONLY) -INSTALL(FILES ${CMAKE_SOURCE_DIR}/packaging/default.loader DESTINATION share/aul) +IF(_TIZEN_FEATURE_LOADER_ARCH64) +CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/conf/default_arch64.loader.in ${CMAKE_CURRENT_SOURCE_DIR}/conf/default.loader @ONLY) +ELSE(_TIZEN_FEATURE_LOADER_ARCH64) +CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/conf/default_arch32.loader.in ${CMAKE_CURRENT_SOURCE_DIR}/conf/default.loader @ONLY) +ENDIF(_TIZEN_FEATURE_LOADER_ARCH64) +INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/conf/default.loader DESTINATION share/aul) diff --git a/packaging/default.loader.in b/src/loader/conf/default_arch32.loader.in similarity index 100% rename from packaging/default.loader.in rename to src/loader/conf/default_arch32.loader.in diff --git a/src/loader/conf/default_arch64.loader.in b/src/loader/conf/default_arch64.loader.in new file mode 100644 index 0000000..c1fdc92 --- /dev/null +++ b/src/loader/conf/default_arch64.loader.in @@ -0,0 +1,32 @@ +[LOADER] +NAME hw-loader1 +EXE /usr/bin/launchpad-loader +APP_TYPE capp|c++app +HW_ACC ON +DETECTION_METHOD TIMEOUT|VISIBILITY +TIMEOUT 5000 +EXTRA loader_type hw-loader +EXTRA_ARRAY preload +EXTRA_ARRAY_VAL @LIB_INSTALL_DIR@/libappcore-efl.so.1 +EXTRA_ARRAY_VAL @LIB_INSTALL_DIR@/libappcore-common.so.1 +EXTRA_ARRAY_VAL @LIB_INSTALL_DIR@/libcapi-appfw-application.so.0 +EXTRA_ARRAY_VAL @LIB_INSTALL_DIR@/ecore_imf/modules/wayland/@EFL_MODULE_VERSION@/module.so +EXTRA_ARRAY_VAL @LIB_INSTALL_DIR@/ecore_evas/engines/extn/@EFL_MODULE_VERSION@/module.so +ALTERNATIVE_LOADER common-loader1 + +[LOADER] +NAME common-loader1 +EXE /usr/bin/launchpad-loader +APP_TYPE capp|c++app +DETECTION_METHOD TIMEOUT|VISIBILITY +TIMEOUT 5000 +EXTRA loader_type common-loader +EXTRA_ARRAY preload +EXTRA_ARRAY_VAL @LIB_INSTALL_DIR@/libappcore-efl.so.1 +EXTRA_ARRAY_VAL @LIB_INSTALL_DIR@/libappcore-common.so.1 +EXTRA_ARRAY_VAL @LIB_INSTALL_DIR@/libcapi-appfw-application.so.0 +EXTRA_ARRAY_VAL @LIB_INSTALL_DIR@/ecore_imf/modules/wayland/@EFL_MODULE_VERSION@/module.so +EXTRA_ARRAY_VAL @LIB_INSTALL_DIR@/ecore_evas/engines/extn/@EFL_MODULE_VERSION@/module.so + + + -- 2.7.4 From a466cba64fb7575ddcf4095ef23b404761a36a1b Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Tue, 25 Aug 2020 09:15:16 +0900 Subject: [PATCH 14/16] Release version 0.15.20 Changes: - Adjust coding style - Add privilege level check for plugin parser - Separate default loader Change-Id: Iaf49ee02707a0aeb69b49908d15978fd7095194c Signed-off-by: Hwankyu Jhun --- packaging/launchpad.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/launchpad.spec b/packaging/launchpad.spec index 3a1af93..d400b32 100644 --- a/packaging/launchpad.spec +++ b/packaging/launchpad.spec @@ -1,6 +1,6 @@ Name: launchpad Summary: Launchpad for launching applications -Version: 0.15.19 +Version: 0.15.20 Release: 1 Group: Application Framework/Daemons License: Apache-2.0 -- 2.7.4 From bbed08022a243b4e82351bfb76777caf0a6480b5 Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Mon, 21 Sep 2020 15:12:23 +0900 Subject: [PATCH 15/16] Fix directory hierarchy & cmake configuration files CMake configuration files are changed. Directory hierarchy is changed as below: +-----------------------------------------------------+ | launchpad/ | | |-- cmake/ | | |-- packaging/ | | |-- src/ | | |-- app-defined-loader/ | | |-- launchpad-loader/ | | |-- launchpad-parser/ | | |-- launchpad-process-pool/ | | |-- lib/ | | |-- common/ | | |-- launchpad/ | | |-- launchpad-hydra/ | +-----------------------------------------------------+ Change-Id: I1e8c0416c46a61bb749855309d141dd422fd01dd Signed-off-by: Hwankyu Jhun --- CMakeLists.txt | 60 ++++++++++++-- cmake/Modules/ApplyPkgConfig.cmake | 35 ++++++++ src/CMakeLists.txt | 14 +--- src/app-defined-loader/CMakeLists.txt | 94 +++++++++------------- src/hydra/CMakeLists.txt | 45 ----------- src/launchpad-loader/CMakeLists.txt | 65 +++++++++++++++ .../conf/default_arch32.loader.in | 0 .../conf/default_arch64.loader.in | 0 .../src/launchpad_loader.c | 0 src/launchpad-parser/CMakeLists.txt | 25 ++++++ src/{parser => launchpad-parser}/common.hh | 6 +- .../launchpad_parser_plugin.cc | 6 +- .../launchpad_parser_plugin.hh | 13 +-- .../launchpad_parser_plugin_pkgmgr_interface.cc | 6 +- .../launchpad_plugins.txt | 0 src/{parser => launchpad-parser}/loader_info.cc | 3 +- src/{parser => launchpad-parser}/loader_info.hh | 9 +-- src/{parser => launchpad-parser}/log_private.hh | 16 +--- src/launchpad-process-pool/CMakeLists.txt | 54 +++++++++++++ .../conf/launchpad.conf.in | 0 .../inc/debugger_info.h | 0 .../inc/launcher_info.h | 0 .../inc/launchpad_config.h | 0 .../inc/launchpad_dbus.h | 0 .../inc/launchpad_debug.h | 0 .../inc/launchpad_inotify.h | 0 .../inc/launchpad_io_channel.h | 0 .../inc/launchpad_log.h | 0 .../inc/launchpad_logger.h | 0 .../inc/launchpad_memory_monitor.h | 0 .../inc/launchpad_signal.h | 0 .../inc/launchpad_worker.h | 0 .../inc/loader_info.h | 0 .../src/debugger_info.c | 0 .../src/launcher_info.c | 0 .../src/launchpad.c | 0 .../src/launchpad_config.c | 0 .../src/launchpad_dbus.c | 0 .../src/launchpad_debug.c | 0 .../src/launchpad_inotify.c | 0 .../src/launchpad_io_channel.c | 0 .../src/launchpad_log.c | 0 .../src/launchpad_logger.c | 0 .../src/launchpad_memory_monitor.c | 0 .../src/launchpad_signal.c | 0 .../src/launchpad_worker.c | 0 .../src/loader_info.c | 0 src/launchpad/CMakeLists.txt | 72 ----------------- src/lib/CMakeLists.txt | 55 +------------ src/{ => lib}/common/inc/key.h | 0 src/{ => lib}/common/inc/launchpad_common.h | 0 src/{ => lib}/common/inc/launchpad_plugin.h | 0 src/{ => lib}/common/inc/launchpad_proc.h | 0 src/{ => lib}/common/inc/launchpad_socket.h | 0 src/{ => lib}/common/inc/launchpad_types.h | 0 src/{ => lib}/common/inc/log_private.h | 0 src/{ => lib}/common/inc/perf.h | 0 src/{ => lib}/common/inc/preexec.h | 0 src/{ => lib}/common/src/launchpad_common.c | 0 src/{ => lib}/common/src/launchpad_plugin.c | 0 src/{ => lib}/common/src/launchpad_proc.c | 0 src/{ => lib}/common/src/launchpad_socket.c | 0 src/lib/launchpad-hydra/CMakeLists.txt | 33 ++++++++ .../launchpad-hydra}/inc/launchpad_hydra.h | 0 .../launchpad-hydra}/inc/launchpad_sigchld.h | 0 .../pkgconfig/liblaunchpad-hydra.pc.in | 0 .../launchpad-hydra}/src/launchpad_hydra.c | 0 .../launchpad-hydra}/src/launchpad_sigchld.c | 0 src/lib/launchpad/CMakeLists.txt | 43 ++++++++++ src/lib/{ => launchpad}/inc/launchpad.h | 0 src/lib/{ => launchpad}/pkgconfig/launchpad.pc.in | 0 src/lib/{ => launchpad}/src/launchpad_lib.c | 0 src/loader/CMakeLists.txt | 78 ------------------ src/parser/CMakeLists.txt | 40 --------- 74 files changed, 376 insertions(+), 396 deletions(-) create mode 100644 cmake/Modules/ApplyPkgConfig.cmake delete mode 100644 src/hydra/CMakeLists.txt create mode 100644 src/launchpad-loader/CMakeLists.txt rename src/{loader => launchpad-loader}/conf/default_arch32.loader.in (100%) rename src/{loader => launchpad-loader}/conf/default_arch64.loader.in (100%) rename src/{loader => launchpad-loader}/src/launchpad_loader.c (100%) create mode 100644 src/launchpad-parser/CMakeLists.txt rename src/{parser => launchpad-parser}/common.hh (84%) rename src/{parser => launchpad-parser}/launchpad_parser_plugin.cc (97%) rename src/{parser => launchpad-parser}/launchpad_parser_plugin.hh (84%) rename src/{parser => launchpad-parser}/launchpad_parser_plugin_pkgmgr_interface.cc (93%) rename src/{parser => launchpad-parser}/launchpad_plugins.txt (100%) rename src/{parser => launchpad-parser}/loader_info.cc (96%) rename src/{parser => launchpad-parser}/loader_info.hh (87%) rename src/{parser => launchpad-parser}/log_private.hh (79%) create mode 100644 src/launchpad-process-pool/CMakeLists.txt rename src/{launchpad => launchpad-process-pool}/conf/launchpad.conf.in (100%) rename src/{launchpad => launchpad-process-pool}/inc/debugger_info.h (100%) rename src/{launchpad => launchpad-process-pool}/inc/launcher_info.h (100%) rename src/{launchpad => launchpad-process-pool}/inc/launchpad_config.h (100%) rename src/{launchpad => launchpad-process-pool}/inc/launchpad_dbus.h (100%) rename src/{launchpad => launchpad-process-pool}/inc/launchpad_debug.h (100%) rename src/{launchpad => launchpad-process-pool}/inc/launchpad_inotify.h (100%) rename src/{launchpad => launchpad-process-pool}/inc/launchpad_io_channel.h (100%) rename src/{launchpad => launchpad-process-pool}/inc/launchpad_log.h (100%) rename src/{launchpad => launchpad-process-pool}/inc/launchpad_logger.h (100%) rename src/{launchpad => launchpad-process-pool}/inc/launchpad_memory_monitor.h (100%) rename src/{launchpad => launchpad-process-pool}/inc/launchpad_signal.h (100%) rename src/{launchpad => launchpad-process-pool}/inc/launchpad_worker.h (100%) rename src/{launchpad => launchpad-process-pool}/inc/loader_info.h (100%) rename src/{launchpad => launchpad-process-pool}/src/debugger_info.c (100%) rename src/{launchpad => launchpad-process-pool}/src/launcher_info.c (100%) rename src/{launchpad => launchpad-process-pool}/src/launchpad.c (100%) rename src/{launchpad => launchpad-process-pool}/src/launchpad_config.c (100%) rename src/{launchpad => launchpad-process-pool}/src/launchpad_dbus.c (100%) rename src/{launchpad => launchpad-process-pool}/src/launchpad_debug.c (100%) rename src/{launchpad => launchpad-process-pool}/src/launchpad_inotify.c (100%) rename src/{launchpad => launchpad-process-pool}/src/launchpad_io_channel.c (100%) rename src/{launchpad => launchpad-process-pool}/src/launchpad_log.c (100%) rename src/{launchpad => launchpad-process-pool}/src/launchpad_logger.c (100%) rename src/{launchpad => launchpad-process-pool}/src/launchpad_memory_monitor.c (100%) rename src/{launchpad => launchpad-process-pool}/src/launchpad_signal.c (100%) rename src/{launchpad => launchpad-process-pool}/src/launchpad_worker.c (100%) rename src/{launchpad => launchpad-process-pool}/src/loader_info.c (100%) delete mode 100644 src/launchpad/CMakeLists.txt rename src/{ => lib}/common/inc/key.h (100%) rename src/{ => lib}/common/inc/launchpad_common.h (100%) rename src/{ => lib}/common/inc/launchpad_plugin.h (100%) rename src/{ => lib}/common/inc/launchpad_proc.h (100%) rename src/{ => lib}/common/inc/launchpad_socket.h (100%) rename src/{ => lib}/common/inc/launchpad_types.h (100%) rename src/{ => lib}/common/inc/log_private.h (100%) rename src/{ => lib}/common/inc/perf.h (100%) rename src/{ => lib}/common/inc/preexec.h (100%) rename src/{ => lib}/common/src/launchpad_common.c (100%) rename src/{ => lib}/common/src/launchpad_plugin.c (100%) rename src/{ => lib}/common/src/launchpad_proc.c (100%) rename src/{ => lib}/common/src/launchpad_socket.c (100%) create mode 100644 src/lib/launchpad-hydra/CMakeLists.txt rename src/{hydra => lib/launchpad-hydra}/inc/launchpad_hydra.h (100%) rename src/{hydra => lib/launchpad-hydra}/inc/launchpad_sigchld.h (100%) rename src/{hydra => lib/launchpad-hydra}/pkgconfig/liblaunchpad-hydra.pc.in (100%) rename src/{hydra => lib/launchpad-hydra}/src/launchpad_hydra.c (100%) rename src/{hydra => lib/launchpad-hydra}/src/launchpad_sigchld.c (100%) create mode 100644 src/lib/launchpad/CMakeLists.txt rename src/lib/{ => launchpad}/inc/launchpad.h (100%) rename src/lib/{ => launchpad}/pkgconfig/launchpad.pc.in (100%) rename src/lib/{ => launchpad}/src/launchpad_lib.c (100%) delete mode 100644 src/loader/CMakeLists.txt delete mode 100644 src/parser/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index 7fbbd02..5a8e0f5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,6 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8) -PROJECT(launchpad C CXX) +PROJECT(launchpad) -ADD_DEFINITIONS("-DSHARE_PREFIX=\"/usr/share/aul\"") IF(_TIZEN_FEATURE_PRIORITY_CHANGE) ADD_DEFINITIONS("-DTIZEN_FEATURE_PRIORITY_CHANGE") ENDIF(_TIZEN_FEATURE_PRIORITY_CHANGE) @@ -17,9 +16,58 @@ ADD_DEFINITIONS("-DLAUNCHPAD_LOG") ADD_DEFINITIONS("-DPRELOAD_ACTIVATE") ADD_DEFINITIONS("-DPREEXEC_ACTIVATE") -EXEC_PROGRAM(pkg-config - ARGS --variable=module_arch ecore - OUTPUT_VARIABLE EFL_MODULE_VERSION -) +## Compile flags +SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall") +SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror") +SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wl,-zdefs") +SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden") +SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fdata-sections") +SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ffunction-sections") +SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wl,--gc-sections") +SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_FILE_OFFSET_BITS=64") +SET(CMAKE_C_FLAGS_DEBUG "-O0 -g") +SET(CMAKE_C_FLAGS_RELEASE "-O2") + +SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_C_FLAGS} -std=c++14") +SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -g") +SET(CMAKE_CXX_FLAGS_RELEASE "-O2") + +## Linker flags +SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed") + +## Targets +SET(TARGET_APP_DEFINED_LOADER "app-defined-loader") +SET(TARGET_LAUNCHPAD "launchpad") +SET(TARGET_LAUNCHPAD_HYDRA "launchpad-hydra") +SET(TARGET_LAUNCHPAD_LOADER "launchpad-loader") +SET(TARGET_LAUNCHPAD_PARSER "launchpad-parser") +SET(TARGET_LAUNCHPAD_PROCESS_POOL "launchpad-process-pool") + +SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} + "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/") + +INCLUDE(FindPkgConfig) +INCLUDE(ApplyPkgConfig) + +PKG_CHECK_MODULES(AUL_DEPS REQUIRED aul) +PKG_CHECK_MODULES(BUNDLE_DEPS REQUIRED bundle) +PKG_CHECK_MODULES(BUXTON2_DEPS REQUIRED buxton2) +PKG_CHECK_MODULES(DBUS_DEPS REQUIRED dbus-1) +PKG_CHECK_MODULES(DLOG_DEPS REQUIRED dlog) +PKG_CHECK_MODULES(ECORE_DEPS REQUIRED ecore) +PKG_CHECK_MODULES(ECORE_CORE_DEPS REQUIRED ecore-core) +PKG_CHECK_MODULES(ELEMENTARY_DEPS REQUIRED elementary) +PKG_CHECK_MODULES(GIO_DEPS REQUIRED gio-2.0) +PKG_CHECK_MODULES(INIPARSER_DEPS REQUIRED iniparser) +PKG_CHECK_MODULES(LIBCAP_DEPS REQUIRED libcap) +PKG_CHECK_MODULES(LIBSMACK_DEPS REQUIRED libsmack) +PKG_CHECK_MODULES(LIBSYSTEMD_DEPS REQUIRED libsystemd) +PKG_CHECK_MODULES(LIBTZPLATFORM_CONFIG_DEPS REQUIRED libtzplatform-config) +PKG_CHECK_MODULES(LIBXML_DEPS REQUIRED libxml-2.0) +PKG_CHECK_MODULES(PKGMGR_INSTALLER_DEPS REQUIRED pkgmgr-installer) +PKG_CHECK_MODULES(SECURITY_MANAGER_DEPS REQUIRED security-manager) +PKG_CHECK_MODULES(TANCHOR_DEPS REQUIRED tanchor) +PKG_CHECK_MODULES(TTRACE_DEPS REQUIRED ttrace) +PKG_CHECK_MODULES(VCONF_DEPS REQUIRED vconf) ADD_SUBDIRECTORY(src) diff --git a/cmake/Modules/ApplyPkgConfig.cmake b/cmake/Modules/ApplyPkgConfig.cmake new file mode 100644 index 0000000..9b84be3 --- /dev/null +++ b/cmake/Modules/ApplyPkgConfig.cmake @@ -0,0 +1,35 @@ +# Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# +# This function applies external (out of source tree) dependencies +# to given target. Arguments are: +# TARGET - valid cmake target +# PRIVACY - dependency can be inherited by dependent targets or not: +# PUBLIC - this should be used by default, cause compile/link flags passing +# PRIVATE - do not passes any settings to dependent targets, +# may be usefull for static libraries from the inside of the project +# Argument ARGV2 and following are supposed to be names of checked pkg config +# packages. This function will use variables created by check_pkg_modules(). +# - ${DEP_NAME}_LIBRARIES +# - ${DEP_NAME}_INCLUDE_DIRS +# - ${DEP_NAME}_CFLAGS +# +FUNCTION(APPLY_PKG_CONFIG TARGET PRIVACY) + MATH(EXPR DEST_INDEX "${ARGC}-1") + FOREACH(I RANGE 2 ${DEST_INDEX}) + IF(NOT ${ARGV${I}}_FOUND) + MESSAGE(FATAL_ERROR "Not found dependency - ${ARGV${I}}_FOUND") + ENDIF(NOT ${ARGV${I}}_FOUND) + TARGET_LINK_LIBRARIES(${TARGET} ${PRIVACY} "${${ARGV${I}}_LIBRARIES}") + TARGET_INCLUDE_DIRECTORIES(${TARGET} ${PRIVACY} SYSTEM "${${ARGV${I}}_INCLUDE_DIRS}") + STRING(REPLACE ";" " " CFLAGS_STR "${${ARGV${I}}_CFLAGS}") + SET(CFLAGS_LIST ${CFLAGS_STR}) + SEPARATE_ARGUMENTS(CFLAGS_LIST) + FOREACH(OPTION ${CFLAGS_LIST}) + TARGET_COMPILE_OPTIONS(${TARGET} ${PRIVACY} ${OPTION}) + ENDFOREACH(OPTION) + SET_TARGET_PROPERTIES(${TARGET} PROPERTIES SKIP_BUILD_RPATH true) + ENDFOREACH(I RANGE 2 ${DEST_INDEX}) +ENDFUNCTION(APPLY_PKG_CONFIG TARGET PRIVACY) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index de3c1c6..0bfe952 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,11 +1,5 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 2.8) - -ADD_SUBDIRECTORY(launchpad) -ADD_SUBDIRECTORY(lib) -ADD_SUBDIRECTORY(loader) ADD_SUBDIRECTORY(app-defined-loader) -ADD_SUBDIRECTORY(hydra) -ADD_SUBDIRECTORY(parser) - -ADD_DEPENDENCIES(launchpad-loader liblaunchpad) -ADD_DEPENDENCIES(app-defined-loader liblaunchpad) +ADD_SUBDIRECTORY(launchpad-loader) +ADD_SUBDIRECTORY(launchpad-parser) +ADD_SUBDIRECTORY(launchpad-process-pool) +ADD_SUBDIRECTORY(lib) diff --git a/src/app-defined-loader/CMakeLists.txt b/src/app-defined-loader/CMakeLists.txt index 3410782..a7fa8bb 100644 --- a/src/app-defined-loader/CMakeLists.txt +++ b/src/app-defined-loader/CMakeLists.txt @@ -1,74 +1,52 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 2.8) -PROJECT(app-defined-loader) -SET(APP_DEFINED_LOADER "app-defined-loader") +AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/src APP_DEFINED_LOADER_SRCS) +AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/../lib/common/src + LIB_COMMON_SRCS) -INCLUDE(FindPkgConfig) -PKG_CHECK_MODULES(APP_DEFINED_LOADER_PKGS REQUIRED - aul - bundle - dbus-1 - dlog - ecore - ecore-core - gio-2.0 - iniparser - libsystemd - ) - -FOREACH(flag ${APP_DEFINED_LOADER_PKGS_CFLAGS}) - SET(EXTRA_CFLAGS_loader "${EXTRA_CFLAGS_loader} ${flag}") -ENDFOREACH(flag) - -SET(EXTRA_CFLAGS_common "${EXTRA_CFLAGS_common} -Wl,-zdefs" ) -SET(EXTRA_CFLAGS_common "${EXTRA_CFLAGS_common} -fvisibility=hidden") -SET(EXTRA_CFLAGS_common "${EXTRA_CFLAGS_common} -fdata-sections -ffunction-sections -Wl,--gc-sections") -SET(EXTRA_CFLAGS_common "${EXTRA_CFLAGS_common} -D_FILE_OFFSET_BITS=64") -SET(EXTRA_CFLAGS_common "${EXTRA_CFLAGS_common} -Werror") +ADD_EXECUTABLE(${TARGET_APP_DEFINED_LOADER} + ${APP_DEFINED_LOADER_SRCS} + ${LIB_COMMON_SRCS}) IF(_TIZEN_FEATURE_PRELINK) -MESSAGE(STATUS "[__PRELINK__] Enable") -SET(EXTRA_CFLAGS_loader "${EXTRA_CFLAGS_loader} ${EXTRA_CFLAGS_common}") +MESSAGE(STATUS "prelink enable") ELSE(_TIZEN_FEATURE_PRELINK) -MESSAGE(STATUS "[__PRELINK__] Disable") -SET(EXTRA_CFLAGS_loader "${EXTRA_CFLAGS_loader} ${EXTRA_CFLAGS_common} -fPIE") +MESSAGE(STATUS "prelink enable") +SET_TARGET_PROPERTIES(${TARGET_APP_DEFINED_LOADER} PROPERTIES + COMPILE_FLAGS "-fPIE") +SET_TARGET_PROPERTIES(${TARGET_APP_DEFINED_LOADER} PROPERTIES + LINK_FLAGS "-pie") ENDIF(_TIZEN_FEATURE_PRELINK) -SET(CMAKE_C_FLAGS_DEBUG "-O0 -g") -SET(CMAKE_C_FLAGS_RELEASE "-O2") -SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed") +SET_TARGET_PROPERTIES(${TARGET_APP_DEFINED_LOADER} PROPERTIES + SKIP_BUILD_RPATH TRUE) -SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS}") -SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -g") -SET(CMAKE_CXX_FLAGS_RELEASE "-O2") +TARGET_INCLUDE_DIRECTORIES(${TARGET_APP_DEFINED_LOADER} PUBLIC + ${CMAKE_CURRENT_SOURCE_DIR}/../lib/common/inc) +TARGET_INCLUDE_DIRECTORIES(${TARGET_APP_DEFINED_LOADER} PUBLIC + ${CMAKE_CURRENT_SOURCE_DIR}/../lib/launchpad/inc) -INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/src/common/inc) -INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/src/lib/inc) +APPLY_PKG_CONFIG(${TARGET_APP_DEFINED_LOADER} PUBLIC + AUL_DEPS + BUNDLE_DEPS + DBUS_DEPS + DLOG_DEPS + ECORE_DEPS + ECORE_CORE_DEPS + GIO_DEPS + INIPARSER_DEPS + LIBSYSTEMD_DEPS +) -AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/src SOURCES) -AUX_SOURCE_DIRECTORY(${CMAKE_SOURCE_DIR}/src/common/src COMMON_SOURCES) - -SET(APP_DEFINED_LOADER_SOURCE_FILES - ${COMMON_SOURCES} - ${SOURCES}) -ADD_EXECUTABLE(${APP_DEFINED_LOADER} ${APP_DEFINED_LOADER_SOURCE_FILES}) +TARGET_LINK_LIBRARIES(${TARGET_APP_DEFINED_LOADER} PRIVATE ${TARGET_LAUNCHPAD}) # To support 2.x applications which use their own shared libraries. # Since we cannot set LD_LIBRARY_PATH directly by security issue, we make the # dynamic linker looks in the CWD forcely. -TARGET_LINK_LIBRARIES(${APP_DEFINED_LOADER} "-ldl -Wl,-rpath,: -Wl,--disable-new-dtags") - -IF(_TIZEN_FEATURE_PRELINK) -TARGET_LINK_LIBRARIES(${APP_DEFINED_LOADER} ${APP_DEFINED_LOADER_PKGS_LDFLAGS} launchpad) -ELSE(_TIZEN_FEATURE_PRELINK) -TARGET_LINK_LIBRARIES(${APP_DEFINED_LOADER} ${APP_DEFINED_LOADER_PKGS_LDFLAGS} launchpad "-pie") -ENDIF(_TIZEN_FEATURE_PRELINK) +TARGET_LINK_LIBRARIES(${TARGET_APP_DEFINED_LOADER} PUBLIC + "-ldl -Wl,-rpath,: -Wl,--disable-new-dtags") -SET_TARGET_PROPERTIES(${APP_DEFINED_LOADER} PROPERTIES COMPILE_FLAGS ${EXTRA_CFLAGS_loader}) -SET_TARGET_PROPERTIES(${APP_DEFINED_LOADER} - PROPERTIES SKIP_BUILD_RPATH TRUE - ) # remove rpath option that is automatically generated by cmake. -INSTALL(TARGETS ${APP_DEFINED_LOADER} DESTINATION bin) +INSTALL(TARGETS ${TARGET_APP_DEFINED_LOADER} DESTINATION bin) CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/conf/app-defined-loader.conf.in - ${CMAKE_CURRENT_SOURCE_DIR}/conf/app-defined-loader.conf @ONLY) -INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/conf/app-defined-loader.conf DESTINATION share/aul) + ${CMAKE_CURRENT_SOURCE_DIR}/conf/app-defined-loader.conf @ONLY) +INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/conf/app-defined-loader.conf + DESTINATION share/aul) diff --git a/src/hydra/CMakeLists.txt b/src/hydra/CMakeLists.txt deleted file mode 100644 index 6aeab28..0000000 --- a/src/hydra/CMakeLists.txt +++ /dev/null @@ -1,45 +0,0 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 2.8) -PROJECT(launchpad-hydra C) -SET(LAUNCHPAD_HYDRA "launchpad-hydra") - -INCLUDE(FindPkgConfig) -PKG_CHECK_MODULES(LAUNCHPAD_HYDRA_PKGS REQUIRED - dlog - libsystemd) - -FOREACH(flag ${LAUNCHPAD_HYDRA_PKGS_CFLAGS}) - SET(EXTRA_CFLAGS_hydra "${EXTRA_CFLAGS_hydra} ${flag}") -ENDFOREACH(flag) - -SET(EXTRA_CFLAGS_common "${EXTRA_CFLAGS_common} -Wl,-zdefs" ) -SET(EXTRA_CFLAGS_common "${EXTRA_CFLAGS_common} -fvisibility=hidden") -SET(EXTRA_CFLAGS_common "${EXTRA_CFLAGS_common} -fdata-sections -ffunction-sections -Wl,--gc-sections") -SET(EXTRA_CFLAGS_common "${EXTRA_CFLAGS_common} -D_FILE_OFFSET_BITS=64") -SET(EXTRA_CFLAGS_common "${EXTRA_CFLAGS_common} -Werror") - -SET(EXTRA_CFLAGS_hydra "${EXTRA_CFLAGS_hydra} ${EXTRA_CFLAGS_common}") - -SET(CMAKE_C_FLAGS_DEBUG "-O0 -g") -SET(CMAKE_C_FLAGS_RELEASE "-O2") -SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed") - -INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/inc) -INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/src/common/inc) - -AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/src SOURCES) -SET(COMMON_SOURCES - ${CMAKE_SOURCE_DIR}/src/common/src/launchpad_socket.c) - -ADD_LIBRARY(${LAUNCHPAD_HYDRA} SHARED - ${SOURCES} - ${COMMON_SOURCES}) -SET_TARGET_PROPERTIES(${LAUNCHPAD_HYDRA} PROPERTIES SOVERSION ${MAJORVER}) -SET_TARGET_PROPERTIES(${LAUNCHPAD_HYDRA} PROPERTIES VERSION ${VERSION}) -SET_TARGET_PROPERTIES(${LAUNCHPAD_HYDRA} PROPERTIES COMPILE_FLAGS ${EXTRA_CFLAGS_hydra}) -TARGET_LINK_LIBRARIES(${LAUNCHPAD_HYDRA} ${LAUNCHPAD_HYDRA_PKGS_LDFLAGS} "-ldl") - -INSTALL(TARGETS ${LAUNCHPAD_HYDRA} DESTINATION ${LIB_INSTALL_DIR} COMPONENT RuntimeLibraries) -INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/inc/launchpad_hydra.h DESTINATION include/launchpad) - -CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/pkgconfig/liblaunchpad-hydra.pc.in ${CMAKE_CURRENT_SOURCE_DIR}/pkgconfig/liblaunchpad-hydra.pc @ONLY) -INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/pkgconfig/liblaunchpad-hydra.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig) diff --git a/src/launchpad-loader/CMakeLists.txt b/src/launchpad-loader/CMakeLists.txt new file mode 100644 index 0000000..091bba7 --- /dev/null +++ b/src/launchpad-loader/CMakeLists.txt @@ -0,0 +1,65 @@ +AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/src LAUNCHPAD_LOADER_SRCS) +AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/../lib/common/src + LIB_COMMON_SRCS) + +ADD_EXECUTABLE(${TARGET_LAUNCHPAD_LOADER} + ${LAUNCHPAD_LOADER_SRCS} + ${LIB_COMMON_SRCS}) +SET_TARGET_PROPERTIES(${TARGET_LAUNCHPAD_LOADER} PROPERTIES + SKIP_BUILD_RPATH TRUE) + +TARGET_INCLUDE_DIRECTORIES(${TARGET_LAUNCHPAD_LOADER} PUBLIC + ${CMAKE_CURRENT_SOURCE_DIR}/../lib/launchpad/inc) +TARGET_INCLUDE_DIRECTORIES(${TARGET_LAUNCHPAD_LOADER} PUBLIC + ${CMAKE_CURRENT_SOURCE_DIR}/../lib/common/inc) + +IF(_TIZEN_FEATURE_PRELINK) +MESSAGE(STATUS "prelink enable") +ELSE(_TIZEN_FEATURE_PRELINK) +MESSAGE(STATUS "prelink disable") +SET_TARGET_PROPERTIES(${TARGET_LAUNCHPAD_LOADER} PROPERTIES + COMPILE_FLAGS "-fPIE") +TARGET_LINK_LIBRARIES(${TARGET_LAUNCHPAD_LOADER} PUBLIC "-pie") +ENDIF(_TIZEN_FEATURE_PRELINK) + +APPLY_PKG_CONFIG(${TARGET_LAUNCHPAD_LOADER} PUBLIC + DLOG_DEPS + ECORE_DEPS + ELEMENTARY_DEPS + SECURITY_MANAGER_DEPS + LIBTZPLATFORM_CONFIG_DEPS + TANCHOR_DEPS + AUL_DEPS + VCONF_DEPS + BUXTON2_DEPS + LIBSYSTEMD_DEPS + GIO_DEPS + DBUS_DEPS + LIBCAP_DEPS +) + +TARGET_LINK_LIBRARIES(${TARGET_LAUNCHPAD_LOADER} PRIVATE ${TARGET_LAUNCHPAD}) + +# To support 2.x applications which use their own shared libraries. +# Since we cannot set LD_LIBRARY_PATH directly by security issue, we make the +# dynamic linker looks in the CWD forcely. +TARGET_LINK_LIBRARIES(${TARGET_LAUNCHPAD_LOADER} PUBLIC + "-ldl -Wl,-rpath,: -Wl,--disable-new-dtags") + +INSTALL(TARGETS ${TARGET_LAUNCHPAD_LOADER} DESTINATION bin) + +EXEC_PROGRAM(pkg-config + ARGS --variable=module_arch ecore + OUTPUT_VARIABLE EFL_MODULE_VERSION +) + +IF(_TIZEN_FEATURE_LOADER_ARCH64) +CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/conf/default_arch64.loader.in + ${CMAKE_CURRENT_SOURCE_DIR}/conf/default.loader @ONLY) +ELSE(_TIZEN_FEATURE_LOADER_ARCH64) +CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/conf/default_arch32.loader.in + ${CMAKE_CURRENT_SOURCE_DIR}/conf/default.loader @ONLY) +ENDIF(_TIZEN_FEATURE_LOADER_ARCH64) + +INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/conf/default.loader DESTINATION + share/aul) diff --git a/src/loader/conf/default_arch32.loader.in b/src/launchpad-loader/conf/default_arch32.loader.in similarity index 100% rename from src/loader/conf/default_arch32.loader.in rename to src/launchpad-loader/conf/default_arch32.loader.in diff --git a/src/loader/conf/default_arch64.loader.in b/src/launchpad-loader/conf/default_arch64.loader.in similarity index 100% rename from src/loader/conf/default_arch64.loader.in rename to src/launchpad-loader/conf/default_arch64.loader.in diff --git a/src/loader/src/launchpad_loader.c b/src/launchpad-loader/src/launchpad_loader.c similarity index 100% rename from src/loader/src/launchpad_loader.c rename to src/launchpad-loader/src/launchpad_loader.c diff --git a/src/launchpad-parser/CMakeLists.txt b/src/launchpad-parser/CMakeLists.txt new file mode 100644 index 0000000..e4d65da --- /dev/null +++ b/src/launchpad-parser/CMakeLists.txt @@ -0,0 +1,25 @@ +SET(PLUGINS_LIST_FILE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/launchpad_plugins.txt) +SET(PLUGINS_LIST_INSTALL_PATH ${CMAKE_INSTALL_PREFIX}/share/parser-plugins) +ADD_DEFINITIONS("-DPLUGINS_LIST_INSTALL_PATH=\"${PLUGINS_LIST_INSTALL_PATH}\"") + +AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/ LAUNCHPAD_PARSER_SRCS) + +ADD_LIBRARY(${TARGET_LAUNCHPAD_PARSER} SHARED + ${LAUNCHPAD_PARSER_SRCS}) + +SET_TARGET_PROPERTIES(${TARGET_LAUNCHPAD_PARSER} PROPERTIES + COMPILE_FLAGS "-fpic") + +TARGET_INCLUDE_DIRECTORIES(${TARGET_LAUNCHPAD_PARSER} PUBLIC + ${CMAKE_CURRENT_SOURCE_DIR}/../) + +APPLY_PKG_CONFIG(${TARGET_LAUNCHPAD_PARSER} PUBLIC + DLOG_DEPS + LIBXML_DEPS + PKGMGR_INSTALLER_DEPS +) + +INSTALL(FILES ${PLUGINS_LIST_FILE_PATH} DESTINATION + ${PLUGINS_LIST_INSTALL_PATH}/) +INSTALL(TARGETS ${TARGET_LAUNCHPAD_PARSER} DESTINATION + ${SYSCONF_INSTALL_DIR}/package-manager/parserlib) diff --git a/src/parser/common.hh b/src/launchpad-parser/common.hh similarity index 84% rename from src/parser/common.hh rename to src/launchpad-parser/common.hh index 910caa5..f86dc87 100644 --- a/src/parser/common.hh +++ b/src/launchpad-parser/common.hh @@ -14,12 +14,12 @@ * limitations under the License. */ -#ifndef LAUNCHPAD_PARSER_PLUGIN_COMMON_HH_ -#define LAUNCHPAD_PARSER_PLUGIN_COMMON_HH_ +#ifndef LAUNCHPAD_PARSER_COMMON_HH_ +#define LAUNCHPAD_PARSER_COMMON_HH_ #ifdef EXPORT_API #undef EXPORT_API #endif #define EXPORT_API __attribute__((visibility("default"))) -#endif // LAUNCHPAD_PARSER_PLUGIN_COMMON_HH_ +#endif // LAUNCHPAD_PARSER_COMMON_HH_ diff --git a/src/parser/launchpad_parser_plugin.cc b/src/launchpad-parser/launchpad_parser_plugin.cc similarity index 97% rename from src/parser/launchpad_parser_plugin.cc rename to src/launchpad-parser/launchpad_parser_plugin.cc index b7734c0..28f2b73 100644 --- a/src/parser/launchpad_parser_plugin.cc +++ b/src/launchpad-parser/launchpad_parser_plugin.cc @@ -14,16 +14,16 @@ * limitations under the License. */ -#include #include #include +#include #include #include #include -#include "launchpad_parser_plugin.hh" -#include "log_private.hh" +#include "launchpad-parser/launchpad_parser_plugin.hh" +#include "launchpad-parser/log_private.hh" #define LOADERS_DIRECTORY_PATH "/opt/share/loaders/" diff --git a/src/parser/launchpad_parser_plugin.hh b/src/launchpad-parser/launchpad_parser_plugin.hh similarity index 84% rename from src/parser/launchpad_parser_plugin.hh rename to src/launchpad-parser/launchpad_parser_plugin.hh index 35a2e8f..483fff0 100644 --- a/src/parser/launchpad_parser_plugin.hh +++ b/src/launchpad-parser/launchpad_parser_plugin.hh @@ -14,15 +14,16 @@ * limitations under the License. */ -#ifndef LAUNCHPAD_PARSER_PLUGIN_LAUNCHPAD_PARSER_PLUGIN_HH_ -#define LAUNCHPAD_PARSER_PLUGIN_LAUNCHPAD_PARSER_PLUGIN_HH_ +#ifndef LAUNCHPAD_PARSER_LAUNCHPAD_PARSER_PLUGIN_HH_ +#define LAUNCHPAD_PARSER_LAUNCHPAD_PARSER_PLUGIN_HH_ + +#include -#include #include #include -#include +#include -#include "loader_info.hh" +#include "launchpad-parser/loader_info.hh" namespace launchpad_parser_plugin { @@ -41,4 +42,4 @@ class LaunchpadParser { } // namespace launchpad_parser_plugin -#endif // LAUNCHPAD_PARSER_PLUGIN_LAUNCHPAD_PARSER_PLUGIN_HH_ +#endif // LAUNCHPAD_PARSER_LAUNCHPAD_PARSER_PLUGIN_HH_ diff --git a/src/parser/launchpad_parser_plugin_pkgmgr_interface.cc b/src/launchpad-parser/launchpad_parser_plugin_pkgmgr_interface.cc similarity index 93% rename from src/parser/launchpad_parser_plugin_pkgmgr_interface.cc rename to src/launchpad-parser/launchpad_parser_plugin_pkgmgr_interface.cc index c986af7..cfc4416 100644 --- a/src/parser/launchpad_parser_plugin_pkgmgr_interface.cc +++ b/src/launchpad-parser/launchpad_parser_plugin_pkgmgr_interface.cc @@ -16,9 +16,9 @@ #include -#include "launchpad_parser_plugin.hh" -#include "log_private.hh" -#include "common.hh" +#include "launchpad-parser/common.hh" +#include "launchpad-parser/launchpad_parser_plugin.hh" +#include "launchpad-parser/log_private.hh" using namespace launchpad_parser_plugin; diff --git a/src/parser/launchpad_plugins.txt b/src/launchpad-parser/launchpad_plugins.txt similarity index 100% rename from src/parser/launchpad_plugins.txt rename to src/launchpad-parser/launchpad_plugins.txt diff --git a/src/parser/loader_info.cc b/src/launchpad-parser/loader_info.cc similarity index 96% rename from src/parser/loader_info.cc rename to src/launchpad-parser/loader_info.cc index f2ffdec..2f8ffcc 100644 --- a/src/parser/loader_info.cc +++ b/src/launchpad-parser/loader_info.cc @@ -13,7 +13,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include "loader_info.hh" + +#include "launchpad-parser/loader_info.hh" using namespace std; namespace launchpad_parser_plugin { diff --git a/src/parser/loader_info.hh b/src/launchpad-parser/loader_info.hh similarity index 87% rename from src/parser/loader_info.hh rename to src/launchpad-parser/loader_info.hh index c4ab4f3..f175591 100644 --- a/src/parser/loader_info.hh +++ b/src/launchpad-parser/loader_info.hh @@ -14,11 +14,11 @@ * limitations under the License. */ -#ifndef LAUNCHPAD_PARSER_PLUGIN_LOADER_INFO_HH_ -#define LAUNCHPAD_PARSER_PLUGIN_LOADER_INFO_HH_ +#ifndef LAUNCHPAD_PARSER_LOADER_INFO_HH_ +#define LAUNCHPAD_PARSER_LOADER_INFO_HH_ -#include #include +#include namespace launchpad_parser_plugin { @@ -39,5 +39,4 @@ class LoaderInfo { } // namespace launchpad_parser_plugin -#endif // LAUNCHPAD_PARSER_PLUGIN_LOADER_INFO_HH_ - +#endif // LAUNCHPAD_PARSER_LOADER_INFO_HH_ diff --git a/src/parser/log_private.hh b/src/launchpad-parser/log_private.hh similarity index 79% rename from src/parser/log_private.hh rename to src/launchpad-parser/log_private.hh index 80e244b..fe39f10 100644 --- a/src/parser/log_private.hh +++ b/src/launchpad-parser/log_private.hh @@ -14,34 +14,24 @@ * limitations under the License. */ -#ifndef LAUNCHPAD_PARSER_PLUGIN_LOG_PRIVATE_HH_ -#define LAUNCHPAD_PARSER_PLUGIN_LOG_PRIVATE_HH_ +#ifndef LAUNCHPAD_PARSER_LOG_PRIVATE_HH_ +#define LAUNCHPAD_PARSER_LOG_PRIVATE_HH_ #include -#ifdef LOG_TAG #undef LOG_TAG -#endif #define LOG_TAG "LAUNCHPAD_PARSER_PLUGIN" -#ifdef _E #undef _E -#endif #define _E(fmt, arg...) LOGE(fmt, ##arg) -#ifdef _D #undef _D -#endif #define _D(fmt, arg...) LOGD(fmt, ##arg) -#ifdef _W #undef _W -#endif #define _W(fmt, arg...) LOGW(fmt, ##arg) -#ifdef _I #undef _I -#endif #define _I(fmt, arg...) LOGI(fmt, ##arg) -#endif /* LAUNCHPAD_PARSER_PLUGIN_LOG_PRIVATE_HH_ */ +#endif /* LAUNCHPAD_PARSER_LOG_PRIVATE_HH_ */ diff --git a/src/launchpad-process-pool/CMakeLists.txt b/src/launchpad-process-pool/CMakeLists.txt new file mode 100644 index 0000000..70732ff --- /dev/null +++ b/src/launchpad-process-pool/CMakeLists.txt @@ -0,0 +1,54 @@ +AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/src + LAUNCHPAD_PROCESS_POOL_SRCS) +AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/../lib/common/src + LIB_COMMON_SRCS) + +ADD_EXECUTABLE(${TARGET_LAUNCHPAD_PROCESS_POOL} + ${LAUNCHPAD_PROCESS_POOL_SRCS} + ${LIB_COMMON_SRCS}) +SET_TARGET_PROPERTIES(${TARGET_LAUNCHPAD_PROCESS_POOL} PROPERTIES + SKIP_BUILD_RPATH TRUE) + +TARGET_INCLUDE_DIRECTORIES(${TARGET_LAUNCHPAD_PROCESS_POOL} PUBLIC + ${CMAKE_CURRENT_SOURCE_DIR}/inc) +TARGET_INCLUDE_DIRECTORIES(${TARGET_LAUNCHPAD_PROCESS_POOL} PUBLIC + ${CMAKE_CURRENT_SOURCE_DIR}/../lib/common/inc) + +IF(_TIZEN_FEATURE_PRELINK) +MESSAGE(STATUS "prelink enable") +ELSE(_TIZEN_FEATURE_PRELINK) +MESSAGE(STATUS "prelink disable") +SET_TARGET_PROPERTIES(${TARGET_LAUNCHPAD_PROCESS_POOL} PROPERTIES + COMPILE_FLAGS "-fPIE") +SET_TARGET_PROPERTIES(${TARGET_LAUNCHPAD_PROCESS_POOL} PROPERTIES + LINK_FLAGS "-pie") +ENDIF(_TIZEN_FEATURE_PRELINK) + +APPLY_PKG_CONFIG(${TARGET_LAUNCHPAD_PROCESS_POOL} PUBLIC + BUNDLE_DEPS + DBUS_DEPS + DLOG_DEPS + GIO_DEPS + INIPARSER_DEPS + LIBCAP_DEPS + LIBSMACK_DEPS + LIBSYSTEMD_DEPS + LIBTZPLATFORM_CONFIG_DEPS + SECURITY_MANAGER_DEPS + TANCHOR_DEPS + TTRACE_DEPS + VCONF_DEPS +) + +TARGET_LINK_LIBRARIES(${TARGET_LAUNCHPAD_PROCESS_POOL} PUBLIC "-lm -ldl") + +CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/packaging/default.debugger.in + ${CMAKE_SOURCE_DIR}/packaging/default.debugger @ONLY) +INSTALL(FILES ${CMAKE_SOURCE_DIR}/packaging/default.debugger DESTINATION + share/aul) +INSTALL(TARGETS ${TARGET_LAUNCHPAD_PROCESS_POOL} DESTINATION bin) + +CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/conf/launchpad.conf.in + ${CMAKE_CURRENT_SOURCE_DIR}/conf/launchpad.conf @ONLY) +INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/conf/launchpad.conf DESTINATION + share/aul) diff --git a/src/launchpad/conf/launchpad.conf.in b/src/launchpad-process-pool/conf/launchpad.conf.in similarity index 100% rename from src/launchpad/conf/launchpad.conf.in rename to src/launchpad-process-pool/conf/launchpad.conf.in diff --git a/src/launchpad/inc/debugger_info.h b/src/launchpad-process-pool/inc/debugger_info.h similarity index 100% rename from src/launchpad/inc/debugger_info.h rename to src/launchpad-process-pool/inc/debugger_info.h diff --git a/src/launchpad/inc/launcher_info.h b/src/launchpad-process-pool/inc/launcher_info.h similarity index 100% rename from src/launchpad/inc/launcher_info.h rename to src/launchpad-process-pool/inc/launcher_info.h diff --git a/src/launchpad/inc/launchpad_config.h b/src/launchpad-process-pool/inc/launchpad_config.h similarity index 100% rename from src/launchpad/inc/launchpad_config.h rename to src/launchpad-process-pool/inc/launchpad_config.h diff --git a/src/launchpad/inc/launchpad_dbus.h b/src/launchpad-process-pool/inc/launchpad_dbus.h similarity index 100% rename from src/launchpad/inc/launchpad_dbus.h rename to src/launchpad-process-pool/inc/launchpad_dbus.h diff --git a/src/launchpad/inc/launchpad_debug.h b/src/launchpad-process-pool/inc/launchpad_debug.h similarity index 100% rename from src/launchpad/inc/launchpad_debug.h rename to src/launchpad-process-pool/inc/launchpad_debug.h diff --git a/src/launchpad/inc/launchpad_inotify.h b/src/launchpad-process-pool/inc/launchpad_inotify.h similarity index 100% rename from src/launchpad/inc/launchpad_inotify.h rename to src/launchpad-process-pool/inc/launchpad_inotify.h diff --git a/src/launchpad/inc/launchpad_io_channel.h b/src/launchpad-process-pool/inc/launchpad_io_channel.h similarity index 100% rename from src/launchpad/inc/launchpad_io_channel.h rename to src/launchpad-process-pool/inc/launchpad_io_channel.h diff --git a/src/launchpad/inc/launchpad_log.h b/src/launchpad-process-pool/inc/launchpad_log.h similarity index 100% rename from src/launchpad/inc/launchpad_log.h rename to src/launchpad-process-pool/inc/launchpad_log.h diff --git a/src/launchpad/inc/launchpad_logger.h b/src/launchpad-process-pool/inc/launchpad_logger.h similarity index 100% rename from src/launchpad/inc/launchpad_logger.h rename to src/launchpad-process-pool/inc/launchpad_logger.h diff --git a/src/launchpad/inc/launchpad_memory_monitor.h b/src/launchpad-process-pool/inc/launchpad_memory_monitor.h similarity index 100% rename from src/launchpad/inc/launchpad_memory_monitor.h rename to src/launchpad-process-pool/inc/launchpad_memory_monitor.h diff --git a/src/launchpad/inc/launchpad_signal.h b/src/launchpad-process-pool/inc/launchpad_signal.h similarity index 100% rename from src/launchpad/inc/launchpad_signal.h rename to src/launchpad-process-pool/inc/launchpad_signal.h diff --git a/src/launchpad/inc/launchpad_worker.h b/src/launchpad-process-pool/inc/launchpad_worker.h similarity index 100% rename from src/launchpad/inc/launchpad_worker.h rename to src/launchpad-process-pool/inc/launchpad_worker.h diff --git a/src/launchpad/inc/loader_info.h b/src/launchpad-process-pool/inc/loader_info.h similarity index 100% rename from src/launchpad/inc/loader_info.h rename to src/launchpad-process-pool/inc/loader_info.h diff --git a/src/launchpad/src/debugger_info.c b/src/launchpad-process-pool/src/debugger_info.c similarity index 100% rename from src/launchpad/src/debugger_info.c rename to src/launchpad-process-pool/src/debugger_info.c diff --git a/src/launchpad/src/launcher_info.c b/src/launchpad-process-pool/src/launcher_info.c similarity index 100% rename from src/launchpad/src/launcher_info.c rename to src/launchpad-process-pool/src/launcher_info.c diff --git a/src/launchpad/src/launchpad.c b/src/launchpad-process-pool/src/launchpad.c similarity index 100% rename from src/launchpad/src/launchpad.c rename to src/launchpad-process-pool/src/launchpad.c diff --git a/src/launchpad/src/launchpad_config.c b/src/launchpad-process-pool/src/launchpad_config.c similarity index 100% rename from src/launchpad/src/launchpad_config.c rename to src/launchpad-process-pool/src/launchpad_config.c diff --git a/src/launchpad/src/launchpad_dbus.c b/src/launchpad-process-pool/src/launchpad_dbus.c similarity index 100% rename from src/launchpad/src/launchpad_dbus.c rename to src/launchpad-process-pool/src/launchpad_dbus.c diff --git a/src/launchpad/src/launchpad_debug.c b/src/launchpad-process-pool/src/launchpad_debug.c similarity index 100% rename from src/launchpad/src/launchpad_debug.c rename to src/launchpad-process-pool/src/launchpad_debug.c diff --git a/src/launchpad/src/launchpad_inotify.c b/src/launchpad-process-pool/src/launchpad_inotify.c similarity index 100% rename from src/launchpad/src/launchpad_inotify.c rename to src/launchpad-process-pool/src/launchpad_inotify.c diff --git a/src/launchpad/src/launchpad_io_channel.c b/src/launchpad-process-pool/src/launchpad_io_channel.c similarity index 100% rename from src/launchpad/src/launchpad_io_channel.c rename to src/launchpad-process-pool/src/launchpad_io_channel.c diff --git a/src/launchpad/src/launchpad_log.c b/src/launchpad-process-pool/src/launchpad_log.c similarity index 100% rename from src/launchpad/src/launchpad_log.c rename to src/launchpad-process-pool/src/launchpad_log.c diff --git a/src/launchpad/src/launchpad_logger.c b/src/launchpad-process-pool/src/launchpad_logger.c similarity index 100% rename from src/launchpad/src/launchpad_logger.c rename to src/launchpad-process-pool/src/launchpad_logger.c diff --git a/src/launchpad/src/launchpad_memory_monitor.c b/src/launchpad-process-pool/src/launchpad_memory_monitor.c similarity index 100% rename from src/launchpad/src/launchpad_memory_monitor.c rename to src/launchpad-process-pool/src/launchpad_memory_monitor.c diff --git a/src/launchpad/src/launchpad_signal.c b/src/launchpad-process-pool/src/launchpad_signal.c similarity index 100% rename from src/launchpad/src/launchpad_signal.c rename to src/launchpad-process-pool/src/launchpad_signal.c diff --git a/src/launchpad/src/launchpad_worker.c b/src/launchpad-process-pool/src/launchpad_worker.c similarity index 100% rename from src/launchpad/src/launchpad_worker.c rename to src/launchpad-process-pool/src/launchpad_worker.c diff --git a/src/launchpad/src/loader_info.c b/src/launchpad-process-pool/src/loader_info.c similarity index 100% rename from src/launchpad/src/loader_info.c rename to src/launchpad-process-pool/src/loader_info.c diff --git a/src/launchpad/CMakeLists.txt b/src/launchpad/CMakeLists.txt deleted file mode 100644 index ad10ae0..0000000 --- a/src/launchpad/CMakeLists.txt +++ /dev/null @@ -1,72 +0,0 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 2.8) -PROJECT(launchpad-process-pool C) -SET(LAUNCHPAD_PROCESS_POOL "launchpad-process-pool") - -INCLUDE(FindPkgConfig) -PKG_CHECK_MODULES(LAUNCHPAD_PROCESS_POOL_PKGS REQUIRED - bundle - dbus-1 - dlog - gio-2.0 - iniparser - libcap - libsmack - libsystemd - libtzplatform-config - security-manager - tanchor - ttrace - vconf - ) - -FOREACH(flag ${LAUNCHPAD_PROCESS_POOL_PKGS_CFLAGS}) - SET(EXTRA_CFLAGS_pool "${EXTRA_CFLAGS_pool} ${flag}") -ENDFOREACH(flag) - -SET(EXTRA_CFLAGS_common "${EXTRA_CFLAGS_common} -Wl,-zdefs" ) -SET(EXTRA_CFLAGS_common "${EXTRA_CFLAGS_common} -fvisibility=hidden") -SET(EXTRA_CFLAGS_common "${EXTRA_CFLAGS_common} -fdata-sections -ffunction-sections -Wl,--gc-sections") -SET(EXTRA_CFLAGS_common "${EXTRA_CFLAGS_common} -D_FILE_OFFSET_BITS=64") -SET(EXTRA_CFLAGS_common "${EXTRA_CFLAGS_common} -Werror") - -IF(_TIZEN_FEATURE_PRELINK) -MESSAGE(STATUS "[__PRELINK__] Enable") -SET(EXTRA_CFLAGS_pool "${EXTRA_CFLAGS_pool} ${EXTRA_CFLAGS_common}") -ELSE(_TIZEN_FEATURE_PRELINK) -MESSAGE(STATUS "[__PRELINK__] Disable") -SET(EXTRA_CFLAGS_pool "${EXTRA_CFLAGS_pool} ${EXTRA_CFLAGS_common} -fPIE") -ENDIF(_TIZEN_FEATURE_PRELINK) - -SET(CMAKE_C_FLAGS_DEBUG "-O0 -g") -SET(CMAKE_C_FLAGS_RELEASE "-O2") -SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed") - -INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/inc) -INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/src/common/inc) - -AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/src SOURCES) -AUX_SOURCE_DIRECTORY(${CMAKE_SOURCE_DIR}/src/common/src COMMON_SOURCES) - -SET(LAUNCHPAD_PROCESS_POOL_SOURCE_FILES - ${COMMON_SOURCES} - ${SOURCES}) - -ADD_EXECUTABLE(${LAUNCHPAD_PROCESS_POOL} ${LAUNCHPAD_PROCESS_POOL_SOURCE_FILES}) - -IF(_TIZEN_FEATURE_PRELINK) -TARGET_LINK_LIBRARIES(${LAUNCHPAD_PROCESS_POOL} ${LAUNCHPAD_PROCESS_POOL_PKGS_LDFLAGS} "-lm -ldl") -ELSE(_TIZEN_FEATURE_PRELINK) -TARGET_LINK_LIBRARIES(${LAUNCHPAD_PROCESS_POOL} ${LAUNCHPAD_PROCESS_POOL_PKGS_LDFLAGS} "-pie -lm -ldl") -ENDIF(_TIZEN_FEATURE_PRELINK) - -SET_TARGET_PROPERTIES(${LAUNCHPAD_PROCESS_POOL} PROPERTIES COMPILE_FLAGS ${EXTRA_CFLAGS_pool}) -SET_TARGET_PROPERTIES(${LAUNCHPAD_PROCESS_POOL} - PROPERTIES SKIP_BUILD_RPATH TRUE - ) # remove rpath option that is automatically generated by cmake. - -CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/packaging/default.debugger.in ${CMAKE_SOURCE_DIR}/packaging/default.debugger @ONLY) -INSTALL(FILES ${CMAKE_SOURCE_DIR}/packaging/default.debugger DESTINATION share/aul) -INSTALL(TARGETS ${LAUNCHPAD_PROCESS_POOL} DESTINATION bin) - -CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/conf/launchpad.conf.in ${CMAKE_CURRENT_SOURCE_DIR}/conf/launchpad.conf @ONLY) -INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/conf/launchpad.conf DESTINATION share/aul) diff --git a/src/lib/CMakeLists.txt b/src/lib/CMakeLists.txt index 1d42ce0..3daf3df 100644 --- a/src/lib/CMakeLists.txt +++ b/src/lib/CMakeLists.txt @@ -1,53 +1,2 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 2.8) -PROJECT(liblaunchpad C) -SET(LAUNCHPAD_LIB "launchpad") - -INCLUDE(FindPkgConfig) -PKG_CHECK_MODULES(LAUNCHPAD_LIB_PKGS REQUIRED - aul - bundle - dbus-1 - dlog - libcap - libtzplatform-config - security-manager - tanchor - ) - -FOREACH(flag ${LAUNCHPAD_LIB_PKGS_CFLAGS}) - SET(EXTRA_CFLAGS_lib "${EXTRA_CFLAGS_lib} ${flag}") -ENDFOREACH(flag) - -SET(EXTRA_CFLAGS_common "${EXTRA_CFLAGS_common} -Wl,-zdefs" ) -SET(EXTRA_CFLAGS_common "${EXTRA_CFLAGS_common} -fvisibility=hidden") -SET(EXTRA_CFLAGS_common "${EXTRA_CFLAGS_common} -fdata-sections -ffunction-sections -Wl,--gc-sections") -SET(EXTRA_CFLAGS_common "${EXTRA_CFLAGS_common} -D_FILE_OFFSET_BITS=64") -SET(EXTRA_CFLAGS_common "${EXTRA_CFLAGS_common} -Werror") - -SET(EXTRA_CFLAGS_lib "${EXTRA_CFLAGS_lib} ${EXTRA_CFLAGS_common}") - -SET(CMAKE_C_FLAGS_DEBUG "-O0 -g") -SET(CMAKE_C_FLAGS_RELEASE "-O2") -SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed") - -INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/inc) -INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/src/common/inc) - -AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/src SOURCES) -AUX_SOURCE_DIRECTORY(${CMAKE_SOURCE_DIR}/src/common/src COMMON_SOURCES) - -ADD_LIBRARY(${LAUNCHPAD_LIB} SHARED - ${COMMON_SOURCES} - ${SOURCES}) - -SET_TARGET_PROPERTIES(${LAUNCHPAD_LIB} PROPERTIES SOVERSION ${MAJORVER}) -SET_TARGET_PROPERTIES(${LAUNCHPAD_LIB} PROPERTIES VERSION ${VERSION}) -SET_TARGET_PROPERTIES(${LAUNCHPAD_LIB} PROPERTIES COMPILE_FLAGS ${EXTRA_CFLAGS_lib}) -TARGET_LINK_LIBRARIES(${LAUNCHPAD_LIB} ${LAUNCHPAD_LIB_PKGS_LDFLAGS} "-ldl") - -INSTALL(TARGETS ${LAUNCHPAD_LIB} DESTINATION ${LIB_INSTALL_DIR} COMPONENT RuntimeLibraries) -INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/inc/launchpad.h DESTINATION include/launchpad) -CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/pkgconfig/launchpad.pc.in ${CMAKE_CURRENT_SOURCE_DIR}/pkgconfig/launchpad.pc @ONLY) -INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/pkgconfig/launchpad.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig) -CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/pkgconfig/launchpad.pc.in ${CMAKE_CURRENT_SOURCE_DIR}/pkgconfig/liblaunchpad.pc @ONLY) -INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/pkgconfig/liblaunchpad.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig) +ADD_SUBDIRECTORY(launchpad) +ADD_SUBDIRECTORY(launchpad-hydra) diff --git a/src/common/inc/key.h b/src/lib/common/inc/key.h similarity index 100% rename from src/common/inc/key.h rename to src/lib/common/inc/key.h diff --git a/src/common/inc/launchpad_common.h b/src/lib/common/inc/launchpad_common.h similarity index 100% rename from src/common/inc/launchpad_common.h rename to src/lib/common/inc/launchpad_common.h diff --git a/src/common/inc/launchpad_plugin.h b/src/lib/common/inc/launchpad_plugin.h similarity index 100% rename from src/common/inc/launchpad_plugin.h rename to src/lib/common/inc/launchpad_plugin.h diff --git a/src/common/inc/launchpad_proc.h b/src/lib/common/inc/launchpad_proc.h similarity index 100% rename from src/common/inc/launchpad_proc.h rename to src/lib/common/inc/launchpad_proc.h diff --git a/src/common/inc/launchpad_socket.h b/src/lib/common/inc/launchpad_socket.h similarity index 100% rename from src/common/inc/launchpad_socket.h rename to src/lib/common/inc/launchpad_socket.h diff --git a/src/common/inc/launchpad_types.h b/src/lib/common/inc/launchpad_types.h similarity index 100% rename from src/common/inc/launchpad_types.h rename to src/lib/common/inc/launchpad_types.h diff --git a/src/common/inc/log_private.h b/src/lib/common/inc/log_private.h similarity index 100% rename from src/common/inc/log_private.h rename to src/lib/common/inc/log_private.h diff --git a/src/common/inc/perf.h b/src/lib/common/inc/perf.h similarity index 100% rename from src/common/inc/perf.h rename to src/lib/common/inc/perf.h diff --git a/src/common/inc/preexec.h b/src/lib/common/inc/preexec.h similarity index 100% rename from src/common/inc/preexec.h rename to src/lib/common/inc/preexec.h diff --git a/src/common/src/launchpad_common.c b/src/lib/common/src/launchpad_common.c similarity index 100% rename from src/common/src/launchpad_common.c rename to src/lib/common/src/launchpad_common.c diff --git a/src/common/src/launchpad_plugin.c b/src/lib/common/src/launchpad_plugin.c similarity index 100% rename from src/common/src/launchpad_plugin.c rename to src/lib/common/src/launchpad_plugin.c diff --git a/src/common/src/launchpad_proc.c b/src/lib/common/src/launchpad_proc.c similarity index 100% rename from src/common/src/launchpad_proc.c rename to src/lib/common/src/launchpad_proc.c diff --git a/src/common/src/launchpad_socket.c b/src/lib/common/src/launchpad_socket.c similarity index 100% rename from src/common/src/launchpad_socket.c rename to src/lib/common/src/launchpad_socket.c diff --git a/src/lib/launchpad-hydra/CMakeLists.txt b/src/lib/launchpad-hydra/CMakeLists.txt new file mode 100644 index 0000000..6dec4bf --- /dev/null +++ b/src/lib/launchpad-hydra/CMakeLists.txt @@ -0,0 +1,33 @@ +AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/src LAUNCHPAD_HYDRA_SRCS) +SET(COMMON_SOCKET_SRCS + ${CMAKE_CURRENT_SOURCE_DIR}/../common/src/launchpad_socket.c) + +ADD_LIBRARY(${TARGET_LAUNCHPAD_HYDRA} SHARED + ${COMMON_SOCKET_SRCS} + ${LAUNCHPAD_HYDRA_SRCS}) +SET_TARGET_PROPERTIES(${TARGET_LAUNCHPAD_HYDRA} PROPERTIES + SOVERSION ${MAJORVER}) +SET_TARGET_PROPERTIES(${TARGET_LAUNCHPAD_HYDRA} PROPERTIES + VERSION ${VERSION}) + +TARGET_INCLUDE_DIRECTORIES(${TARGET_LAUNCHPAD_HYDRA} PUBLIC + ${CMAKE_CURRENT_SOURCE_DIR}/inc) +TARGET_INCLUDE_DIRECTORIES(${TARGET_LAUNCHPAD_HYDRA} PUBLIC + ${CMAKE_CURRENT_SOURCE_DIR}/../common/inc) + +APPLY_PKG_CONFIG(${TARGET_LAUNCHPAD_HYDRA} PUBLIC + DLOG_DEPS + LIBSYSTEMD_DEPS +) + +TARGET_LINK_LIBRARIES(${TARGET_LAUNCHPAD_HYDRA} PUBLIC "-ldl") + +INSTALL(TARGETS ${TARGET_LAUNCHPAD_HYDRA} DESTINATION ${LIB_INSTALL_DIR} + COMPONENT RuntimeLibraries) +INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/inc/launchpad_hydra.h + DESTINATION include/launchpad) + +CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/pkgconfig/liblaunchpad-hydra.pc.in + ${CMAKE_CURRENT_SOURCE_DIR}/pkgconfig/liblaunchpad-hydra.pc @ONLY) +INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/pkgconfig/liblaunchpad-hydra.pc + DESTINATION ${LIB_INSTALL_DIR}/pkgconfig) diff --git a/src/hydra/inc/launchpad_hydra.h b/src/lib/launchpad-hydra/inc/launchpad_hydra.h similarity index 100% rename from src/hydra/inc/launchpad_hydra.h rename to src/lib/launchpad-hydra/inc/launchpad_hydra.h diff --git a/src/hydra/inc/launchpad_sigchld.h b/src/lib/launchpad-hydra/inc/launchpad_sigchld.h similarity index 100% rename from src/hydra/inc/launchpad_sigchld.h rename to src/lib/launchpad-hydra/inc/launchpad_sigchld.h diff --git a/src/hydra/pkgconfig/liblaunchpad-hydra.pc.in b/src/lib/launchpad-hydra/pkgconfig/liblaunchpad-hydra.pc.in similarity index 100% rename from src/hydra/pkgconfig/liblaunchpad-hydra.pc.in rename to src/lib/launchpad-hydra/pkgconfig/liblaunchpad-hydra.pc.in diff --git a/src/hydra/src/launchpad_hydra.c b/src/lib/launchpad-hydra/src/launchpad_hydra.c similarity index 100% rename from src/hydra/src/launchpad_hydra.c rename to src/lib/launchpad-hydra/src/launchpad_hydra.c diff --git a/src/hydra/src/launchpad_sigchld.c b/src/lib/launchpad-hydra/src/launchpad_sigchld.c similarity index 100% rename from src/hydra/src/launchpad_sigchld.c rename to src/lib/launchpad-hydra/src/launchpad_sigchld.c diff --git a/src/lib/launchpad/CMakeLists.txt b/src/lib/launchpad/CMakeLists.txt new file mode 100644 index 0000000..d43ea34 --- /dev/null +++ b/src/lib/launchpad/CMakeLists.txt @@ -0,0 +1,43 @@ +AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/src LAUNCHPAD_SRCS) +AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/../common/src LIB_COMMON_SRCS) + +ADD_LIBRARY(${TARGET_LAUNCHPAD} SHARED + ${LAUNCHPAD_SRCS} + ${LIB_COMMON_SRCS}) +SET_TARGET_PROPERTIES(${TARGET_LAUNCHPAD} PROPERTIES SOVERSION ${MAJORVER}) +SET_TARGET_PROPERTIES(${TARGET_LAUNCHPAD} PROPERTIES VERSION ${VERSION}) + +TARGET_INCLUDE_DIRECTORIES(${TARGET_LAUNCHPAD} PUBLIC + ${CMAKE_CURRENT_SOURCE_DIR}/../common/inc) +TARGET_INCLUDE_DIRECTORIES(${TARGET_LAUNCHPAD} PUBLIC + ${CMAKE_CURRENT_SOURCE_DIR}/inc) + +APPLY_PKG_CONFIG(${TARGET_LAUNCHPAD} PUBLIC + AUL_DEPS + BUNDLE_DEPS + BUXTON2_DEPS + DBUS_DEPS + DLOG_DEPS + LIBCAP_DEPS + LIBSYSTEMD_DEPS + LIBTZPLATFORM_CONFIG_DEPS + SECURITY_MANAGER_DEPS + TANCHOR_DEPS +) + +TARGET_LINK_LIBRARIES(${TARGET_LAUNCHPAD} PUBLIC "-ldl") + +INSTALL(TARGETS ${TARGET_LAUNCHPAD} DESTINATION ${LIB_INSTALL_DIR} + COMPONENT RuntimeLibraries) +INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/inc/launchpad.h DESTINATION + include/launchpad) + +CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/pkgconfig/launchpad.pc.in + ${CMAKE_CURRENT_SOURCE_DIR}/pkgconfig/launchpad.pc @ONLY) +INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/pkgconfig/launchpad.pc + DESTINATION ${LIB_INSTALL_DIR}/pkgconfig) + +CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/pkgconfig/launchpad.pc.in + ${CMAKE_CURRENT_SOURCE_DIR}/pkgconfig/liblaunchpad.pc @ONLY) +INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/pkgconfig/liblaunchpad.pc + DESTINATION ${LIB_INSTALL_DIR}/pkgconfig) diff --git a/src/lib/inc/launchpad.h b/src/lib/launchpad/inc/launchpad.h similarity index 100% rename from src/lib/inc/launchpad.h rename to src/lib/launchpad/inc/launchpad.h diff --git a/src/lib/pkgconfig/launchpad.pc.in b/src/lib/launchpad/pkgconfig/launchpad.pc.in similarity index 100% rename from src/lib/pkgconfig/launchpad.pc.in rename to src/lib/launchpad/pkgconfig/launchpad.pc.in diff --git a/src/lib/src/launchpad_lib.c b/src/lib/launchpad/src/launchpad_lib.c similarity index 100% rename from src/lib/src/launchpad_lib.c rename to src/lib/launchpad/src/launchpad_lib.c diff --git a/src/loader/CMakeLists.txt b/src/loader/CMakeLists.txt deleted file mode 100644 index 1dff6be..0000000 --- a/src/loader/CMakeLists.txt +++ /dev/null @@ -1,78 +0,0 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 2.8) -PROJECT(launchpad-loader C) -SET(LAUNCHPAD_LOADER "launchpad-loader") - -INCLUDE(FindPkgConfig) -PKG_CHECK_MODULES(LAUNCHPAD_LOADER_PKGS REQUIRED - dlog - ecore - elementary - security-manager - libtzplatform-config - tanchor - bundle - aul - vconf - buxton2 - libsystemd - gio-2.0 - dbus-1 - libcap - ) - -FOREACH(flag ${LAUNCHPAD_LOADER_PKGS_CFLAGS}) - SET(EXTRA_CFLAGS_loader "${EXTRA_CFLAGS_loader} ${flag}") -ENDFOREACH(flag) - -SET(EXTRA_CFLAGS_common "${EXTRA_CFLAGS_common} -Wl,-zdefs" ) -SET(EXTRA_CFLAGS_common "${EXTRA_CFLAGS_common} -fvisibility=hidden") -SET(EXTRA_CFLAGS_common "${EXTRA_CFLAGS_common} -fdata-sections -ffunction-sections -Wl,--gc-sections") -SET(EXTRA_CFLAGS_common "${EXTRA_CFLAGS_common} -D_FILE_OFFSET_BITS=64") -SET(EXTRA_CFLAGS_common "${EXTRA_CFLAGS_common} -Werror") - -IF(_TIZEN_FEATURE_PRELINK) -MESSAGE(STATUS "[__PRELINK__] Enable") -SET(EXTRA_CFLAGS_loader "${EXTRA_CFLAGS_loader} ${EXTRA_CFLAGS_common}") -ELSE(_TIZEN_FEATURE_PRELINK) -MESSAGE(STATUS "[__PRELINK__] Disable") -SET(EXTRA_CFLAGS_loader "${EXTRA_CFLAGS_loader} ${EXTRA_CFLAGS_common} -fPIE") -ENDIF(_TIZEN_FEATURE_PRELINK) - -SET(CMAKE_C_FLAGS_DEBUG "-O0 -g") -SET(CMAKE_C_FLAGS_RELEASE "-O2") -SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed") - -INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/src/common/inc) -INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/src/lib/inc) - -AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/src SOURCES) -AUX_SOURCE_DIRECTORY(${CMAKE_SOURCE_DIR}/src/common/src COMMON_SOURCES) - -SET(LAUNCHPAD_LOADER_SOURCE_FILES - ${COMMON_SOURCES} - ${SOURCES}) -ADD_EXECUTABLE(${LAUNCHPAD_LOADER} ${LAUNCHPAD_LOADER_SOURCE_FILES}) - -# To support 2.x applications which use their own shared libraries. -# Since we cannot set LD_LIBRARY_PATH directly by security issue, we make the -# dynamic linker looks in the CWD forcely. -TARGET_LINK_LIBRARIES(${LAUNCHPAD_LOADER} "-ldl -Wl,-rpath,: -Wl,--disable-new-dtags") - -IF(_TIZEN_FEATURE_PRELINK) -TARGET_LINK_LIBRARIES(${LAUNCHPAD_LOADER} ${LAUNCHPAD_LOADER_PKGS_LDFLAGS} launchpad) -ELSE(_TIZEN_FEATURE_PRELINK) -TARGET_LINK_LIBRARIES(${LAUNCHPAD_LOADER} ${LAUNCHPAD_LOADER_PKGS_LDFLAGS} launchpad "-pie") -ENDIF(_TIZEN_FEATURE_PRELINK) - -SET_TARGET_PROPERTIES(${LAUNCHPAD_LOADER} PROPERTIES COMPILE_FLAGS ${EXTRA_CFLAGS_loader}) -SET_TARGET_PROPERTIES(${LAUNCHPAD_LOADER} - PROPERTIES SKIP_BUILD_RPATH TRUE - ) # remove rpath option that is automatically generated by cmake. -INSTALL(TARGETS ${LAUNCHPAD_LOADER} DESTINATION bin) - -IF(_TIZEN_FEATURE_LOADER_ARCH64) -CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/conf/default_arch64.loader.in ${CMAKE_CURRENT_SOURCE_DIR}/conf/default.loader @ONLY) -ELSE(_TIZEN_FEATURE_LOADER_ARCH64) -CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/conf/default_arch32.loader.in ${CMAKE_CURRENT_SOURCE_DIR}/conf/default.loader @ONLY) -ENDIF(_TIZEN_FEATURE_LOADER_ARCH64) -INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/conf/default.loader DESTINATION share/aul) diff --git a/src/parser/CMakeLists.txt b/src/parser/CMakeLists.txt deleted file mode 100644 index 29374bd..0000000 --- a/src/parser/CMakeLists.txt +++ /dev/null @@ -1,40 +0,0 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 2.6) -PROJECT(launchpad-parser CXX) - -INCLUDE(FindPkgConfig) -pkg_check_modules(PKGS REQUIRED - dlog - libxml-2.0 - pkgmgr-installer -) - -FOREACH(FLAGS ${PKGS_CFLAGS}) - SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${FLAGS}") -ENDFOREACH(FLAGS) - -SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fvisibility=hidden -Wall -Werror -Winline -std=c++11") - -SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS}") -SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -g") -SET(CMAKE_CXX_FLAGS_RELEASE "-O2") - -ADD_LIBRARY(${PROJECT_NAME} SHARED - launchpad_parser_plugin.cc - loader_info.cc - launchpad_parser_plugin_pkgmgr_interface.cc -) - -INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../) - -SET(PLUGINS_LIST_FILE_NAME launchpad_plugins.txt) -SET(PLUGINS_LIST_FILE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/${PLUGINS_LIST_FILE_NAME}) - -SET(PLUGINS_LIST_INSTALL_PATH ${CMAKE_INSTALL_PREFIX}/share/parser-plugins) - -ADD_DEFINITIONS("-DPLUGINS_LIST_INSTALL_PATH=\"${PLUGINS_LIST_INSTALL_PATH}\"") - -INSTALL(FILES ${PLUGINS_LIST_FILE_PATH} DESTINATION ${PLUGINS_LIST_INSTALL_PATH}/) - -TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${PKGS_LDFLAGS}) - -INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${SYSCONF_INSTALL_DIR}/package-manager/parserlib) -- 2.7.4 From 6de87bbcf91f9e2bd955b08ab7275429cf7a8533 Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Tue, 22 Sep 2020 14:48:25 +0900 Subject: [PATCH 16/16] Release version 0.15.21 Changes: - Fix directory hierarchy & cmake configuration files Change-Id: I82bae4a397bb7a02f04bae3198dff0ec872341f0 Signed-off-by: Hwankyu Jhun --- packaging/launchpad.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/launchpad.spec b/packaging/launchpad.spec index d400b32..0545d95 100644 --- a/packaging/launchpad.spec +++ b/packaging/launchpad.spec @@ -1,6 +1,6 @@ Name: launchpad Summary: Launchpad for launching applications -Version: 0.15.20 +Version: 0.15.21 Release: 1 Group: Application Framework/Daemons License: Apache-2.0 -- 2.7.4