1 |
commit: a137c0a7a17e598ffaa31ae80b99b7dc0fd38393 |
2 |
Author: timeraider@×××.at <timeraider <AT> gmx <DOT> at> |
3 |
AuthorDate: Fri Oct 16 23:34:59 2015 +0000 |
4 |
Commit: Justin Lecher <jlec <AT> gentoo <DOT> org> |
5 |
CommitDate: Sat Oct 24 14:28:32 2015 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/sci.git/commit/?id=a137c0a7 |
7 |
|
8 |
added emscripten and fastcomp |
9 |
(fastcomp is emscripten's LLVM back-end) |
10 |
|
11 |
worked on feedback from github |
12 |
|
13 |
updated emscripten ebuils |
14 |
|
15 |
corrected dependencies |
16 |
|
17 |
.../emscripten-fastcomp-1.34.11.ebuild | 40 +++++++++++++ |
18 |
dev-util/emscripten-fastcomp/metadata.xml | 8 +++ |
19 |
dev-util/emscripten/emscripten-1.34.11.ebuild | 66 ++++++++++++++++++++++ |
20 |
dev-util/emscripten/files/99emscripten | 1 + |
21 |
dev-util/emscripten/files/emscripten.config | 56 ++++++++++++++++++ |
22 |
dev-util/emscripten/files/hello_world.cpp | 5 ++ |
23 |
dev-util/emscripten/metadata.xml | 8 +++ |
24 |
7 files changed, 184 insertions(+) |
25 |
|
26 |
diff --git a/dev-util/emscripten-fastcomp/emscripten-fastcomp-1.34.11.ebuild b/dev-util/emscripten-fastcomp/emscripten-fastcomp-1.34.11.ebuild |
27 |
new file mode 100644 |
28 |
index 0000000..9469880 |
29 |
--- /dev/null |
30 |
+++ b/dev-util/emscripten-fastcomp/emscripten-fastcomp-1.34.11.ebuild |
31 |
@@ -0,0 +1,40 @@ |
32 |
+# Copyright 1999-2015 Gentoo Foundation |
33 |
+# Distributed under the terms of the GNU General Public License v2 |
34 |
+# $Id$ |
35 |
+ |
36 |
+EAPI=5 |
37 |
+ |
38 |
+PYTHON_COMPAT=( python2_7 ) |
39 |
+ |
40 |
+inherit cmake-utils python-single-r1 |
41 |
+ |
42 |
+DESCRIPTION="Emscripten LLVM backend - Fastcomp is the default compiler core for Emscripten" |
43 |
+HOMEPAGE="http://emscripten.org/" |
44 |
+SRC_URI="https://github.com/kripken/${PN}/archive/${PV}.tar.gz -> ${P}.tar.gz |
45 |
+ https://github.com/kripken/${PN}-clang/archive/${PV}.tar.gz -> ${PN}-clang-${PV}.tar.gz" |
46 |
+KEYWORDS="~amd64 ~x86" |
47 |
+SLOT="0" |
48 |
+LICENSE="UoI-NCSA" |
49 |
+ |
50 |
+REQUIRED_USE="${PYTHON_REQUIRED_USE}" |
51 |
+ |
52 |
+DEPEND="${PYTHON_DEPS} |
53 |
+ net-libs/nodejs" |
54 |
+RDEPEND="${DEPEND} |
55 |
+ >=virtual/jre-1.5" |
56 |
+ |
57 |
+src_configure() { |
58 |
+ # create symlink to tools/clang |
59 |
+ ln -s "${WORKDIR}/${PN}-clang-${PV}/" "${WORKDIR}/${P}/tools/clang" \ |
60 |
+ || die "Could not create symlink to tools/clang" |
61 |
+ local mycmakeargs=( |
62 |
+ # avoid clashes with sys-devel/llvm |
63 |
+ -DCMAKE_INSTALL_PREFIX="/usr/share/${P}" |
64 |
+ -DLLVM_TARGETS_TO_BUILD="X86;JSBackend" |
65 |
+ -DLLVM_INCLUDE_EXAMPLES=OFF |
66 |
+ -DLLVM_INCLUDE_TESTS=OFF |
67 |
+ -DCLANG_INCLUDE_EXAMPLES=OFF |
68 |
+ -DCLANG_INCLUDE_TESTS=OFF |
69 |
+ ) |
70 |
+ cmake-utils_src_configure |
71 |
+} |
72 |
|
73 |
diff --git a/dev-util/emscripten-fastcomp/metadata.xml b/dev-util/emscripten-fastcomp/metadata.xml |
74 |
new file mode 100644 |
75 |
index 0000000..c517ec5 |
76 |
--- /dev/null |
77 |
+++ b/dev-util/emscripten-fastcomp/metadata.xml |
78 |
@@ -0,0 +1,8 @@ |
79 |
+<?xml version="1.0" encoding="UTF-8"?> |
80 |
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> |
81 |
+<pkgmetadata> |
82 |
+ <maintainer> |
83 |
+ <email>harald.weiner@×××.at</email> |
84 |
+ <name>Harald Weiner</name> |
85 |
+ </maintainer> |
86 |
+</pkgmetadata> |
87 |
|
88 |
diff --git a/dev-util/emscripten/emscripten-1.34.11.ebuild b/dev-util/emscripten/emscripten-1.34.11.ebuild |
89 |
new file mode 100644 |
90 |
index 0000000..1ab9f7f |
91 |
--- /dev/null |
92 |
+++ b/dev-util/emscripten/emscripten-1.34.11.ebuild |
93 |
@@ -0,0 +1,66 @@ |
94 |
+# Copyright 1999-2015 Gentoo Foundation |
95 |
+# Distributed under the terms of the GNU General Public License v2 |
96 |
+# $Id$ |
97 |
+ |
98 |
+EAPI=5 |
99 |
+ |
100 |
+PYTHON_COMPAT=( python2_7 ) |
101 |
+ |
102 |
+inherit python-single-r1 |
103 |
+ |
104 |
+DESCRIPTION="LLVM-to-JavaScript Compiler" |
105 |
+HOMEPAGE="http://emscripten.org/" |
106 |
+SRC_URI="https://github.com/kripken/${PN}/archive/${PV}.tar.gz -> ${P}.tar.gz" |
107 |
+KEYWORDS="~amd64 ~x86" |
108 |
+SLOT="0" |
109 |
+LICENSE="UoI-NCSA" |
110 |
+ |
111 |
+REQUIRED_USE="${PYTHON_REQUIRED_USE}" |
112 |
+ |
113 |
+DEPEND="${PYTHON_DEPS} |
114 |
+ =dev-util/emscripten-fastcomp-1.34.11 |
115 |
+ net-libs/nodejs" |
116 |
+RDEPEND="${DEPEND}" |
117 |
+ |
118 |
+DEST="/usr/share/" |
119 |
+TEST="${WORKDIR}/test/" |
120 |
+ |
121 |
+src_prepare() { |
122 |
+ cp "${FILESDIR}/emscripten.config" "${S}/" || die "could not copy .config file" |
123 |
+ cp "${FILESDIR}/99emscripten" "${S}/" || die "could not copy 99emscripten file" |
124 |
+} |
125 |
+ |
126 |
+src_test() { |
127 |
+ mkdir "${TEST}" || die "Could not create test directory!" |
128 |
+ cp "${FILESDIR}/hello_world.cpp" "${TEST}" || die "Could not copy example file" |
129 |
+ cp "${FILESDIR}/emscripten.config" "${TEST}" || die "Could not copy config file" |
130 |
+ sed -i -e "/^EMSCRIPTEN_ROOT/s|/usr/share/|${S}|" \ |
131 |
+ "${TEST}/emscripten.config" || die "Could not adjust path for testing" |
132 |
+ export EM_CONFIG="${TEST}/emscripten.config" || die "Could not export variable" |
133 |
+ ../"${P}/emcc" "${TEST}/hello_world.cpp" -o "${TEST}/hello_world.js" || \ |
134 |
+ die "Error during executing emcc!" |
135 |
+ test -f "${TEST}/hello_world.js" || die "Could not find '${TEST}/hello_world.js'" |
136 |
+ OUT=$(/usr/bin/node "${TEST}/hello_world.js") || \ |
137 |
+ die "Could not execute /usr/bin/node" |
138 |
+ EXP=$(echo -e -n 'Hello World!\n \n') || die "Could not create expected string" |
139 |
+ if [ "${OUT}" != "${EXP}" ]; then |
140 |
+ die "Expected '${EXP}' but got '${OUT}'!" |
141 |
+ fi |
142 |
+ rm -r "${TEST}" || die "Could not clean-up '${TEST}'" |
143 |
+} |
144 |
+ |
145 |
+src_install() { |
146 |
+ dodir ${DEST}/${P} |
147 |
+ cp -R "${S}/" "${D}/${DEST}" || die "Could not install files" |
148 |
+ dosym ../share/${P}/emcc /usr/bin/emcc |
149 |
+ dosym ../share/${P}/emcmake /usr/bin/emcmake |
150 |
+ doenvd 99emscripten |
151 |
+ ewarn "If you consider using emscripten in an active shell,"\ |
152 |
+ "please execute 'source /etc/profile'" |
153 |
+} |
154 |
+ |
155 |
+pkg_postinst() { |
156 |
+ elog "Running emscripten initialization, may take a few seconds..." |
157 |
+ export EM_CONFIG="${DEST}/${P}/emscripten.config" || die "Could not export variable" |
158 |
+ /usr/bin/emcc -v || die "Could not run emcc initialization" |
159 |
+} |
160 |
|
161 |
diff --git a/dev-util/emscripten/files/99emscripten b/dev-util/emscripten/files/99emscripten |
162 |
new file mode 100644 |
163 |
index 0000000..5051089 |
164 |
--- /dev/null |
165 |
+++ b/dev-util/emscripten/files/99emscripten |
166 |
@@ -0,0 +1 @@ |
167 |
+EM_CONFIG=/usr/share/emscripten-1.34.11/emscripten.config |
168 |
|
169 |
diff --git a/dev-util/emscripten/files/emscripten.config b/dev-util/emscripten/files/emscripten.config |
170 |
new file mode 100644 |
171 |
index 0000000..dc56c92 |
172 |
--- /dev/null |
173 |
+++ b/dev-util/emscripten/files/emscripten.config |
174 |
@@ -0,0 +1,56 @@ |
175 |
+ |
176 |
+# Note: If you put paths relative to the home directory, do not forget os.path.expanduser |
177 |
+ |
178 |
+# 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. |
179 |
+ |
180 |
+import os |
181 |
+ |
182 |
+# this helps projects using emscripten find it |
183 |
+EMSCRIPTEN_ROOT = os.path.expanduser(os.getenv('EMSCRIPTEN') or '/usr/share/emscripten-1.34.11') # directory |
184 |
+LLVM_ROOT = os.path.expanduser(os.getenv('LLVM') or '/usr/share/emscripten-fastcomp-1.34.11/bin') # directory |
185 |
+ |
186 |
+# If not specified, defaults to sys.executable. |
187 |
+#PYTHON = 'python' |
188 |
+ |
189 |
+# Add this if you have manually built the JS optimizer executable (in Emscripten/tools/optimizer) and want to run it from a custom location. |
190 |
+# Alternatively, you can set this as the environment variable EMSCRIPTEN_NATIVE_OPTIMIZER. |
191 |
+# EMSCRIPTEN_NATIVE_OPTIMIZER='/path/to/custom/optimizer(.exe)' |
192 |
+ |
193 |
+# See below for notes on which JS engine(s) you need |
194 |
+NODE_JS = os.path.expanduser(os.getenv('NODE') or '/usr/bin/node') # executable |
195 |
+SPIDERMONKEY_ENGINE = [os.path.expanduser(os.getenv('SPIDERMONKEY') or 'js')] # executable |
196 |
+V8_ENGINE = os.path.expanduser(os.getenv('V8') or 'd8') # executable |
197 |
+ |
198 |
+JAVA = 'java' # executable |
199 |
+ |
200 |
+TEMP_DIR = '/tmp' |
201 |
+ |
202 |
+CRUNCH = os.path.expanduser(os.getenv('CRUNCH') or 'crunch') # executable |
203 |
+ |
204 |
+#CLOSURE_COMPILER = '..' # define this to not use the bundled version |
205 |
+ |
206 |
+######################################################################################################## |
207 |
+ |
208 |
+ |
209 |
+# Pick the JS engine to use for running the compiler. This engine must exist, or |
210 |
+# nothing can be compiled. |
211 |
+# |
212 |
+# Recommendation: If you already have node installed, use that. Otherwise, build v8 or |
213 |
+# spidermonkey from source. Any of these three is fine, as long as it's |
214 |
+# a recent version (especially for v8 and spidermonkey). |
215 |
+ |
216 |
+COMPILER_ENGINE = NODE_JS |
217 |
+#COMPILER_ENGINE = V8_ENGINE |
218 |
+#COMPILER_ENGINE = SPIDERMONKEY_ENGINE |
219 |
+ |
220 |
+ |
221 |
+# All JS engines to use when running the automatic tests. Not all the engines in this list |
222 |
+# must exist (if they don't, they will be skipped in the test runner). |
223 |
+# |
224 |
+# Recommendation: If you already have node installed, use that. If you can, also build |
225 |
+# spidermonkey from source as well to get more test coverage (node can't |
226 |
+# run all the tests due to node issue 1669). v8 is currently not recommended |
227 |
+# here because of v8 issue 1822. |
228 |
+ |
229 |
+JS_ENGINES = [NODE_JS] # add this if you have spidermonkey installed too, SPIDERMONKEY_ENGINE] |
230 |
+ |
231 |
|
232 |
diff --git a/dev-util/emscripten/files/hello_world.cpp b/dev-util/emscripten/files/hello_world.cpp |
233 |
new file mode 100644 |
234 |
index 0000000..85daba3 |
235 |
--- /dev/null |
236 |
+++ b/dev-util/emscripten/files/hello_world.cpp |
237 |
@@ -0,0 +1,5 @@ |
238 |
+#include <iostream> |
239 |
+int main(int argc, char ** argv) { |
240 |
+ std::cout << "Hello World!" << std::endl; |
241 |
+} |
242 |
+ |
243 |
|
244 |
diff --git a/dev-util/emscripten/metadata.xml b/dev-util/emscripten/metadata.xml |
245 |
new file mode 100644 |
246 |
index 0000000..c517ec5 |
247 |
--- /dev/null |
248 |
+++ b/dev-util/emscripten/metadata.xml |
249 |
@@ -0,0 +1,8 @@ |
250 |
+<?xml version="1.0" encoding="UTF-8"?> |
251 |
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> |
252 |
+<pkgmetadata> |
253 |
+ <maintainer> |
254 |
+ <email>harald.weiner@×××.at</email> |
255 |
+ <name>Harald Weiner</name> |
256 |
+ </maintainer> |
257 |
+</pkgmetadata> |