-
Notifications
You must be signed in to change notification settings - Fork 48
/
build.sh
executable file
·43 lines (35 loc) · 777 Bytes
/
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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/bash
set -e
EMCC=~/src/emscripten/emcc
JOBS=4
MYDIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
stage1() {
sh $MYDIR/sys/unix/setup.sh
make CC=$EMCC -j$JOBS
make install CC=$EMCC PREFIX=$MYDIR/build
rm $MYDIR/build/nethack/nethack
rm $MYDIR/build/nethack/recover
cp $MYDIR/web/nethackrc.default $MYDIR/build/nethack/
}
stage2() {
pushd build
cp ../src/nethack nethack.bc
$EMCC nethack.bc \
-O3 \
-Oz \
-o browserhack.js \
-s EMTERPRETIFY=1 \
-s EMTERPRETIFY_ASYNC=1 \
--memory-init-file 1 \
--js-library ../win/web/nethack_lib.js \
--preload-file nethack \
popd
cp build/browserhack.js web/
cp build/browserhack.js.mem web/
cp build/browserhack.data web/
pushd web
python ../win/web/tile2name.py
popd
}
stage1
stage2