--- /dev/null
+buildconfig = "//BUILDCONFIG.gn"
--- /dev/null
+toolchain("gcc") {
+ lib_switch = "-l"
+ lib_dir_switch = "-L"
+
+ tool("cc") {
+ depfile = "{{output}}.d"
+ command = "gcc -MMD -MF $depfile {{defines}} {{include_dirs}} {{cflags}} {{cflags_c}} -c {{source}} -o {{output}}"
+ depsformat = "gcc"
+ outputs = [ "{{target_out_dir}}/{{source_name_part}}.o" ]
+ }
+ tool("cxx") {
+ depfile = "{{output}}.d"
+ command = "c++ -MMD -MF $depfile {{defines}} {{include_dirs}} {{cflags}} {{cflags_cc}} -c {{source}} -o {{output}}"
+ depsformat = "gcc"
+ description = "CXX {{output}}"
+ outputs = [ "{{target_out_dir}}/{{source_name_part}}.o" ]
+ }
+ tool("link") {
+ exename = "{{target_output_name}}{{output_extension}}"
+ outfile = "{{output_dir}}/$exename"
+ default_output_dir = "{{root_out_dir}}"
+ command = "g++ {{ldflags}} -o \"$outfile\" {{inputs}} {{libs}}"
+ description = "LINK $outfile"
+ outputs = [ outfile ]
+ }
+ tool("stamp") {
+ command = "touch {{output}}"
+ description = "STAMP {{output}}"
+ }
+}
+
+group("wrt_group") {
+ deps = [
+ "//loader:wrt-loader",
+ ]
+}
--- /dev/null
+set_default_toolchain("//:gcc")
--- /dev/null
+config("executable_config") {
+ cflags = [ "-fPIE" ]
+ asmflags = [ "-fPIE" ]
+ ldflags = [ "-pie" ]
+}
+
+executable("wrt-loader") {
+ sources = [ "wrt_loader.cc" ]
+ libs = [ "dl", "dlog" ]
+ configs = [ ":executable_config" ]
+}
--- /dev/null
+/*
+ * Copyright (c) 2015 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.
+ */
+#include <dlfcn.h>
+#include <dlog/dlog.h>
+
+// loader file must have "User" execute label, because launchpad daemon runs
+// with "System::Privileged" label.
+int main(int argc, char* argv[]) {
+ dlog_print(DLOG_INFO, "CHROMIUM", "Begin wrt-loader");
+ void* handle = dlopen("/usr/bin/wrt", RTLD_NOW);
+ if (!handle) {
+ dlog_print(DLOG_ERROR, "CHROMIUM", "Failed to load wrt (%s)", dlerror());
+ return 1;
+ }
+
+ typedef int (*MAIN_FUNC)(int argc, char* argv[]);
+
+ MAIN_FUNC real_main = reinterpret_cast<MAIN_FUNC>(dlsym(handle, "main"));
+ if (!real_main) {
+ dlog_print(DLOG_ERROR, "CHROMIUM", "Failed to load real_main (%s)", dlerror());
+ return 1;
+ }
+
+ int ret = real_main(argc, argv);
+ dlclose(handle);
+
+ return ret;
+}
--- /dev/null
+[LOADER]
+NAME wrt-loader
+EXE /usr/bin/wrt-loader
+APP_TYPE webapp
+DETECTION_METHOD TIMEOUT|DEMAND
+TIMEOUT 5000
Group: Web Framework/Web Runtime
License: Apache-2.0
URL: https://www.tizen.org
-Source: %{name}-%{version}.tar.gz
+Source: %{name}-%{version}.tar.gz
-BuildRequires: python, ninja, nodejs, nodejs-npm
+%if "%{?tizen_profile_name}" != "tv"
+BuildRequires: ninja
+BuildRequires: pkgconfig(dlog)
+%endif
%description
-Web Runtime Engine based on Electron EFL
+Web Runtime Engine based on Electron
%prep
%setup -q
%build
-%define _resourcedir /usr/share/chromium-efl/wrt/app
+%if "%{?tizen_profile_name}" != "tv"
+ %define _outdir $PWD/out
+ ./build/tools/gn gen %{_outdir}
+ ninja -C %{_outdir} wrt-loader
+%endif
%install
+%define _resourcedir /usr/share/chromium-efl/wrt/app
+install -d %{buildroot}%{_bindir}
+install -d %{buildroot}%{_datadir}/aul
install -d %{buildroot}%{_resourcedir}
+
+%if "%{?tizen_profile_name}" != "tv"
+ install -m 0755 %{_outdir}/wrt-loader %{buildroot}%{_bindir}
+%else
+ ln -s %{_bindir}/wrt %{buildroot}%{_bindir}/wrt-loader
+%endif
+install -m 0644 packaging/wrt.loader %{buildroot}%{_datadir}/aul/
cp -r wrt_app/* %{buildroot}%{_resourcedir}/
+%post
+
%postun
%clean
%files
%manifest packaging/wrtjs.manifest
%license LICENSE
+%if "%{?tizen_profile_name}" != "tv"
+ %caps(cap_setgid,cap_sys_admin=ei) %{_bindir}/wrt-loader
+%else
+ %{_bindir}/wrt-loader
+%endif
+%{_datadir}/aul/wrt.loader
%{_resourcedir}/*