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