public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/sci:master commit in: dev-util/emscripten/files/, dev-util/emscripten-fastcomp/, dev-util/emscripten/
@ 2015-10-25 19:04 Justin Lecher
  0 siblings, 0 replies; only message in thread
From: Justin Lecher @ 2015-10-25 19:04 UTC (permalink / raw
  To: gentoo-commits

commit:     a137c0a7a17e598ffaa31ae80b99b7dc0fd38393
Author:     timeraider@gmx.at <timeraider <AT> gmx <DOT> at>
AuthorDate: Fri Oct 16 23:34:59 2015 +0000
Commit:     Justin Lecher <jlec <AT> gentoo <DOT> org>
CommitDate: Sat Oct 24 14:28:32 2015 +0000
URL:        https://gitweb.gentoo.org/proj/sci.git/commit/?id=a137c0a7

added emscripten and fastcomp
(fastcomp is emscripten's LLVM back-end)

worked on feedback from github

updated emscripten ebuils

corrected dependencies

 .../emscripten-fastcomp-1.34.11.ebuild             | 40 +++++++++++++
 dev-util/emscripten-fastcomp/metadata.xml          |  8 +++
 dev-util/emscripten/emscripten-1.34.11.ebuild      | 66 ++++++++++++++++++++++
 dev-util/emscripten/files/99emscripten             |  1 +
 dev-util/emscripten/files/emscripten.config        | 56 ++++++++++++++++++
 dev-util/emscripten/files/hello_world.cpp          |  5 ++
 dev-util/emscripten/metadata.xml                   |  8 +++
 7 files changed, 184 insertions(+)

diff --git a/dev-util/emscripten-fastcomp/emscripten-fastcomp-1.34.11.ebuild b/dev-util/emscripten-fastcomp/emscripten-fastcomp-1.34.11.ebuild
new file mode 100644
index 0000000..9469880
--- /dev/null
+++ b/dev-util/emscripten-fastcomp/emscripten-fastcomp-1.34.11.ebuild
@@ -0,0 +1,40 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+PYTHON_COMPAT=( python2_7 )
+
+inherit cmake-utils python-single-r1
+
+DESCRIPTION="Emscripten LLVM backend - Fastcomp is the default compiler core for Emscripten"
+HOMEPAGE="http://emscripten.org/"
+SRC_URI="https://github.com/kripken/${PN}/archive/${PV}.tar.gz -> ${P}.tar.gz
+	https://github.com/kripken/${PN}-clang/archive/${PV}.tar.gz -> ${PN}-clang-${PV}.tar.gz"
+KEYWORDS="~amd64 ~x86"
+SLOT="0"
+LICENSE="UoI-NCSA"
+
+REQUIRED_USE="${PYTHON_REQUIRED_USE}"
+
+DEPEND="${PYTHON_DEPS}
+	net-libs/nodejs"
+RDEPEND="${DEPEND}
+	>=virtual/jre-1.5"
+
+src_configure() {
+	# create symlink to tools/clang
+	ln -s "${WORKDIR}/${PN}-clang-${PV}/" "${WORKDIR}/${P}/tools/clang" \
+		|| die "Could not create symlink to tools/clang"
+	local mycmakeargs=(
+		# avoid clashes with sys-devel/llvm
+		-DCMAKE_INSTALL_PREFIX="/usr/share/${P}"
+		-DLLVM_TARGETS_TO_BUILD="X86;JSBackend"
+		-DLLVM_INCLUDE_EXAMPLES=OFF
+		-DLLVM_INCLUDE_TESTS=OFF
+		-DCLANG_INCLUDE_EXAMPLES=OFF
+		-DCLANG_INCLUDE_TESTS=OFF
+	)
+	cmake-utils_src_configure
+}

diff --git a/dev-util/emscripten-fastcomp/metadata.xml b/dev-util/emscripten-fastcomp/metadata.xml
new file mode 100644
index 0000000..c517ec5
--- /dev/null
+++ b/dev-util/emscripten-fastcomp/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>

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 0000000..1ab9f7f
--- /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 0000000..5051089
--- /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 0000000..dc56c92
--- /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 0000000..85daba3
--- /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 0000000..c517ec5
--- /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>


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2015-10-25 19:04 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-25 19:04 [gentoo-commits] proj/sci:master commit in: dev-util/emscripten/files/, dev-util/emscripten-fastcomp/, dev-util/emscripten/ Justin Lecher

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox