]> git.lizzy.rs Git - rust.git/blob - src/ci/docker/dist-powerpc64-linux/build-powerpc64le-toolchain.sh
Rollup merge of #40521 - TimNN:panic-free-shift, r=alexcrichton
[rust.git] / src / ci / docker / dist-powerpc64-linux / build-powerpc64le-toolchain.sh
1 #!/bin/bash
2 # Copyright 2017 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 source shared.sh
15
16 BINUTILS=2.25.1
17 GCC=5.3.0
18 TARGET=powerpc64le-linux-gnu
19 SYSROOT=/usr/local/$TARGET/sysroot
20
21 # First, download the CentOS7 glibc.ppc64le and relevant header files.
22 # (upstream ppc64le support wasn't added until 2.19, which el7 backported.)
23 mkdir -p $SYSROOT
24 pushd $SYSROOT
25
26 centos_base=http://mirror.centos.org/altarch/7.3.1611/os/ppc64le/Packages
27 glibc_v=2.17-157.el7
28 kernel_v=3.10.0-514.el7
29 for package in glibc{,-devel,-headers}-$glibc_v kernel-headers-$kernel_v; do
30   curl $centos_base/$package.ppc64le.rpm | \
31     rpm2cpio - | cpio -idm
32 done
33
34 ln -sT lib64 lib
35 ln -sT lib64 usr/lib
36
37 popd
38
39 # Next, download and build binutils.
40 mkdir binutils-$TARGET
41 pushd binutils-$TARGET
42 curl https://ftp.gnu.org/gnu/binutils/binutils-$BINUTILS.tar.bz2 | tar xjf -
43 mkdir binutils-build
44 cd binutils-build
45 hide_output ../binutils-$BINUTILS/configure --target=$TARGET --with-sysroot=$SYSROOT
46 hide_output make -j10
47 hide_output make install
48 popd
49 rm -rf binutils-$TARGET
50
51 # Finally, download and build gcc.
52 mkdir gcc-$TARGET
53 pushd gcc-$TARGET
54 curl https://ftp.gnu.org/gnu/gcc/gcc-$GCC/gcc-$GCC.tar.bz2 | tar xjf -
55 cd gcc-$GCC
56 hide_output ./contrib/download_prerequisites
57
58 mkdir ../gcc-build
59 cd ../gcc-build
60 hide_output ../gcc-$GCC/configure                            \
61   --enable-languages=c,c++                       \
62   --target=$TARGET                               \
63   --with-cpu=power8                              \
64   --with-sysroot=$SYSROOT                        \
65   --disable-libcilkrts                           \
66   --disable-multilib                             \
67   --disable-nls                                  \
68   --disable-libgomp                              \
69   --disable-libquadmath                          \
70   --disable-libssp                               \
71   --disable-libvtv                               \
72   --disable-libcilkrt                            \
73   --disable-libada                               \
74   --disable-libsanitizer                         \
75   --disable-libquadmath-support                  \
76   --disable-lto
77 hide_output hide_output make -j10
78 hide_output make install
79
80 popd
81 rm -rf gcc-$TARGET