forked from pact-foundation/pact-core-mock-server
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrelease-linux.sh
More file actions
executable file
·43 lines (33 loc) · 1.12 KB
/
Copy pathrelease-linux.sh
File metadata and controls
executable file
·43 lines (33 loc) · 1.12 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/bash
set -e
set -x
RUST_DIR="$(cd -- "$(dirname "${BASH_SOURCE[0]}")/.." && pwd )"
source "$RUST_DIR/scripts/gzip-and-sum.sh"
ARTIFACTS_DIR=${ARTIFACTS_DIR:-"$RUST_DIR/release_artifacts"}
mkdir -p "$ARTIFACTS_DIR"
export CARGO_TARGET_DIR=${CARO_TARGET_DIR:-"$RUST_DIR/target"}
# All flags passed to this script are passed to cargo.
cargo_flags=( "$@" )
build_x86_64() {
sudo apt-get install -y musl-tools
cargo build --target=x86_64-unknown-linux-musl "${cargo_flags[@]}"
if [[ "${cargo_flags[*]}" =~ "--release" ]]; then
gzip_and_sum \
"$CARGO_TARGET_DIR/x86_64-unknown-linux-musl/release/pact-mock-server" \
"$ARTIFACTS_DIR/pact-mock-server-linux-x86_64.gz"
fi
}
install_cross() {
cargo install cross@0.2.5
}
build_aarch64() {
install_cross
cross build --target=aarch64-unknown-linux-musl "${cargo_flags[@]}"
if [[ "${cargo_flags[*]}" =~ "--release" ]]; then
gzip_and_sum \
"$CARGO_TARGET_DIR/aarch64-unknown-linux-musl/release/pact-mock-server" \
"$ARTIFACTS_DIR/pact-mock-server-linux-aarch64.gz"
fi
}
build_x86_64
build_aarch64