ptth/build_ptth_server.bash

42 lines
999 B
Bash
Raw Normal View History

#!/usr/bin/env bash
# Use: ./build.bash
# Makes a release build of ptth_server and packages all necessary files
# such as images, Handlebars templates, etc.
# This script is version-specific. If you need to build an old version,
# check out that version from Git and call the old version of this
# script. This can be automated with `git archive`.
set -euo pipefail
export LC_ALL="C"
TEMP_GIBBERISH="ptth_server_build_BIHWLQXQ"
DEST="$TEMP_GIBBERISH/ptth"
rm -rf "$TEMP_GIBBERISH"
mkdir "$TEMP_GIBBERISH"
mkdir "$DEST"
cargo build --release -p ptth_server
cargo build --release -p quic_demo --bin quic_demo_end_server
mkdir -p "$DEST/handlebars/server"
rsync -r handlebars/server/ "$DEST/handlebars/server/"
cp target/release/ptth_server "$DEST/"
cp target/release/quic_demo_end_server "$DEST/"
(
cd "$TEMP_GIBBERISH" || exit
find ptth/ -print0 | \
sort -z | \
tar --mtime='1970-01-01' --no-recursion --null -T - -cf - > \
ptth_server.tar.temp
mv ptth_server.tar.temp ptth_server.tar
)