summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorLinus Färnstrand <linus@mullvad.net>2018-03-01 12:43:12 +0100
committerLinus Färnstrand <linus@mullvad.net>2018-03-01 12:43:12 +0100
commit57729ef5cb8fec383f371674f4bca2d1191518a5 (patch)
treeb4dec5eab08de4c369f42d5e6cd588e2e7b2a3b4
parenta9e15a62000f69144859b3c8e0b20d781b04b648 (diff)
parent60880528c144e8cce813db1cf9527d8a5645c1a7 (diff)
downloadmullvadvpn-57729ef5cb8fec383f371674f4bca2d1191518a5.tar.xz
mullvadvpn-57729ef5cb8fec383f371674f4bca2d1191518a5.zip
Merge branch 'safer-build-script'
-rwxr-xr-xbuild.sh26
1 files changed, 16 insertions, 10 deletions
diff --git a/build.sh b/build.sh
index c0c4e7fea8..40f1052be7 100755
--- a/build.sh
+++ b/build.sh
@@ -5,6 +5,15 @@
set -eu
+REQUIRED_RUSTC_VERSION="rustc 1.24.0 (4d90ac38c 2018-02-12)"
+RUSTC_VERSION=`rustc +stable --version`
+if [[ $RUSTC_VERSION != $REQUIRED_RUSTC_VERSION ]]; then
+ echo "You are running the wrong Rust compiler version."
+ echo "You are running $RUSTC_VERSION, but this project requires $REQUIRED_RUSTC_VERSION"
+ echo "for release builds."
+ exit 1
+fi
+
if [[ "${1:-""}" != "--allow-dirty" ]]; then
if [[ $(git diff --shortstat 2> /dev/null | tail -n1) != "" ]]; then
echo "Dirty working directory!"
@@ -20,21 +29,18 @@ case "$(uname -s)" in
Darwin*) export MACOSX_DEPLOYMENT_TARGET="10.7";;
esac
+# Remove binaries. To make sure it is rebuilt with the stable toolchain and the latest changes.
+cargo +stable clean
+
+echo "Compiling Rust backend in release mode with $RUSTC_VERSION..."
+cargo +stable build --release
+
+
binaries=(
./target/release/mullvad-daemon
./target/release/mullvad
./target/release/problem-report
)
-
-# Remove binaries. To make sure it is rebuilt with the stable toolchain and the latest changes.
-for binary in ${binaries[*]}; do
- echo "Removing $binary"
- rm -f $binary
-done
-
-echo "Compiling Rust backend in release mode..."
-cargo +stable build --release
-
for binary in ${binaries[*]}; do
echo "Stripping debugging symbols from $binary"
strip $binary