-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathcompile_web.sh
executable file
·59 lines (48 loc) · 1.53 KB
/
compile_web.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/usr/bin/env bash
set -e
set -x
# install emscripten (copy-paste of documentation)
mkdir -p emscripten
cd emscripten
wget http://s3.amazonaws.com/mozilla-games/emscripten/releases/emsdk-portable.tar.gz -O emsdk-portable.tar.gz
tar -xvf emsdk-portable.tar.gz
cd emsdk-portable
# Fetch the latest registry of available tools.
./emsdk update
# Download and install the latest SDK tools.
./emsdk install latest
# Make the "latest" SDK "active" for the current user. (writes ~/.emscripten file)
./emsdk activate latest
# Activate PATH and other environment variables in the current terminal
source ./emsdk_env.sh
cd ../..
# compile lua
unzip -o lua.zip -d lua
cd lua
emmake make generic local
cd ..
# now compile clingo
git submodule update --init --recursive
cd clingo
mkdir -p build/web
cd build/web
emcmake cmake \
-DCLINGO_BUILD_WEB=On \
-DCLINGO_BUILD_WITH_PYTHON=Off \
-DLUA_INCLUDE_DIR="$(pwd)/../../../lua/install/include" \
-DLUA_LIBRARIES="$(pwd)/../../../lua/install/lib/liblua.a" \
-DCLINGO_BUILD_WITH_LUA=On \
-DCLINGO_REQUIRE_LUA=On \
-DCLINGO_BUILD_SHARED=Off \
-DCLASP_BUILD_WITH_THREADS=Off \
-DCMAKE_VERBOSE_MAKEFILE=On \
-DCMAKE_BUILD_TYPE=release \
-DCMAKE_CXX_FLAGS="-s ALLOW_MEMORY_GROWTH=1 -s MODULARIZE=1" \
-DCMAKE_EXE_LINKER_FLAGS="" \
-DCMAKE_EXE_LINKER_FLAGS_RELEASE="" \
../..
cd ../..
make -C build/web web
# copy the result into the test site
cd .. # return to root
cp ./clingo/build/web/bin/clingo.* ./docs/js/