]> git.lizzy.rs Git - rust.git/blob - src/ci/docker/dist-various-2/build-x86_64-fortanix-unknown-sgx-toolchain.sh
Rollup merge of #57981 - Zoxc:fix-57979, r=nikomatsakis
[rust.git] / src / ci / docker / dist-various-2 / build-x86_64-fortanix-unknown-sgx-toolchain.sh
1 #!/bin/bash
2
3 set -eu
4 source shared.sh
5
6 if [ -z "$1" ]; then
7     echo "Usage: ${0} <commit_id>"
8     exit -1
9 fi
10
11 target="x86_64-fortanix-unknown-sgx"
12 url="https://github.com/fortanix/llvm-project/archive/${1}.tar.gz"
13 repo_name="llvm-project"
14
15 install_prereq() {
16     apt-get update
17     apt-get install -y --no-install-recommends \
18             build-essential \
19             ca-certificates \
20             cmake \
21             git
22 }
23
24 build_unwind() {
25     set -x
26     dir_name="${target}_temp"
27     rm -rf ${dir_name}
28     mkdir -p ${dir_name}
29     pushd ${dir_name}
30
31     # Clone Fortanix's fork of llvm-project which has a port of libunwind
32     fetch_github_commit_archive "$repo_name" "$url"
33     cd "${repo_name}/libunwind"
34
35     # Build libunwind
36     mkdir -p build
37     cd build
38     cmake -DCMAKE_BUILD_TYPE="RELEASE" -DRUST_SGX=1 -G "Unix Makefiles" \
39         -DLLVM_ENABLE_WARNINGS=1 -DLIBUNWIND_ENABLE_WERROR=1 -DLIBUNWIND_ENABLE_PEDANTIC=0 \
40         -DLLVM_PATH=../../llvm/ ../
41     make unwind_static
42     install -D "lib/libunwind.a" "/${target}/lib/libunwind.a"
43
44     popd
45     rm -rf ${dir_name}
46
47     { set +x; } 2>/dev/null
48 }
49
50 set -x
51 hide_output install_prereq
52 build_unwind