|
@@ -8,14 +8,37 @@
|
8
|
8
|
# friends.
|
9
|
9
|
# Note memcpy, memmove and memset are explicitly exported, otherwise they will
|
10
|
10
|
# be eliminated by the SIDE_MODULE=2 setting - not sure why that happens.
|
|
11
|
+
|
|
12
|
+# This NEEDS to be compiled with emscripten 1.38.47. Newer versions mess with
|
|
13
|
+# malloc and friends and need some more glue code for side modules that I
|
|
14
|
+# haven't quite worked out yet. If you have any idea how to build a SIDE_MODULE
|
|
15
|
+# (or STANDALONE_WASM - as seems to be the new deal) with support for malloc,
|
|
16
|
+# please let me know or file a PR.
|
|
17
|
+
|
|
18
|
+# To install the correct version, issue the following in your emsdk directory:
|
|
19
|
+# ./emsdk install 1.38.47
|
|
20
|
+# ./emsdk activate 1.38.47
|
|
21
|
+# source ./emsdk_env.sh
|
|
22
|
+
|
|
23
|
+# The $EMSCRIPTEN_LIB var needs to point to the correct directory within the sdk
|
|
24
|
+# that has emmalloc.cpp. This usually is $EMSDK/fastcomp/emscripten/system/lib
|
|
25
|
+# but this might differ per system. I don't know.
|
|
26
|
+# per system. There used to be an $EMSCRIPTEN var set by the emsdk_env script
|
|
27
|
+# that pointed to the correct directory, but this seems to have gone too.
|
|
28
|
+
|
|
29
|
+# In conclusion, emscripten encapsulates everything that I hate about native
|
|
30
|
+# development :/
|
|
31
|
+
|
|
32
|
+EMSCRIPTEN_LIB=$EMSDK/fastcomp/emscripten/system/lib
|
|
33
|
+
|
11
|
34
|
emcc \
|
12
|
35
|
src/wasm/mpeg1.c \
|
13
|
36
|
src/wasm/mp2.c \
|
14
|
37
|
src/wasm/buffer.c \
|
15
|
|
- $EMSCRIPTEN/system/lib/emmalloc.cpp \
|
16
|
|
- $EMSCRIPTEN/system/lib/libc/musl/src/string/memcpy.c \
|
17
|
|
- $EMSCRIPTEN/system/lib/libc/musl/src/string/memmove.c \
|
18
|
|
- $EMSCRIPTEN/system/lib/libc/musl/src/string/memset.c \
|
|
38
|
+ $EMSCRIPTEN_LIB/emmalloc.cpp \
|
|
39
|
+ $EMSCRIPTEN_LIB/libc/musl/src/string/memcpy.c \
|
|
40
|
+ $EMSCRIPTEN_LIB/libc/musl/src/string/memmove.c \
|
|
41
|
+ $EMSCRIPTEN_LIB/libc/musl/src/string/memset.c \
|
19
|
42
|
-s WASM=1 \
|
20
|
43
|
-s SIDE_MODULE=2 \
|
21
|
44
|
-s TOTAL_STACK=5242880\
|