From ca0499d73685f084d8fd77417411d6f5162cc593 Mon Sep 17 00:00:00 2001 From: Marco A L Barbosa Date: Tue, 2 Jan 2018 18:02:42 -0200 Subject: ci: use musl shared script in dist-x86_64-musl --- src/ci/docker/dist-x86_64-musl/Dockerfile | 10 +++++-- src/ci/docker/dist-x86_64-musl/build-musl.sh | 38 -------------------------- src/ci/docker/scripts/musl.sh | 41 ++++++++++++++++++++++++++++ 3 files changed, 49 insertions(+), 40 deletions(-) delete mode 100644 src/ci/docker/dist-x86_64-musl/build-musl.sh create mode 100644 src/ci/docker/scripts/musl.sh (limited to 'src') diff --git a/src/ci/docker/dist-x86_64-musl/Dockerfile b/src/ci/docker/dist-x86_64-musl/Dockerfile index 91ed6bfe1f6..77a55b33e41 100644 --- a/src/ci/docker/dist-x86_64-musl/Dockerfile +++ b/src/ci/docker/dist-x86_64-musl/Dockerfile @@ -17,8 +17,14 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ pkg-config WORKDIR /build/ -COPY dist-x86_64-musl/build-musl.sh /build/ -RUN sh /build/build-musl.sh && rm -rf /build + +COPY scripts/musl.sh /build/ +# We need to mitigate rust-lang/rust#34978 when compiling musl itself as well +RUN CC=gcc \ + CFLAGS="-fPIC -Wa,-mrelax-relocations=no" \ + CXX=g++ \ + CXXFLAGS="-Wa,-mrelax-relocations=no" \ + bash musl.sh x86_64 && rm -rf /build COPY scripts/sccache.sh /scripts/ RUN sh /scripts/sccache.sh diff --git a/src/ci/docker/dist-x86_64-musl/build-musl.sh b/src/ci/docker/dist-x86_64-musl/build-musl.sh deleted file mode 100644 index 9be8d001149..00000000000 --- a/src/ci/docker/dist-x86_64-musl/build-musl.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/sh -# Copyright 2016 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. - -set -ex - -# We need to mitigate rust-lang/rust#34978 when compiling musl itself as well -export CFLAGS="-fPIC -Wa,-mrelax-relocations=no" -export CXXFLAGS="-Wa,-mrelax-relocations=no" - -MUSL=musl-1.1.17 -curl https://www.musl-libc.org/releases/$MUSL.tar.gz | tar xzf - -cd $MUSL -./configure --prefix=/musl-x86_64 --disable-shared -make -j10 -make install - -cd .. -rm -rf $MUSL - -# To build MUSL we're going to need a libunwind lying around, so acquire that -# here and build it. -curl -L https://github.com/llvm-mirror/llvm/archive/release_37.tar.gz | tar xzf - -curl -L https://github.com/llvm-mirror/libunwind/archive/release_37.tar.gz | tar xzf - - -mkdir libunwind-build -cd libunwind-build -cmake ../libunwind-release_37 -DLLVM_PATH=/build/llvm-release_37 \ - -DLIBUNWIND_ENABLE_SHARED=0 -make -j10 -cp lib/libunwind.a /musl-x86_64/lib diff --git a/src/ci/docker/scripts/musl.sh b/src/ci/docker/scripts/musl.sh new file mode 100644 index 00000000000..011fd88231d --- /dev/null +++ b/src/ci/docker/scripts/musl.sh @@ -0,0 +1,41 @@ +#!/bin/sh +# Copyright 2016 The Rust Project Developers. See the COPYRIGHT +# file at the top-level directory of this distribution and at +# http://rust-lang.org/COPYRIGHT. +# +# Licensed under the Apache License, Version 2.0 or the MIT license +# , at your +# option. This file may not be copied, modified, or distributed +# except according to those terms. + +set -ex + +TAG=$1 +shift + +MUSL=musl-1.1.17 +curl https://www.musl-libc.org/releases/$MUSL.tar.gz | tar xzf - +cd $MUSL +./configure --disable-shared --prefix=/musl-$TAG $@ +make -j10 +make install + +cd .. +rm -rf $MUSL + +# To build MUSL we're going to need a libunwind lying around, so acquire that +# here and build it. +curl -L https://github.com/llvm-mirror/llvm/archive/release_37.tar.gz | tar xzf - +curl -L https://github.com/llvm-mirror/libunwind/archive/release_37.tar.gz | tar xzf - + +mkdir libunwind-build +cd libunwind-build +cmake ../libunwind-release_37 -DLLVM_PATH=/build/llvm-release_37 \ + -DLIBUNWIND_ENABLE_SHARED=0 \ + -DCMAKE_C_COMPILER=$CC \ + -DCMAKE_CXX_COMPILER=$CXX \ + -DCMAKE_C_FLAGS="$CFLAGS" \ + -DCMAKE_CXX_FLAGS="$CXXFLAGS" +make -j10 +cp lib/libunwind.a /musl-$TAG/lib -- cgit 1.4.1-3-g733a5