]> git.lizzy.rs Git - rust.git/commitdiff
Clean up build-x86_64-fortanix-unknown-sgx-toolchain.sh
authorJethro Beekman <jethro@fortanix.com>
Sat, 26 Jan 2019 09:16:39 +0000 (14:46 +0530)
committerJethro Beekman <jethro@fortanix.com>
Sat, 26 Jan 2019 09:23:00 +0000 (14:53 +0530)
src/ci/docker/dist-various-2/build-x86_64-fortanix-unknown-sgx-toolchain.sh
src/ci/docker/dist-various-2/shared.sh
src/ci/init_repo.sh
src/ci/shared.sh

index 76921316df2cc625c0d6e193f694bffde09ea100..f94cd36e8d6ec6f56eab54cc0530da7260928b32 100755 (executable)
@@ -12,8 +12,7 @@ target="x86_64-fortanix-unknown-sgx"
 url="https://github.com/fortanix/llvm-project/archive/${1}.tar.gz"
 repo_name="llvm-project"
 
-install_prereq()
-{
+install_prereq() {
     apt-get update
     apt-get install -y --no-install-recommends \
             build-essential \
@@ -22,34 +21,30 @@ install_prereq()
             git
 }
 
-# Clone Fortanix's port of llvm-project to build libunwind that would link with this target.
-# The below method to download a single commit from llvm-project is based on fetch_submodule
-# from init_repo.sh
-fetch_llvm_commit()
-{
-    cached="download-${repo_name}.tar.gz"
-    curl -f -sSL -o ${cached} ${url}
-    tar -xvzf ${cached}
-    mkdir "./${repo_name}" && tar -xf ${cached} -C ${repo_name} --strip-components 1
-}
-
-build_unwind()
-{
+build_unwind() {
+    set -x
     dir_name="${target}_temp"
-    rm -rf "./${dir_name}"
+    rm -rf ${dir_name}
     mkdir -p ${dir_name}
-    cd ${dir_name}
+    pushd ${dir_name}
 
-    retry fetch_llvm_commit
+    # Clone Fortanix's fork of llvm-project which has a port of libunwind
+    fetch_github_commit_archive "$repo_name" "$url"
     cd "${repo_name}/libunwind"
 
     # Build libunwind
     mkdir -p build
     cd build
-    cmake -DCMAKE_BUILD_TYPE="RELEASE" -DRUST_SGX=1 -G "Unix Makefiles" -DLLVM_PATH=../../llvm/ ../
+    cmake -DCMAKE_BUILD_TYPE="RELEASE" -DRUST_SGX=1 -G "Unix Makefiles" \
+        -DLLVM_ENABLE_WARNINGS=1 -DLIBUNWIND_ENABLE_WERROR=1 -DLIBUNWIND_ENABLE_PEDANTIC=0 \
+        -DLLVM_PATH=../../llvm/ ../
     make unwind_static
     install -D "lib/libunwind.a" "/${target}/lib/libunwind.a"
+
+    popd
     rm -rf ${dir_name}
+
+    { set +x; } 2>/dev/null
 }
 
 set -x
index fb917b0510e40261f28ac8ad3e7efa5a71694700..7abace65b9c03a1db28378137404e853c7b8bf4b 100644 (file)
@@ -1,5 +1,5 @@
 hide_output() {
-  set +x
+  { set +x; } 2>/dev/null
   on_err="
 echo ERROR: An error was encountered with the build.
 cat /tmp/build.log
@@ -14,6 +14,7 @@ exit 1
   set -x
 }
 
+# Copied from ../../shared.sh
 function retry {
   echo "Attempting with retry:" "$@"
   local n=1
@@ -31,3 +32,15 @@ function retry {
     }
   done
 }
+
+# Copied from ../../init_repo.sh
+function fetch_github_commit_archive {
+    local module=$1
+    local cached="download-${module//\//-}.tar.gz"
+    retry sh -c "rm -f $cached && \
+        curl -f -sSL -o $cached $2"
+    mkdir $module
+    touch "$module/.git"
+    tar -C $module --strip-components=1 -xf $cached
+    rm $cached
+}
index 6de433fd4c2da9d344f74d41badc53b7f3cc6c0b..3dfd3381576170b00edc3c1d851b993eb84a16e3 100755 (executable)
@@ -34,11 +34,12 @@ if grep -q RUST_RELEASE_CHANNEL=beta src/ci/run.sh; then
   git fetch origin --unshallow beta master
 fi
 
-function fetch_submodule {
+# Duplicated in docker/dist-various-2/shared.sh
+function fetch_github_commit_archive {
     local module=$1
     local cached="download-${module//\//-}.tar.gz"
     retry sh -c "rm -f $cached && \
-        curl -sSL -o $cached $2"
+        curl -f -sSL -o $cached $2"
     mkdir $module
     touch "$module/.git"
     tar -C $module --strip-components=1 -xf $cached
@@ -58,7 +59,7 @@ for i in ${!modules[@]}; do
         git rm $module
         url=${urls[$i]}
         url=${url/\.git/}
-        fetch_submodule $module "$url/archive/$commit.tar.gz" &
+        fetch_github_commit_archive $module "$url/archive/$commit.tar.gz" &
         continue
     else
         use_git="$use_git $module"
index 4a49f3441a41db2d78d5aaa3038db4382ebf6f3e..3ba64ad412064e48b5eb3a91d84793fa891323bb 100644 (file)
@@ -5,6 +5,7 @@
 # marked as an executable file in git.
 
 # See http://unix.stackexchange.com/questions/82598
+# Duplicated in docker/dist-various-2/shared.sh
 function retry {
   echo "Attempting with retry:" "$@"
   local n=1