-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·43 lines (37 loc) · 1.08 KB
/
Copy pathbuild.sh
File metadata and controls
executable file
·43 lines (37 loc) · 1.08 KB
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/sh
basedir="$(dirname "$(realpath "$0")")"
[ -f "$basedir/Cargo.toml" ] || die "basedir sanity check failed"
. "$basedir/scripts/lib.sh"
release="both"
while [ $# -ge 1 ]; do
case "$1" in
--debug|-d)
release="debug"
;;
--release|-r)
release="release"
;;
*)
die "Invalid option: $1"
;;
esac
shift
done
cd "$basedir" || die "cd basedir failed."
export MAILARCH_CONF_PREFIX="/opt/mailarch"
# Debug build and test
if [ "$release" = "debug" -o "$release" = "both" ]; then
cargo build || die "Cargo build (debug) failed."
cargo test || die "Cargo test failed."
fi
# Release build
if [ "$release" = "release" -o "$release" = "both" ]; then
if which cargo-auditable >/dev/null 2>&1; then
cargo auditable build --release || die "Cargo build (release) failed."
cargo audit --deny warnings bin \
target/release/mailarch \
|| die "Cargo audit failed."
else
cargo build --release || die "Cargo build (release) failed."
fi
fi