From 9be3936e955139c010c3502670f67ec92440ed0c Mon Sep 17 00:00:00 2001 From: bjorn3 Date: Sun, 14 Feb 2021 14:43:23 +0100 Subject: [PATCH 1/3] Use #!/usr/bin/env bash FreeBSD doesn't have /bin/bash --- build.sh | 2 +- build_sysroot/build_sysroot.sh | 2 +- build_sysroot/prepare_sysroot_src.sh | 2 +- clean_all.sh | 2 +- prepare.sh | 2 +- scripts/cargo.sh | 2 +- scripts/rustup.sh | 2 +- scripts/test_bootstrap.sh | 2 +- scripts/tests.sh | 2 +- test.sh | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/build.sh b/build.sh index 598ce35eceaa..19b7344b163b 100755 --- a/build.sh +++ b/build.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -e # Settings diff --git a/build_sysroot/build_sysroot.sh b/build_sysroot/build_sysroot.sh index 282ce4a582c4..636aa5f3f3dc 100755 --- a/build_sysroot/build_sysroot.sh +++ b/build_sysroot/build_sysroot.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Requires the CHANNEL env var to be set to `debug` or `release.` diff --git a/build_sysroot/prepare_sysroot_src.sh b/build_sysroot/prepare_sysroot_src.sh index d3b87e02ba89..d6e012148ac7 100755 --- a/build_sysroot/prepare_sysroot_src.sh +++ b/build_sysroot/prepare_sysroot_src.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -e cd "$(dirname "$0")" diff --git a/clean_all.sh b/clean_all.sh index b47efe72bce0..a7bbeb05cac5 100755 --- a/clean_all.sh +++ b/clean_all.sh @@ -1,4 +1,4 @@ -#!/bin/bash --verbose +#!/usr/bin/env bash set -e rm -rf target/ build/ build_sysroot/{sysroot_src/,target/,compiler-builtins/} perf.data{,.old} diff --git a/prepare.sh b/prepare.sh index 08e7cb180299..ee995ffcfa9f 100755 --- a/prepare.sh +++ b/prepare.sh @@ -1,4 +1,4 @@ -#!/bin/bash --verbose +#!/usr/bin/env bash set -e rustup component add rust-src rustc-dev llvm-tools-preview diff --git a/scripts/cargo.sh b/scripts/cargo.sh index a3d6d303057b..669d2d45b71b 100755 --- a/scripts/cargo.sh +++ b/scripts/cargo.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash dir=$(dirname "$0") source "$dir/config.sh" diff --git a/scripts/rustup.sh b/scripts/rustup.sh index 430f5c469b4b..694945a87c26 100755 --- a/scripts/rustup.sh +++ b/scripts/rustup.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -e diff --git a/scripts/test_bootstrap.sh b/scripts/test_bootstrap.sh index 15f97c867a1e..5bc454884446 100755 --- a/scripts/test_bootstrap.sh +++ b/scripts/test_bootstrap.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -e cd "$(dirname "$0")/../" diff --git a/scripts/tests.sh b/scripts/tests.sh index d37b57babe61..cfc0c3fe9bd4 100755 --- a/scripts/tests.sh +++ b/scripts/tests.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -e diff --git a/test.sh b/test.sh index 5ab10e0e905c..e222adc7b805 100755 --- a/test.sh +++ b/test.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -e ./build.sh --sysroot none "$@" From 87ecdaa8482b7bcdc5a0adabea1cfb3f493705fa Mon Sep 17 00:00:00 2001 From: bjorn3 Date: Sun, 14 Feb 2021 15:09:01 +0100 Subject: [PATCH 2/3] Recognize FreeBSD as OS --- build.sh | 4 ++-- scripts/config.sh | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/build.sh b/build.sh index 19b7344b163b..52bc21d0a176 100755 --- a/build.sh +++ b/build.sh @@ -34,13 +34,13 @@ done # Build cg_clif unset CARGO_TARGET_DIR unamestr=$(uname) -if [[ "$unamestr" == 'Linux' ]]; then +if [[ "$unamestr" == 'Linux' || "$unamestr" == "FreeBSD" ]]; then export RUSTFLAGS='-Clink-arg=-Wl,-rpath=$ORIGIN/../lib '$RUSTFLAGS elif [[ "$unamestr" == 'Darwin' ]]; then export RUSTFLAGS='-Csplit-debuginfo=unpacked -Clink-arg=-Wl,-rpath,@loader_path/../lib -Zosx-rpath-install-name '$RUSTFLAGS dylib_ext='dylib' else - echo "Unsupported os" + echo "Unsupported os $unamestr" exit 1 fi if [[ "$CHANNEL" == "release" ]]; then diff --git a/scripts/config.sh b/scripts/config.sh index 834708aa9a6f..e1f54e4a8b55 100644 --- a/scripts/config.sh +++ b/scripts/config.sh @@ -3,7 +3,7 @@ set -e unamestr=$(uname) -if [[ "$unamestr" == 'Linux' ]]; then +if [[ "$unamestr" == 'Linux' || "$unamestr" == 'FreeBSD' ]]; then dylib_ext='so' elif [[ "$unamestr" == 'Darwin' ]]; then dylib_ext='dylib' From 47bc1db236e5117021aa2eda575436bf90f889b2 Mon Sep 17 00:00:00 2001 From: bjorn3 Date: Sun, 14 Feb 2021 12:54:00 +0100 Subject: [PATCH 3/3] Test FreeBSD on Cirrus CI --- .cirrus.yml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 .cirrus.yml diff --git a/.cirrus.yml b/.cirrus.yml new file mode 100644 index 000000000000..e173df423a76 --- /dev/null +++ b/.cirrus.yml @@ -0,0 +1,25 @@ +task: + name: freebsd + freebsd_instance: + image: freebsd-12-1-release-amd64 + setup_rust_script: + - pkg install -y curl git bash + - curl https://sh.rustup.rs -sSf --output rustup.sh + - sh rustup.sh --default-toolchain none -y --profile=minimal + cargo_bin_cache: + folder: ~/.cargo/bin + target_cache: + folder: target + prepare_script: + - . $HOME/.cargo/env + - git config --global user.email "user@example.com" + - git config --global user.name "User" + - ./prepare.sh + test_script: + - . $HOME/.cargo/env + - # Enable backtraces for easier debugging + - export RUST_BACKTRACE=1 + - # Reduce amount of benchmark runs as they are slow + - export COMPILE_RUNS=2 + - export RUN_RUNS=2 + - ./test.sh