aboutsummaryrefslogtreecommitdiffstats
path: root/web/build-site
blob: 7dd78f3ae92e699804bfb6dac1841d1015d4bee8 (plain) (blame)
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
#!/bin/sh
# Assemble the whole website into build/www:
#
#     /            web/             the front page (this directory)
#     /docs/       contrib/gen-docs the rendered documentation
#     /demo/       web/demo/        the in-browser machine, on its own page
#
#     web/build-site               everything (or: make www)
#     NO_DEMO=1 web/build-site     skip the demo (it cross-compiles a
#                                  guest and needs zig + e2fsprogs)
#
# The output is only static files. Serve it with anything that serves a
# directory; the one condition is .wasm as application/wasm, which
# `web/demo/serve --dir build/www` handles locally.

set -eu

here="$(cd "$(dirname "$0")" && pwd)"
root="$(dirname "$here")"
out="$root/build/www"

rm -rf "$out"
mkdir -p "$out"

# For now slosh.foo is a coming-soon page; the full site is assembled only
# when asked (FULL=1) while it is being finished.
if [ "${FULL:-0}" != 1 ]; then
    cp "$here/coming-soon.html" "$out/index.html"
    echo "build-site: $out (coming soon -- FULL=1 for the real site)"
    exit 0
fi

# The front page.
cp "$here/index.html" "$here/site.css" "$here/install.sh" "$out/"
cp "$here/slosh-preview.mp4" "$out/"

# The docs, rendered by the same generator `make docs` uses.
python3 "$root/contrib/gen-docs" "$out/docs"

# The demo, assembled by its own Makefile, on its own page.
if [ "${NO_DEMO:-0}" = 1 ]; then
    echo "build-site: skipping demo (NO_DEMO=1)"
else
    make -C "$here/demo" site
    mkdir -p "$out/demo"
    cp -R "$here/demo/build/site/." "$out/demo/"
fi

echo "build-site: $out"
echo "build-site: serve with: web/demo/serve --dir build/www"