]> git.lizzy.rs Git - rust.git/blob - src/ci/docker/dist-x86_64-musl/build-musl.sh
Rollup merge of #41135 - japaric:unstable-docs, r=steveklabnik
[rust.git] / src / ci / docker / dist-x86_64-musl / build-musl.sh
1 #!/bin/sh
2 # Copyright 2016 The Rust Project Developers. See the COPYRIGHT
3 # file at the top-level directory of this distribution and at
4 # http://rust-lang.org/COPYRIGHT.
5 #
6 # Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
7 # http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
8 # <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
9 # option. This file may not be copied, modified, or distributed
10 # except according to those terms.
11
12 set -ex
13
14 # We need to mitigate rust-lang/rust#34978 when compiling musl itself as well
15 export CFLAGS="-fPIC -Wa,-mrelax-relocations=no"
16 export CXXFLAGS="-Wa,-mrelax-relocations=no"
17
18 MUSL=musl-1.1.16
19 curl https://www.musl-libc.org/releases/$MUSL.tar.gz | tar xzf -
20 cd $MUSL
21 ./configure --prefix=/musl-x86_64 --disable-shared
22 make -j10
23 make install
24
25 cd ..
26 rm -rf $MUSL
27
28 # To build MUSL we're going to need a libunwind lying around, so acquire that
29 # here and build it.
30 curl -L https://github.com/llvm-mirror/llvm/archive/release_37.tar.gz | tar xzf -
31 curl -L https://github.com/llvm-mirror/libunwind/archive/release_37.tar.gz | tar xzf -
32
33 mkdir libunwind-build
34 cd libunwind-build
35 cmake ../libunwind-release_37 -DLLVM_PATH=/build/llvm-release_37 \
36           -DLIBUNWIND_ENABLE_SHARED=0
37 make -j10
38 cp lib/libunwind.a /musl-x86_64/lib