-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathnacl.sh
executable file
·52 lines (43 loc) · 1.18 KB
/
nacl.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
#!/bin/bash
#
# nacl.sh [run | manifest]
#
# `NACL_SDK_ROOT` environment variable must be set to use this script.
#
# The following alternative launches are available:
#
# - `run`: creates symlinks to compiled data archives, HTML pages etc. in the target directory,
# starts a simple python web server in that directory at port 8000 (`python -m http.server`) and
# opens `localhost:8000` in chromium browser to test the web-based NaCl port.
# - `manifest`: writes `share/openzone/manifest.json` file that contains list of game packeges
# together with their timestamps. Needed by NaCl to update cached game packages.
#
set -e
chromium="/usr/bin/chromium"
function run() {
mkdir -p build/PNaCl/src/tools
# Just create symlinks instead of copying.
for i in doc etc/nacl/nacl.* etc/nacl/openzone.* share/openzone/*.{zip,json}; do
[[ -e "$i" ]] && ln -sf "../../../../$i" build/PNaCl/src/tools
done
cd build/PNaCl/src/tools
python3 -m http.server &
serverPID=$!
sleep 3
$chromium "http://localhost:8000/openzone.en.html" || true
kill $serverPID
}
function manifest() {
./gen-manifest.sh
}
case $1 in
run)
run
;;
debug)
debug
;;
manifest)
manifest
;;
esac