forked from cisco/lal-build-manager
-
Notifications
You must be signed in to change notification settings - Fork 1
/
BUILD
executable file
·45 lines (43 loc) · 1.54 KB
/
BUILD
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
#!/bin/bash
main() {
# build in the currently available muslrust container
set -e
if [ ! -d ~/.cargo/registry ]; then
echo "Ensure you have created a cargo-cache docker volume to speed up subsequent builds"
echo "If this is your first build, this is normal"
echo "Otherwise, please 'docker volume create cargo-cache' and ensure it is specified in your lal config"
echo "Continuing from blank cache..."
fi
if [[ $1 == "lal" ]]; then
mkdir -p OUTPUT/{bin,share/lal/configs}
cp configs/*.json OUTPUT/share/lal/configs/
cp lal.complete* OUTPUT/share/lal/
if [[ $2 == "slim" ]]; then
(set -x; cargo build --no-default-features --release --verbose)
cp ./target/x86_64-unknown-linux-musl/release/lal OUTPUT/bin/
elif [[ $2 == "release" ]]; then
(set -x; cargo build --release --verbose)
cp ./target/x86_64-unknown-linux-musl/release/lal OUTPUT/bin/
elif [[ $2 == "debug" ]]; then
(set -x; cargo build --verbose)
cp ./target/x86_64-unknown-linux-musl/debug/lal OUTPUT/bin/
else
echo "No such configuration $2 found"
exit 2
fi
elif [[ $1 == "lal-unit-tests" ]]; then
cargo build --test testmain
cp ./target/x86_64-unknown-linux-musl/debug/testmain-* OUTPUT/
rm -f OUTPUT/testmain-*.d
echo "Please run the testmain executable in ./OUTPUT/"
else
echo "No such component $1 found"
exit 2
fi
}
# If we were not sourced as a library, pass arguments onto main
if [ "$0" = "${BASH_SOURCE[0]}" ]; then
main "$@"
else
echo "${BASH_SOURCE[0]} sourced"
fi