%define _pkgid org.tizen.%{name}
%define _xmldir %TZ_SYS_RO_PACKAGES
%define _out out.tizen/out/D
+%define extension_path %{_libdir}/tizen-extensions-crosswalk
DEFINE_ARGS="
libchromiumcontent_component=1
use_efl=1
is_tizen=1
injected_bundle_path=%{_libdir}/libxwalk_injected_bundle.so
- extension_path=%{_libdir}/tizen-extensions-crosswalk
+ extension_path=%{extension_path}
"
%if "%{?TIZEN_PRODUCT_TV}" == "1"
DEFINE_ARGS+="
install -p -m 644 %{_out}/lib/libxwalk_extension_shared.so %{buildroot}%{_libdir}
# xwalk_injected_bundle
install -p -m 755 %{_out}/lib/libxwalk_injected_bundle.so %{buildroot}%{_libdir}
+# widget plugin
+install -p -m 644 %{_out}/lib/libwidget_plugin.so %{buildroot}%{extension_path}
+install -p -m 644 %{_out}/gen/widget.json %{buildroot}%{extension_path}
+
%post
# Owner account can't write /opt/usr/home/owner/data/org.tizen.electron-efl
# which is created in 'install'. So we should copy resources in 'post'.
%attr(644,root,root) %{_libdir}/libwrt_common.so
%attr(644,root,root) %{_libdir}/libxwalk_extension_shared.so
%attr(644,root,root) %{_libdir}/libxwalk_injected_bundle.so
+%attr(644,root,root) %{extension_path}/libwidget_plugin.so
+%attr(644,root,root) %{extension_path}/widget.json
'includes': [
'cynara-client.gypi',
'pkg-config.gypi',
-# 'xwalk_js2c.gypi',
+ 'xwalk_js2c.gypi',
],
'include_dirs': [
'../',
},
},
}, # end of target 'xwalk_extension_static'
+ {
+ 'target_name': 'widget_plugin',
+ 'type': 'shared_library',
+ 'sources': [
+ 'internal/widget/widget_api.js',
+ 'internal/widget/widget_extension.cc',
+ ],
+ 'variables': {
+ 'packages': [
+ 'dlog',
+ ],
+ },
+ 'copies': [
+ {
+ 'destination': '<(SHARED_INTERMEDIATE_DIR)',
+ 'files': [
+ 'internal/widget/widget.json'
+ ],
+ },
+ ],
+ }, # end of target 'widget_plugin'
], # end of targets
}
--- /dev/null
+#!/usr/bin/env python
+
+# Copyright (c) 2013 Intel Corporation. All rights reserved.
+# Copyright (c) 2014 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.
+
+import os
+import sys
+import subprocess
+
+TEMPLATE = """\
+extern const char %s[];
+const char %s[] = { %s, 0 };
+"""
+
+js_code = sys.argv[1]
+cmd = "python " + os.path.dirname(__file__) + "/mergejs.py -f" + js_code
+lines = subprocess.check_output(cmd, shell=True)
+c_code = ', '.join(str(ord(c)) for c in lines)
+
+symbol_name = sys.argv[2]
+output = open(sys.argv[3], "w")
+output.write(TEMPLATE % (symbol_name, symbol_name, c_code))
+output.close()
--- /dev/null
+#!/usr/bin/env python
+
+# Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved.
+
+import fileinput
+import sys
+import getopt
+import glob
+import os
+
+class Utils:
+ reqfiles = []
+ searchfile = '*_api.js'
+ startwith = "//= require('"
+ endwith = "')"
+ code = ""
+
+ @classmethod
+ def get_require(self, s):
+ try:
+ start = s.index(self.startwith) + len(self.startwith)
+ end = s.index(self.endwith, start)
+ filename = s[start:end]
+ self.reqfiles.append(filename)
+ except ValueError:
+ return ""
+
+ @classmethod
+ def find_require(self):
+ p = os.path.join('./', self.searchfile)
+ filenames = glob.glob(self.searchfile)
+ for fname in filenames:
+ with open(fname, 'r') as myfile:
+ for line in myfile:
+ self.get_require(line)
+
+ @classmethod
+ def print_lines(self, filename):
+ with open(filename, 'r') as file:
+ for line in file:
+ self.code += line
+
+ @classmethod
+ def merge_js_files(self, path):
+ self.find_require()
+ if len(self.reqfiles) == 0:
+ s = os.path.join('./', self.searchfile)
+ sfiles = glob.glob(s)
+ for fname in sfiles:
+ self.print_lines(fname)
+ else:
+ js = '*.js'
+ p = os.path.join(path, js)
+ filenames = glob.glob(p)
+ for fname in self.reqfiles:
+ fname = path + '/' + fname
+ if fname in filenames:
+ self.print_lines(fname)
+
+ @classmethod
+ def main(self, argv):
+ path = 'js'
+ try:
+ opts, args = getopt.getopt(argv,"hf:p:",["file=", "path="])
+ except getopt.GetoptError:
+ print __file__ + ' -h'
+ sys.exit()
+ if len(argv) > 0:
+ for opt, arg in opts:
+ if opt in ("-h"):
+ print 'Help:'
+ print ''
+ print __file__ + '-f <file> -p <path>'
+ print ''
+ print '<opt> \t <opt> \t\t <description>'
+ print '-f \t --file \t Name of the file where script searching for require files:'
+ print '\t \t \t ' + self.startwith + 'file_name.js' + self.endwith
+ print '-p \t --path \t Path to "' + path + '" directory'
+ print ''
+ sys.exit()
+ elif opt in ("-f", "--file"):
+ self.searchfile = arg
+ elif opt in ("-p", "--path"):
+ path = arg
+ self.merge_js_files(path)
+ print self.code
+
+if Utils.__module__ == "__main__":
+ Utils.main(sys.argv[1:])
},
],
}, # target electron_shell_copy
+ {
+ 'target_name': 'extension_wrt',
+ 'type': 'none',
+ 'dependencies': [
+ '<(DEPTH)/tizen/extensions/extensions.gyp:widget_plugin',
+ ],
+ }, # end of target 'extension_wrt'
],
}