aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortimeraider@gmx.at <timeraider@gmx.at>2015-10-17 01:34:59 +0200
committertimeraider@gmx.at <timeraider@gmx.at>2015-10-24 16:28:32 +0200
commita137c0a7a17e598ffaa31ae80b99b7dc0fd38393 (patch)
tree3e991e50c20363997e2c6de68da394c4d45e66e7 /dev-util/emscripten
parentsci-chemistry/talosn: Version Bump (diff)
downloadsci-a137c0a7a17e598ffaa31ae80b99b7dc0fd38393.tar.gz
sci-a137c0a7a17e598ffaa31ae80b99b7dc0fd38393.tar.bz2
sci-a137c0a7a17e598ffaa31ae80b99b7dc0fd38393.zip
added emscripten and fastcomp
(fastcomp is emscripten's LLVM back-end) worked on feedback from github updated emscripten ebuils corrected dependencies
Diffstat (limited to 'dev-util/emscripten')
-rw-r--r--dev-util/emscripten/Manifest1
-rw-r--r--dev-util/emscripten/emscripten-1.34.11.ebuild66
-rw-r--r--dev-util/emscripten/files/99emscripten1
-rw-r--r--dev-util/emscripten/files/emscripten.config56
-rw-r--r--dev-util/emscripten/files/hello_world.cpp5
-rw-r--r--dev-util/emscripten/metadata.xml8
6 files changed, 137 insertions, 0 deletions
diff --git a/dev-util/emscripten/Manifest b/dev-util/emscripten/Manifest
new file mode 100644
index 000000000..0d243047a
--- /dev/null
+++ b/dev-util/emscripten/Manifest
@@ -0,0 +1 @@
+DIST emscripten-1.34.11.tar.gz 31637704 SHA256 4b2790279372ea016dbe64eda95cfde3f2a695e369c5f7cd9a62e2f69991ceb7 SHA512 8ecd3972b6ea3ccf27a8ab2532716910cf1d0425e3708a3a4b9808182c2662591b6389cbf27bc98a2b96ecb8948fc1e0bc3204cb3c88bb349f29c0ba55758088 WHIRLPOOL 266782cdbc44c3ccb036ea8f02dafc2d7fe3f5d1ea1aa5fe8d2deff30c73b08a95dd1d22251df9d4f666277ea73da5bc88ade3b5ce1531b7158b112be05e3b2e
diff --git a/dev-util/emscripten/emscripten-1.34.11.ebuild b/dev-util/emscripten/emscripten-1.34.11.ebuild
new file mode 100644
index 000000000..1ab9f7f1c
--- /dev/null
+++ b/dev-util/emscripten/emscripten-1.34.11.ebuild
@@ -0,0 +1,66 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+PYTHON_COMPAT=( python2_7 )
+
+inherit python-single-r1
+
+DESCRIPTION="LLVM-to-JavaScript Compiler"
+HOMEPAGE="http://emscripten.org/"
+SRC_URI="https://github.com/kripken/${PN}/archive/${PV}.tar.gz -> ${P}.tar.gz"
+KEYWORDS="~amd64 ~x86"
+SLOT="0"
+LICENSE="UoI-NCSA"
+
+REQUIRED_USE="${PYTHON_REQUIRED_USE}"
+
+DEPEND="${PYTHON_DEPS}
+ =dev-util/emscripten-fastcomp-1.34.11
+ net-libs/nodejs"
+RDEPEND="${DEPEND}"
+
+DEST="/usr/share/"
+TEST="${WORKDIR}/test/"
+
+src_prepare() {
+ cp "${FILESDIR}/emscripten.config" "${S}/" || die "could not copy .config file"
+ cp "${FILESDIR}/99emscripten" "${S}/" || die "could not copy 99emscripten file"
+}
+
+src_test() {
+ mkdir "${TEST}" || die "Could not create test directory!"
+ cp "${FILESDIR}/hello_world.cpp" "${TEST}" || die "Could not copy example file"
+ cp "${FILESDIR}/emscripten.config" "${TEST}" || die "Could not copy config file"
+ sed -i -e "/^EMSCRIPTEN_ROOT/s|/usr/share/|${S}|" \
+ "${TEST}/emscripten.config" || die "Could not adjust path for testing"
+ export EM_CONFIG="${TEST}/emscripten.config" || die "Could not export variable"
+ ../"${P}/emcc" "${TEST}/hello_world.cpp" -o "${TEST}/hello_world.js" || \
+ die "Error during executing emcc!"
+ test -f "${TEST}/hello_world.js" || die "Could not find '${TEST}/hello_world.js'"
+ OUT=$(/usr/bin/node "${TEST}/hello_world.js") || \
+ die "Could not execute /usr/bin/node"
+ EXP=$(echo -e -n 'Hello World!\n \n') || die "Could not create expected string"
+ if [ "${OUT}" != "${EXP}" ]; then
+ die "Expected '${EXP}' but got '${OUT}'!"
+ fi
+ rm -r "${TEST}" || die "Could not clean-up '${TEST}'"
+}
+
+src_install() {
+ dodir ${DEST}/${P}
+ cp -R "${S}/" "${D}/${DEST}" || die "Could not install files"
+ dosym ../share/${P}/emcc /usr/bin/emcc
+ dosym ../share/${P}/emcmake /usr/bin/emcmake
+ doenvd 99emscripten
+ ewarn "If you consider using emscripten in an active shell,"\
+ "please execute 'source /etc/profile'"
+}
+
+pkg_postinst() {
+ elog "Running emscripten initialization, may take a few seconds..."
+ export EM_CONFIG="${DEST}/${P}/emscripten.config" || die "Could not export variable"
+ /usr/bin/emcc -v || die "Could not run emcc initialization"
+}
diff --git a/dev-util/emscripten/files/99emscripten b/dev-util/emscripten/files/99emscripten
new file mode 100644
index 000000000..505108912
--- /dev/null
+++ b/dev-util/emscripten/files/99emscripten
@@ -0,0 +1 @@
+EM_CONFIG=/usr/share/emscripten-1.34.11/emscripten.config
diff --git a/dev-util/emscripten/files/emscripten.config b/dev-util/emscripten/files/emscripten.config
new file mode 100644
index 000000000..dc56c9264
--- /dev/null
+++ b/dev-util/emscripten/files/emscripten.config
@@ -0,0 +1,56 @@
+
+# Note: If you put paths relative to the home directory, do not forget os.path.expanduser
+
+# Note: On Windows, remember to escape backslashes! I.e. EMSCRIPTEN_ROOT='c:\emscripten\' is not valid, but EMSCRIPTEN_ROOT='c:\\emscripten\\' and EMSCRIPTEN_ROOT='c:/emscripten/' are.
+
+import os
+
+# this helps projects using emscripten find it
+EMSCRIPTEN_ROOT = os.path.expanduser(os.getenv('EMSCRIPTEN') or '/usr/share/emscripten-1.34.11') # directory
+LLVM_ROOT = os.path.expanduser(os.getenv('LLVM') or '/usr/share/emscripten-fastcomp-1.34.11/bin') # directory
+
+# If not specified, defaults to sys.executable.
+#PYTHON = 'python'
+
+# Add this if you have manually built the JS optimizer executable (in Emscripten/tools/optimizer) and want to run it from a custom location.
+# Alternatively, you can set this as the environment variable EMSCRIPTEN_NATIVE_OPTIMIZER.
+# EMSCRIPTEN_NATIVE_OPTIMIZER='/path/to/custom/optimizer(.exe)'
+
+# See below for notes on which JS engine(s) you need
+NODE_JS = os.path.expanduser(os.getenv('NODE') or '/usr/bin/node') # executable
+SPIDERMONKEY_ENGINE = [os.path.expanduser(os.getenv('SPIDERMONKEY') or 'js')] # executable
+V8_ENGINE = os.path.expanduser(os.getenv('V8') or 'd8') # executable
+
+JAVA = 'java' # executable
+
+TEMP_DIR = '/tmp'
+
+CRUNCH = os.path.expanduser(os.getenv('CRUNCH') or 'crunch') # executable
+
+#CLOSURE_COMPILER = '..' # define this to not use the bundled version
+
+########################################################################################################
+
+
+# Pick the JS engine to use for running the compiler. This engine must exist, or
+# nothing can be compiled.
+#
+# Recommendation: If you already have node installed, use that. Otherwise, build v8 or
+# spidermonkey from source. Any of these three is fine, as long as it's
+# a recent version (especially for v8 and spidermonkey).
+
+COMPILER_ENGINE = NODE_JS
+#COMPILER_ENGINE = V8_ENGINE
+#COMPILER_ENGINE = SPIDERMONKEY_ENGINE
+
+
+# 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).
+#
+# Recommendation: If you already have node installed, use that. If you can, also build
+# spidermonkey from source as well to get more test coverage (node can't
+# run all the tests due to node issue 1669). v8 is currently not recommended
+# here because of v8 issue 1822.
+
+JS_ENGINES = [NODE_JS] # add this if you have spidermonkey installed too, SPIDERMONKEY_ENGINE]
+
diff --git a/dev-util/emscripten/files/hello_world.cpp b/dev-util/emscripten/files/hello_world.cpp
new file mode 100644
index 000000000..85daba3e4
--- /dev/null
+++ b/dev-util/emscripten/files/hello_world.cpp
@@ -0,0 +1,5 @@
+#include <iostream>
+int main(int argc, char ** argv) {
+ std::cout << "Hello World!" << std::endl;
+}
+
diff --git a/dev-util/emscripten/metadata.xml b/dev-util/emscripten/metadata.xml
new file mode 100644
index 000000000..c517ec517
--- /dev/null
+++ b/dev-util/emscripten/metadata.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer>
+ <email>harald.weiner@jku.at</email>
+ <name>Harald Weiner</name>
+ </maintainer>
+</pkgmetadata>