summaryrefslogtreecommitdiff
path: root/dev-lang/jerryscript
diff options
context:
space:
mode:
Diffstat (limited to 'dev-lang/jerryscript')
-rw-r--r--dev-lang/jerryscript/Manifest4
-rw-r--r--dev-lang/jerryscript/files/jerryscript-2.4.0-python3.patch122
-rw-r--r--dev-lang/jerryscript/jerryscript-2.4.0-r2.ebuild70
-rw-r--r--dev-lang/jerryscript/metadata.xml15
4 files changed, 211 insertions, 0 deletions
diff --git a/dev-lang/jerryscript/Manifest b/dev-lang/jerryscript/Manifest
new file mode 100644
index 000000000000..e3571d39b121
--- /dev/null
+++ b/dev-lang/jerryscript/Manifest
@@ -0,0 +1,4 @@
+AUX jerryscript-2.4.0-python3.patch 5261 BLAKE2B 151fec7f496d2b2b4df90d7e922f9713cfe58a54770ec8c329d189ecf82f11c2061fd755edb5c518d1939ee2f63c476d8fa97149a3e67fdf8bda3e8f897ddd29 SHA512 b3b95a8aa1c238df8494e39c00596a3a63cf64bdef7c0a531ca8f76d7ebaba5884a7aceae293541830b37d2810f22e9c44940aa8beea141ad52c995c1de0a245
+DIST jerryscript-2.4.0.tar.gz 2802799 BLAKE2B 18a3f71e7d3e2fc43772cb94aa3b0d4d28d72c6cd174eb0195f09283c5da5140ef85e86c6ed7a82e672724563549294c26d870b55c8bd9d0a92251b1002c612a SHA512 e96e6c6a2207ff869474801a1f8bbd3ce453d4076e558736ebf6962ccab08540f57cf932ec43bcd40429e21f1c6453d77874dd0a467d91a15d8357257533c1ea
+EBUILD jerryscript-2.4.0-r2.ebuild 1722 BLAKE2B 2d85fcaf531ce3cd0fcaa0939c67dc7b138c404a4129ac5ac5d6f6e389780b9e0706b12285c02699383c78cdef3103fb5f7186b0e18c27f730871fc5b602c7cc SHA512 38bdc6fd1e00f59c9a7b6f6a7043c42279f467720560a12a3067b449f929cdaec026b7620505795595ab74b74458204c3d1dc0661c206876315367db3cff6d03
+MISC metadata.xml 488 BLAKE2B b302c1a73d8924475d95afb03c0e8547b65c0f90ac058f939ae419844e6120b066f604920c8c5d2cdebc237d51f9dafa71d979766af4e3a911e7a1e2e427f328 SHA512 c925c76d17d1436f5ac177510252961f6f22b6058a7d9692bc1c42dede0bf47fe5647c58faa6aa63d91722276e5b54565c17e17d5d5f5a34a9e6f92d8987bfd3
diff --git a/dev-lang/jerryscript/files/jerryscript-2.4.0-python3.patch b/dev-lang/jerryscript/files/jerryscript-2.4.0-python3.patch
new file mode 100644
index 000000000000..7da285c5d3cf
--- /dev/null
+++ b/dev-lang/jerryscript/files/jerryscript-2.4.0-python3.patch
@@ -0,0 +1,122 @@
+From 3f725c9a6e62048dcc7e1d0dd0f9c3e8d2e092f6 Mon Sep 17 00:00:00 2001
+From: Zac Medico <zmedico@gmail.com>
+Date: Sun, 23 May 2021 13:46:30 -0700
+Subject: [PATCH] Python debugger support for Python 3 (in addition to Python 2)
+
+https://github.com/jerryscript-project/jerryscript/pull/4678
+
+- Added ord builtin compatibility to pass through int arguments
+- Fixed JerryDebugger _parse_source method to decode bytes as utf8 strings
+- Fixed WebSocket send_message method to use packed_data[0:1] bytes slice
+
+JerryScript-DCO-1.0-Signed-off-by: Zac Medico <zmedico@gmail.com>
+---
+ jerry-debugger/jerry_client_main.py | 26 ++++++++++++++++--------
+ jerry-debugger/jerry_client_websocket.py | 14 ++++++++++++-
+ 2 files changed, 31 insertions(+), 9 deletions(-)
+
+diff --git a/jerry-debugger/jerry_client_main.py b/jerry-debugger/jerry_client_main.py
+index e65d0e14..e3176c86 100644
+--- a/jerry-debugger/jerry_client_main.py
++++ b/jerry-debugger/jerry_client_main.py
+@@ -151,2 +151,12 @@ def arguments_parse():
+
++if sys.version_info.major >= 3:
++ _ord_orig = ord
++ def _ord_compat(c):
++ if isinstance(c, int):
++ return c
++ return _ord_orig(c)
++ # pylint: disable=redefined-builtin
++ ord = _ord_compat
++
++
+ class JerryBreakpoint(object):
+@@ -563,2 +573,3 @@ class JerryDebugger(object):
+ def _send_string(self, args, message_type, index=0):
++ args = args.encode("utf8")
+
+@@ -810,3 +821,3 @@ class JerryDebugger(object):
+ elif buffer_type in [JERRY_DEBUGGER_SCOPE_VARIABLES, JERRY_DEBUGGER_SCOPE_VARIABLES_END]:
+- self.scope_vars += "".join(data[1:])
++ self.scope_vars += "".join(data[1:].decode("utf8"))
+
+@@ -866,5 +877,5 @@ class JerryDebugger(object):
+ def _parse_source(self, data):
+- source_code = ""
+- source_code_name = ""
+- function_name = ""
++ source_code = b""
++ source_code_name = b""
++ function_name = b""
+ stack = [{"line": 1,
+@@ -905,7 +916,7 @@ class JerryDebugger(object):
+
+- stack.append({"source": source_code,
+- "source_name": source_code_name,
++ stack.append({"source": source_code.decode("utf8"),
++ "source_name": source_code_name.decode("utf8"),
+ "line": position[0],
+ "column": position[1],
+- "name": function_name,
++ "name": function_name.decode("utf8"),
+ "lines": [],
+@@ -939,4 +950,4 @@ class JerryDebugger(object):
+ if not stack:
+- func_desc["source"] = source_code
+- func_desc["source_name"] = source_code_name
++ func_desc["source"] = source_code.decode("utf8")
++ func_desc["source_name"] = source_code_name.decode("utf8")
+
+@@ -1153,3 +1164,3 @@ class JerryDebugger(object):
+ message = self.current_out + message
+- lines = message.split("\n")
++ lines = message.decode("utf8").split("\n")
+ self.current_out = lines.pop()
+@@ -1162,3 +1173,3 @@ class JerryDebugger(object):
+ message = self.current_log + message
+- lines = message.split("\n")
++ lines = message.decode("utf8").split("\n")
+ self.current_log = lines.pop()
+@@ -1171,7 +1182,7 @@ class JerryDebugger(object):
+ if subtype == JERRY_DEBUGGER_OUTPUT_WARNING:
+- return "%swarning: %s%s" % (self.yellow, self.nocolor, message)
++ return "%swarning: %s%s" % (self.yellow, self.nocolor, message.decode("utf8"))
+ elif subtype == JERRY_DEBUGGER_OUTPUT_ERROR:
+- return "%serr: %s%s" % (self.red, self.nocolor, message)
++ return "%serr: %s%s" % (self.red, self.nocolor, message.decode("utf8"))
+ elif subtype == JERRY_DEBUGGER_OUTPUT_TRACE:
+- return "%strace: %s%s" % (self.blue, self.nocolor, message)
++ return "%strace: %s%s" % (self.blue, self.nocolor, message.decode("utf8"))
+
+@@ -1180,2 +1191,3 @@ class JerryDebugger(object):
+
++ message = message.decode("utf8")
+ if not message.endswith("\n"):
+diff --git a/jerry-debugger/jerry_client_websocket.py b/jerry-debugger/jerry_client_websocket.py
+index fe2c761a..07c75e53 100644
+--- a/jerry-debugger/jerry_client_websocket.py
++++ b/jerry-debugger/jerry_client_websocket.py
+@@ -17,2 +17,3 @@
+ import struct
++import sys
+
+@@ -22,2 +23,13 @@ WEBSOCKET_FIN_BIT = 0x80
+
++
++if sys.version_info.major >= 3:
++ _ord_orig = ord
++ def _ord_compat(c):
++ if isinstance(c, int):
++ return c
++ return _ord_orig(c)
++ # pylint: disable=redefined-builtin
++ ord = _ord_compat
++
++
+ class WebSocket(object):
+@@ -94,3 +106,3 @@ class WebSocket(object):
+ WEBSOCKET_BINARY_FRAME | WEBSOCKET_FIN_BIT,
+- WEBSOCKET_FIN_BIT + struct.unpack(byte_order + "B", packed_data[0])[0],
++ WEBSOCKET_FIN_BIT + struct.unpack(byte_order + "B", packed_data[0:1])[0],
+ 0) + packed_data[1:]
diff --git a/dev-lang/jerryscript/jerryscript-2.4.0-r2.ebuild b/dev-lang/jerryscript/jerryscript-2.4.0-r2.ebuild
new file mode 100644
index 000000000000..369fd92e37ca
--- /dev/null
+++ b/dev-lang/jerryscript/jerryscript-2.4.0-r2.ebuild
@@ -0,0 +1,70 @@
+# Copyright 2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+PYTHON_COMPAT=(python3_{7,8,9})
+inherit cmake python-any-r1
+
+DESCRIPTION="Ultra-lightweight JavaScript engine for the Internet of Things"
+HOMEPAGE="https://github.com/jerryscript-project/jerryscript"
+SRC_URI="https://github.com/jerryscript-project/${PN}/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz"
+
+LICENSE="Apache-2.0"
+SLOT="0"
+KEYWORDS="~amd64"
+IUSE="debugger"
+RDEPEND="debugger? ( ${PYTHON_DEPS} )"
+BDEPEND="${RDEPEND}"
+
+PATCHES=(
+ "${FILESDIR}/jerryscript-2.4.0-python3.patch"
+)
+
+src_prepare() {
+ find . -name CMakeLists.txt -print0 | xargs -0 sed -i \
+ -e "s:lib/pkgconfig:$(get_libdir)/pkgconfig:" \
+ -e "s:DESTINATION lib):DESTINATION $(get_libdir)):" \
+ || die
+ find . -name '*.pc.in' -print0 | xargs -0 sed -i \
+ -e "s|/lib\$|/$(get_libdir)|" \
+ || die
+ cmake_src_prepare
+}
+
+src_configure() {
+ local mycmakeargs=(
+ -DENABLE_STRIP=OFF
+ -DJERRY_DEBUGGER=ON
+ -DJERRY_ERROR_MESSAGES=ON
+ -DJERRY_EXTERNAL_CONTEXT=ON
+ -DJERRY_LINE_INFO=ON
+ -DJERRY_LOGGING=ON
+ -DJERRY_PARSER_DUMP_BYTE_CODE=ON
+ -DJERRY_PARSER=ON
+ -DJERRY_REGEXP_DUMP_BYTE_CODE=ON
+ -DJERRY_SNAPSHOT_EXEC=ON
+ -DJERRY_SNAPSHOT_SAVE=ON
+ )
+ cmake_src_configure
+}
+
+src_install() {
+ local jerry_debugger_dir
+ cmake_src_install
+
+ if use debugger; then
+ jerry_debugger_dir=/usr/$(get_libdir)/jerryscript/jerry-debugger
+ insinto "${jerry_debugger_dir}"
+ doins jerry-debugger/*.py
+ python_optimize "${ED}${jerry_debugger_dir}"
+
+ cat <<-EOF > "${T}/jerry-debugger"
+ #!/bin/sh
+ export PYTHONPATH=${EPREFIX}${jerry_debugger_dir}
+ exec python "${jerry_debugger_dir}/jerry_client.py" "\$@"
+ EOF
+
+ dobin "${T}"/jerry-debugger
+ fi
+}
diff --git a/dev-lang/jerryscript/metadata.xml b/dev-lang/jerryscript/metadata.xml
new file mode 100644
index 000000000000..a062390ea353
--- /dev/null
+++ b/dev-lang/jerryscript/metadata.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer type="person">
+ <email>zmedico@gentoo.org</email>
+ <name>Zac Medico</name>
+ </maintainer>
+ <upstream>
+ <bugs-to>https://github.com/jerryscript-project/jerryscript/issues</bugs-to>
+ <remote-id type="github">jerryscript-project/jerryscript</remote-id>
+ </upstream>
+ <use>
+ <flag name="debugger">Install jerry-debugger</flag>
+ </use>
+</pkgmetadata>