To use wrt common library, it should be complied to shared library.
Because it has many dependency with system libraries.
In wrt common, there are CommandLine and ApplicationData modules.
Using those modules, the arguements can be parsed.
And electron can get more information from app db or app control.
Change-Id: Idb7f906b240de01f04ad4ed145266e23615ef4d3
Signed-off-by: jinwoo jeong <jw00.jeong@samsung.com>
#include "base/i18n/icu_util.h"
#if defined(OS_TIZEN)
+#include "base/logging.h"
+#include "tizen/common/application_data.h"
+#include "tizen/common/command_line.h"
#include "tizen/loader/prelauncher.h"
#include "base/logging.h"
#endif
}
#if defined(USE_EFL)
- if (argv[0] == "/usr/bin/electron") // not browser process
- base::CommandLine::Init(argc, argv);
- else if (efl::Initialize(argc, const_cast<const char**>(argv)))
+ common::CommandLine::Init(argc, argv);
+ common::CommandLine* runtime_cmd = common::CommandLine::ForCurrentProcess();
+ std::string appid = runtime_cmd->GetAppIdFromCommandLine("/usr/bin/electron");
+
+ // load manifest
+ auto appdata_manager = common::ApplicationDataManager::GetInstance();
+ common::ApplicationData* appdata = appdata_manager->GetApplicationData(appid);
+ if (!appdata->LoadManifestData()) {
+ return false;
+ }
+
+ if (efl::Initialize(argc, const_cast<const char**>(argv)))
return 1;
// Add params for EFL port
],
}], # OS=="linux"
['is_tizen==1', {
+ 'includes': [
+ 'tizen/build/common.gypi',
+ ],
'dependencies': [
- 'tizen/common/common.gyp:*',
- 'tizen/loader/loader.gyp:*',
+ 'tizen/common/common.gyp:wrt_common',
+ 'tizen/loader/loader.gyp:wrt-loader',
'<(DEPTH)/efl/build/system.gyp:ecore',
'<(DEPTH)/efl/build/system.gyp:launchpad',
],
+ 'sources': [
+ 'tizen/loader/prelauncher.h',
+ 'tizen/loader/prelauncher.cc',
+ ],
'ldflags': [
'-pie',
'-export-dynamic',
],
- 'cflags': [ '-fPIC' ],
- 'cflags_cc': [ '-fPIC' ],
}], # is_tizen==1
],
}, # target <(project_name)
mkdir -p %{buildroot}%{_datadir}/aul/
cp %{SOURCE1002} %{buildroot}%{_datadir}/aul/
+# wrt_common
+mkdir -p %{buildroot}%{_libdir}
+install -p -m 644 %{_out}/lib/libwrt_common.so %{buildroot}%{_libdir}
+
mkdir -p %{buildroot}/usr/apps/org.tizen.electron-efl/bin/
install -d %{buildroot}/%{_icondir}
install -d %{buildroot}/%{_libdir}
%attr(755,root,root) %{_bindir}/wrt-loader
%attr(755,root,root) %{_bindir}/xwalk_runtime
%attr(644,root,root) %{_datadir}/aul/wrt.loader
+%attr(644,root,root) %{_libdir}/libwrt_common.so
'targets': [
{
'target_name': 'wrt_common',
- 'type': 'static_library',
+ 'type': 'shared_library',
'sources': [
'command_line.h',
'command_line.cc',
{
+ 'includes': [
+ '../build/common.gypi',
+ ],
'targets': [
{
'target_name': 'wrt-loader',
'libraries' : [
'-ldl',
],
- 'include_dirs': [
- '<(libchromiumcontent_src_dir)',
- ],
'ldflags': [
- '-Wl,--whole-archive',
- '<@(libchromiumcontent_libraries)',
- '-Wl,--no-whole-archive',
+ '-pie',
],
- 'link_settings': {
- 'libraries': [
- '<@(libchromiumcontent_libraries)',
- ]
+ 'variables': {
+ 'packages': [
+ 'dlog',
+ ],
},
}, # end of target 'wrt-loader'
- {
- 'target_name': 'prelauncher',
- 'type': 'static_library',
- 'dependencies': [
- '<(DEPTH)/efl/build/system.gyp:ecore',
- '<(DEPTH)/efl/build/system.gyp:launchpad',
- ],
- 'include_dirs': [
- '<(libchromiumcontent_src_dir)',
- ],
- 'cflags': [ '-fPIC' ],
- 'cflags_cc': [ '-fPIC' ],
- 'sources': [
- 'prelauncher.cc',
- 'prelauncher.h',
- ],
- }, # end of target 'preloader'
],
}
* limitations under the License.
*/
#include <dlfcn.h>
-#include "base/logging.h"
+#include <dlog.h>
// loader file must have "User" execute label, because launchpad daemon runs
// with "System::Privileged" label.
int main(int argc, char* argv[]) {
- LOG(INFO) << "Begin wrt-loader";
+ dlog_print(DLOG_INFO, "CHROMIUM", "Begin wrt-loader");
void* handle = dlopen("/usr/bin/electron", RTLD_NOW);
if (!handle) {
- LOG(ERROR) << "Failed to load electorn";
+ dlog_print(DLOG_ERROR, "CHROMIUM", "Failed to load electorn");
return false;
}
MAIN_FUNC real_main = reinterpret_cast<MAIN_FUNC>(dlsym(handle, "main"));
if (!real_main) {
- LOG(ERROR) << "Failed to load real_main";
+ dlog_print(DLOG_ERROR, "CHROMIUM", "Failed to load real_main");
return false;
}