commit 4e18974aa52191ecb6151d9d421fdb6298c1b5ac
parent 8863a053835177a6d3e541a1967728eb71668a2c
Author: parazyd <parazyd@dyne.org>
Date: Tue, 2 Feb 2021 10:04:55 +0100
dev-util/emscripten: Add 2.0.8.
Diffstat:
8 files changed, 294 insertions(+), 0 deletions(-)
diff --git a/dev-util/emscripten/Manifest b/dev-util/emscripten/Manifest
@@ -0,0 +1 @@
+DIST emscripten-2.0.8.tar.gz 32668549 BLAKE2B 8aa7d04943b2859e267001eb6acdec6da739673a9c8bcae51d5bfa906629d6c260c82eeddbade0f4867ee63d5476cca92b10d0e249abb6f8bc72fa0fa17d9749 SHA512 b46ade5d7ac6d91d106247407ece43f3c2da3458d6a212d0aa648eccbba9a808a56a030f78977dc559d08aee58398ee1f86a4ef2d4d9d40fc9f4d97ec940c365
diff --git a/dev-util/emscripten/emscripten-2.0.8-r1.ebuild b/dev-util/emscripten/emscripten-2.0.8-r1.ebuild
@@ -0,0 +1,60 @@
+# Copyright 2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+# This is a horrible ebuild. Don't use it as an example how to write one.
+# TODO:
+# * remove network access from npm ci
+# * use supported versions of LLVM and binaryen (current it requires git head)
+# * enable tests
+# * use the python eclass properly
+# * fperms +x is wrong
+# * fix many QA issues
+
+EAPI=7
+
+PYTHON_COMPAT=( python3_{7,8} )
+inherit python-single-r1
+
+DESCRIPTION="Emscripten is a complete compiler toolchain to WebAssembly, using LLVM"
+HOMEPAGE="https://emscripten.org"
+SRC_URI="https://github.com/emscripten-core/emscripten/archive/${PV}.tar.gz -> ${P}.tar.gz"
+
+LICENSE="MIT" # TODO: or illinois one
+SLOT="0"
+KEYWORDS=""
+IUSE=""
+RESTRICT="network-sandbox test"
+
+RDEPEND="
+ dev-util/binaryen
+ net-libs/nodejs
+ sys-devel/clang:12[llvm_targets_WebAssembly]
+ virtual/jre
+"
+BDEPEND="
+ net-libs/nodejs
+"
+
+PATCHES=(
+ "${FILESDIR}"/emscripten-2.0.8-wasm-ld.patch
+ "${FILESDIR}"/emscripten-2.0.8-py-runner.patch
+)
+
+src_prepare() {
+ default
+ npm ci || die
+ sed -e "s|GENTOO_PREFIX|${EPREFIX}|" -e "s|GENTOO_LIB|$(get_libdir)|" < "${FILESDIR}/config-r1" > .emscripten || die
+ sed -i -e "s|GENTOO_PREFIX|${EPREFIX}|" -e "s|GENTOO_LIB|$(get_libdir)|" -e "s|GENTOO_PYTHON|${EPYTHON}|" tools/shared.py tools/run_python.sh || die
+}
+
+src_compile() {
+ :
+}
+
+src_install() {
+ dodir /usr/bin
+ tools/create_entry_points.py || die
+ insinto "/usr/$(get_libdir)/emscripten"
+ doins -r .
+ fperms +x "/usr/$(get_libdir)/emscripten"/*
+}
diff --git a/dev-util/emscripten/emscripten-2.0.8.ebuild b/dev-util/emscripten/emscripten-2.0.8.ebuild
@@ -0,0 +1,60 @@
+# Copyright 2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+# This is a horrible ebuild. Don't use it as an example how to write one.
+# TODO:
+# * remove network access from npm ci
+# * use supported versions of LLVM and binaryen (current it requires git head)
+# * enable tests
+# * use the python eclass properly
+# * fperms +x is wrong
+# * fix many QA issues
+
+EAPI=7
+
+PYTHON_COMPAT=( python3_{7,8} )
+inherit python-single-r1
+
+DESCRIPTION="Emscripten is a complete compiler toolchain to WebAssembly, using LLVM"
+HOMEPAGE="https://emscripten.org"
+SRC_URI="https://github.com/emscripten-core/emscripten/archive/${PV}.tar.gz -> ${P}.tar.gz"
+
+LICENSE="MIT" # TODO: or illinois one
+SLOT="0"
+KEYWORDS="~amd64"
+IUSE=""
+RESTRICT="network-sandbox test"
+
+RDEPEND="
+ dev-util/binaryen
+ net-libs/nodejs
+ sys-devel/clang:11[llvm_targets_WebAssembly]
+ virtual/jre
+"
+BDEPEND="
+ net-libs/nodejs
+"
+
+PATCHES=(
+ "${FILESDIR}"/emscripten-2.0.8-wasm-ld.patch
+ "${FILESDIR}"/emscripten-2.0.8-py-runner.patch
+)
+
+src_prepare() {
+ default
+ npm ci || die
+ sed -e "s|GENTOO_PREFIX|${EPREFIX}|" -e "s|GENTOO_LIB|$(get_libdir)|" < "${FILESDIR}/config" > .emscripten || die
+ sed -i -e "s|GENTOO_PREFIX|${EPREFIX}|" -e "s|GENTOO_LIB|$(get_libdir)|" -e "s|GENTOO_PYTHON|${EPYTHON}|" tools/shared.py tools/run_python.sh || die
+}
+
+src_compile() {
+ :
+}
+
+src_install() {
+ dodir /usr/bin
+ tools/create_entry_points.py || die
+ insinto "/usr/$(get_libdir)/emscripten"
+ doins -r .
+ fperms +x "/usr/$(get_libdir)/emscripten"/*
+}
diff --git a/dev-util/emscripten/files/config b/dev-util/emscripten/files/config
@@ -0,0 +1,53 @@
+# Note: If you put paths relative to the home directory, do not forget
+# os.path.expanduser
+#
+# Any config setting <KEY> in this file can be overridden by setting the
+# EM_<KEY> environment variable. For example, settings EM_LLVM_ROOT override
+# the setting in this file.
+#
+# Note: On Windows, remember to escape backslashes! I.e. LLVM='c:\llvm\'
+# is not valid, but LLVM='c:\\llvm\\' and LLVM='c:/llvm/'
+# are.
+
+import os
+
+# This is used by external projects in order to find emscripten. It is not used
+# by emscripten itself.
+EMSCRIPTEN_ROOT = os.path.expanduser(os.getenv('EMSCRIPTEN', 'GENTOO_PREFIX/usr/GENTOO_LIB/emscripten')) # directory
+
+LLVM_ROOT = os.path.expanduser(os.getenv('LLVM', 'GENTOO_PREFIX/usr/lib/llvm/11/bin')) # directory
+BINARYEN_ROOT = os.path.expanduser(os.getenv('BINARYEN', 'GENTOO_PREFIX/usr')) # directory
+
+# Location of the node binary to use for running the JS parts of the compiler.
+# This engine must exist, or nothing can be compiled.
+NODE_JS = os.path.expanduser(os.getenv('NODE', 'GENTOO_PREFIX/usr/bin/node')) # executable
+
+JAVA = 'java' # executable
+
+# added by the gentoo packager, and I don't know what I'm doing
+CACHE = os.path.expanduser(os.getenv('EMSCRIPTEN_CACHE', os.path.join(os.environ['TMPDIR'], 'emscripten-cache-{}'.format(os.getuid()))))
+
+################################################################################
+#
+# Test suite options:
+#
+# Alternative JS engines to use during testing:
+#
+# SPIDERMONKEY_ENGINE = [os.path.expanduser(os.getenv('SPIDERMONKEY', 'js'))] # executable
+# V8_ENGINE = os.path.expanduser(os.getenv('V8', 'd8')) # executable
+#
+# All JS engines to use when running the automatic tests. Not all the engines in
+# this list must exist (if they don't, they will be skipped in the test runner).
+#
+# JS_ENGINES = [NODE_JS] # add V8_ENGINE or SPIDERMONKEY_ENGINE if you have them installed too.
+#
+# WASMER = os.path.expanduser(os.path.join('~', '.wasmer', 'bin', 'wasmer'))
+# WASMTIME = os.path.expanduser(os.path.join('~', 'wasmtime'))
+#
+# Wasm engines to use in STANDALONE_WASM tests.
+#
+# WASM_ENGINES = [] # add WASMER or WASMTIME if you have them installed
+#
+# Other options
+#
+# FROZEN_CACHE = True # never clears the cache, and disallows building to the cache
diff --git a/dev-util/emscripten/files/config-r1 b/dev-util/emscripten/files/config-r1
@@ -0,0 +1,53 @@
+# Note: If you put paths relative to the home directory, do not forget
+# os.path.expanduser
+#
+# Any config setting <KEY> in this file can be overridden by setting the
+# EM_<KEY> environment variable. For example, settings EM_LLVM_ROOT override
+# the setting in this file.
+#
+# Note: On Windows, remember to escape backslashes! I.e. LLVM='c:\llvm\'
+# is not valid, but LLVM='c:\\llvm\\' and LLVM='c:/llvm/'
+# are.
+
+import os
+
+# This is used by external projects in order to find emscripten. It is not used
+# by emscripten itself.
+EMSCRIPTEN_ROOT = os.path.expanduser(os.getenv('EMSCRIPTEN', 'GENTOO_PREFIX/usr/GENTOO_LIB/emscripten')) # directory
+
+LLVM_ROOT = os.path.expanduser(os.getenv('LLVM', 'GENTOO_PREFIX/usr/lib/llvm/12/bin')) # directory
+BINARYEN_ROOT = os.path.expanduser(os.getenv('BINARYEN', 'GENTOO_PREFIX/usr')) # directory
+
+# Location of the node binary to use for running the JS parts of the compiler.
+# This engine must exist, or nothing can be compiled.
+NODE_JS = os.path.expanduser(os.getenv('NODE', 'GENTOO_PREFIX/usr/bin/node')) # executable
+
+JAVA = 'java' # executable
+
+# added by the gentoo packager, and I don't know what I'm doing
+CACHE = os.path.expanduser(os.getenv('EMSCRIPTEN_CACHE', os.path.join(os.environ['TMPDIR'], 'emscripten-cache-{}'.format(os.getuid()))))
+
+################################################################################
+#
+# Test suite options:
+#
+# Alternative JS engines to use during testing:
+#
+# SPIDERMONKEY_ENGINE = [os.path.expanduser(os.getenv('SPIDERMONKEY', 'js'))] # executable
+# V8_ENGINE = os.path.expanduser(os.getenv('V8', 'd8')) # executable
+#
+# All JS engines to use when running the automatic tests. Not all the engines in
+# this list must exist (if they don't, they will be skipped in the test runner).
+#
+# JS_ENGINES = [NODE_JS] # add V8_ENGINE or SPIDERMONKEY_ENGINE if you have them installed too.
+#
+# WASMER = os.path.expanduser(os.path.join('~', '.wasmer', 'bin', 'wasmer'))
+# WASMTIME = os.path.expanduser(os.path.join('~', 'wasmtime'))
+#
+# Wasm engines to use in STANDALONE_WASM tests.
+#
+# WASM_ENGINES = [] # add WASMER or WASMTIME if you have them installed
+#
+# Other options
+#
+# FROZEN_CACHE = True # never clears the cache, and disallows building to the cache
diff --git a/dev-util/emscripten/files/emscripten-2.0.8-py-runner.patch b/dev-util/emscripten/files/emscripten-2.0.8-py-runner.patch
@@ -0,0 +1,44 @@
+diff --git a/tools/create_entry_points.py b/tools/create_entry_points.py
+index ced34f23b..91926614b 100755
+--- a/tools/create_entry_points.py
++++ b/tools/create_entry_points.py
+@@ -41,10 +41,9 @@ def main():
+ sh_file = os.path.join(tools_dir, 'run_python.sh')
+ bat_file = os.path.join(tools_dir, 'run_python.bat')
+ for entry_point in entry_points:
+- if os.path.exists(os.path.join(root_dir, entry_point)):
+- os.remove(os.path.join(root_dir, entry_point))
+ shutil.copy2(sh_file, os.path.join(root_dir, entry_point))
+- shutil.copy2(bat_file, os.path.join(root_dir, entry_point) + '.bat')
++ if not entry_point.startswith('tools'):
++ shutil.copy2(sh_file, os.path.join(os.environ['ED'], 'usr/bin', entry_point))
+
+
+ if __name__ == '__main__':
+diff --git a/tools/run_python.sh b/tools/run_python.sh
+index b9fcf9532..de6e1b60b 100755
+--- a/tools/run_python.sh
++++ b/tools/run_python.sh
+@@ -9,21 +9,4 @@
+ # To modify this file, edit `tools/run_python.sh` and then run
+ # `tools/create_entry_points.py`
+
+-if [ -z "$PYTHON" ]; then
+- PYTHON=$EMSDK_PYTHON
+-fi
+-
+-if [ -z "$PYTHON" ]; then
+- PYTHON=$(which python3 2> /dev/null)
+-fi
+-
+-if [ -z "$PYTHON" ]; then
+- PYTHON=$(which python 2> /dev/null)
+-fi
+-
+-if [ -z "$PYTHON" ]; then
+- echo 'unable to find python in $PATH'
+- exit 1
+-fi
+-
+-exec "$PYTHON" "$0.py" "$@"
++GENTOO_PYTHON "GENTOO_PREFIX/usr/GENTOO_LIB/emscripten/$(basename $0).py" "$@"
diff --git a/dev-util/emscripten/files/emscripten-2.0.8-wasm-ld.patch b/dev-util/emscripten/files/emscripten-2.0.8-wasm-ld.patch
@@ -0,0 +1,12 @@
+diff --git a/tools/shared.py b/tools/shared.py
+index 87dde559f..72c9e74cf 100644
+--- a/tools/shared.py
++++ b/tools/shared.py
+@@ -1436,6 +1436,7 @@ LLVM_COMPILER = os.path.expanduser(build_llvm_tool_path(exe_suffix('llc')))
+ LLVM_DWARFDUMP = os.path.expanduser(build_llvm_tool_path(exe_suffix('llvm-dwarfdump')))
+ LLVM_OBJCOPY = os.path.expanduser(build_llvm_tool_path(exe_suffix('llvm-objcopy')))
+ WASM_LD = os.path.expanduser(build_llvm_tool_path(exe_suffix('wasm-ld')))
++WASM_LD = 'GENTOO_PREFIX/usr/bin/wasm-ld'
+
+ EMCC = bat_suffix(path_from_root('emcc'))
+ EMXX = bat_suffix(path_from_root('em++'))
diff --git a/dev-util/emscripten/metadata.xml b/dev-util/emscripten/metadata.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer type="person">
+ <email>alexey+gentoo@asokolov.org</email>
+ <name>Alexey Sokolov</name>
+ </maintainer>
+ <upstream>
+ <remote-id type="github">emscripten-core/emscripten</remote-id>
+ </upstream>
+</pkgmetadata>