-
Notifications
You must be signed in to change notification settings - Fork 7
/
build.sh
executable file
·24 lines (22 loc) · 1.26 KB
/
build.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#! /bin/bash
# Copyright (c) 2018-present, Cruise LLC
#
# This source code is licensed under the Apache License, Version 2.0,
# found in the LICENSE file in the root directory of this source tree.
# You may not use this file except in compliance with the License.
emcc \
lz4/lib/lz4.c \
lz4/lib/xxhash.c \
lz4/lib/lz4frame.c \
-o wasm-lz4.js wasm-lz4.c `# this runs emscripten on the code in wasm-lz4.c` \
-O3 `# compile with all optimizations enabled` \
-s WASM=1 `# compile to .wasm instead of asm.js` \
--pre-js pre.js `# include pre.js at the top of wasm-lz4.js` \
--post-js post.js `# include post.js at the bottom of wasm-lz4.js` \
-s MODULARIZE=1 `# include module boilerplate for better node/webpack interop` \
-s NO_EXIT_RUNTIME=1 `# keep the process around after main exits` \
-s TOTAL_STACK=1048576 `# use a 1MB stack size instead of the default 5MB` \
-s INITIAL_MEMORY=2097152 `# start with a 2MB allocation instead of 16MB, we will dynamically grow` \
-s ALLOW_MEMORY_GROWTH=1 `# need this because we don't know how large decompressed blocks will be` \
-s NODEJS_CATCH_EXIT=0 `# we don't use exit() and catching exit will catch all exceptions` \
-s "EXPORTED_FUNCTIONS=['_malloc', '_free']" `# index.js uses Module._malloc and Module._free`