Skip to content

Commit 63505b8

Browse files
committed
Auto merge of #57914 - jethrogb:jb/sgx-unwind-version, r=alexcrichton
SGX target: clean up dist builder, update libunwind This incorporates fortanix/llvm-project#4 Fixes fortanix/rust-sgx#65 r? @alexcrichton
2 parents 8a0e5fa + b025557 commit 63505b8

File tree

5 files changed

+35
-25
lines changed

5 files changed

+35
-25
lines changed

src/ci/docker/dist-various-2/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ RUN /tmp/build-solaris-toolchain.sh sparcv9 sparcv9 solaris-sparc
3232
COPY dist-various-2/build-x86_64-fortanix-unknown-sgx-toolchain.sh /tmp/
3333
# We pass the commit id of the port of LLVM's libunwind to the build script.
3434
# Any update to the commit id here, should cause the container image to be re-built from this point on.
35-
RUN /tmp/build-x86_64-fortanix-unknown-sgx-toolchain.sh "13fad13f8ea83a8da58d04a5faa45943151b3398"
35+
RUN /tmp/build-x86_64-fortanix-unknown-sgx-toolchain.sh "53b586346f2c7870e20b170decdc30729d97c42b"
3636

3737
COPY scripts/sccache.sh /scripts/
3838
RUN sh /scripts/sccache.sh

src/ci/docker/dist-various-2/build-x86_64-fortanix-unknown-sgx-toolchain.sh

+15-20
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ target="x86_64-fortanix-unknown-sgx"
1212
url="https://github.com/fortanix/llvm-project/archive/${1}.tar.gz"
1313
repo_name="llvm-project"
1414

15-
install_prereq()
16-
{
15+
install_prereq() {
1716
apt-get update
1817
apt-get install -y --no-install-recommends \
1918
build-essential \
@@ -22,36 +21,32 @@ install_prereq()
2221
git
2322
}
2423

25-
# Clone Fortanix's port of llvm-project to build libunwind that would link with this target.
26-
# The below method to download a single commit from llvm-project is based on fetch_submodule
27-
# from init_repo.sh
28-
fetch_llvm_commit()
29-
{
30-
cached="download-${repo_name}.tar.gz"
31-
curl -f -sSL -o ${cached} ${url}
32-
tar -xvzf ${cached}
33-
mkdir "./${repo_name}" && tar -xf ${cached} -C ${repo_name} --strip-components 1
34-
}
35-
36-
build_unwind()
37-
{
24+
build_unwind() {
25+
set -x
3826
dir_name="${target}_temp"
39-
rm -rf "./${dir_name}"
27+
rm -rf ${dir_name}
4028
mkdir -p ${dir_name}
41-
cd ${dir_name}
29+
pushd ${dir_name}
4230

43-
retry fetch_llvm_commit
31+
# Clone Fortanix's fork of llvm-project which has a port of libunwind
32+
fetch_github_commit_archive "$repo_name" "$url"
4433
cd "${repo_name}/libunwind"
4534

4635
# Build libunwind
4736
mkdir -p build
4837
cd build
49-
cmake -DCMAKE_BUILD_TYPE="RELEASE" -DRUST_SGX=1 -G "Unix Makefiles" -DLLVM_PATH=../../llvm/ ../
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/ ../
5041
make unwind_static
5142
install -D "lib/libunwind.a" "/${target}/lib/libunwind.a"
43+
44+
popd
5245
rm -rf ${dir_name}
46+
47+
{ set +x; } 2>/dev/null
5348
}
5449

5550
set -x
5651
hide_output install_prereq
57-
hide_output build_unwind
52+
build_unwind

src/ci/docker/dist-various-2/shared.sh

+14-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
hide_output() {
2-
set +x
2+
{ set +x; } 2>/dev/null
33
on_err="
44
echo ERROR: An error was encountered with the build.
55
cat /tmp/build.log
@@ -14,6 +14,7 @@ exit 1
1414
set -x
1515
}
1616

17+
# Copied from ../../shared.sh
1718
function retry {
1819
echo "Attempting with retry:" "$@"
1920
local n=1
@@ -31,3 +32,15 @@ function retry {
3132
}
3233
done
3334
}
35+
36+
# Copied from ../../init_repo.sh
37+
function fetch_github_commit_archive {
38+
local module=$1
39+
local cached="download-${module//\//-}.tar.gz"
40+
retry sh -c "rm -f $cached && \
41+
curl -f -sSL -o $cached $2"
42+
mkdir $module
43+
touch "$module/.git"
44+
tar -C $module --strip-components=1 -xf $cached
45+
rm $cached
46+
}

src/ci/init_repo.sh

+4-3
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,12 @@ if grep -q RUST_RELEASE_CHANNEL=beta src/ci/run.sh; then
3434
git fetch origin --unshallow beta master
3535
fi
3636

37-
function fetch_submodule {
37+
# Duplicated in docker/dist-various-2/shared.sh
38+
function fetch_github_commit_archive {
3839
local module=$1
3940
local cached="download-${module//\//-}.tar.gz"
4041
retry sh -c "rm -f $cached && \
41-
curl -sSL -o $cached $2"
42+
curl -f -sSL -o $cached $2"
4243
mkdir $module
4344
touch "$module/.git"
4445
tar -C $module --strip-components=1 -xf $cached
@@ -58,7 +59,7 @@ for i in ${!modules[@]}; do
5859
git rm $module
5960
url=${urls[$i]}
6061
url=${url/\.git/}
61-
fetch_submodule $module "$url/archive/$commit.tar.gz" &
62+
fetch_github_commit_archive $module "$url/archive/$commit.tar.gz" &
6263
continue
6364
else
6465
use_git="$use_git $module"

src/ci/shared.sh

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
# marked as an executable file in git.
66

77
# See http://unix.stackexchange.com/questions/82598
8+
# Duplicated in docker/dist-various-2/shared.sh
89
function retry {
910
echo "Attempting with retry:" "$@"
1011
local n=1

0 commit comments

Comments
 (0)